mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Fix reglock setting incorrect during backup restore.
This commit is contained in:
@@ -227,6 +227,7 @@ class SvrValues internal constructor(store: KeyValueStore) : SignalStoreValues(s
|
||||
.putBoolean(OPTED_OUT, true)
|
||||
.remove(LOCK_LOCAL_PIN_HASH)
|
||||
.remove(PIN)
|
||||
.remove(REGISTRATION_LOCK_ENABLED)
|
||||
.putLong(LAST_CREATE_FAILED_TIMESTAMP, -1)
|
||||
.commit()
|
||||
}
|
||||
|
||||
@@ -299,7 +299,8 @@ object SvrRepository {
|
||||
masterKey: MasterKey?,
|
||||
userPin: String?,
|
||||
hasPinToRestore: Boolean,
|
||||
setRegistrationLockEnabled: Boolean
|
||||
setRegistrationLockEnabled: Boolean,
|
||||
restoredAEP: Boolean
|
||||
) {
|
||||
Log.i(TAG, "[onRegistrationComplete] Starting", true)
|
||||
operationLock.withLock {
|
||||
@@ -321,8 +322,12 @@ object SvrRepository {
|
||||
|
||||
AppDependencies.jobManager.add(ResetSvrGuessCountJob())
|
||||
} else if (masterKey != null) {
|
||||
Log.i(TAG, "[onRegistrationComplete] ReRegistered with key without pin")
|
||||
Log.i(TAG, "[onRegistrationComplete] ReRegistered with key without pin", true)
|
||||
SignalStore.svr.masterKeyForInitialDataRestore = masterKey
|
||||
if (restoredAEP && setRegistrationLockEnabled) {
|
||||
Log.i(TAG, "[onRegistrationComplete] Registration Lock", true)
|
||||
SignalStore.svr.isRegistrationLockEnabled = true
|
||||
}
|
||||
} else if (hasPinToRestore) {
|
||||
Log.i(TAG, "[onRegistrationComplete] Has a PIN to restore.", true)
|
||||
SignalStore.svr.clearRegistrationLockAndPin()
|
||||
|
||||
@@ -219,7 +219,7 @@ object RegistrationRepository {
|
||||
NotificationManagerCompat.from(context).cancel(NotificationIds.UNREGISTERED_NOTIFICATION_ID)
|
||||
|
||||
val masterKey = if (data.masterKey != null) MasterKey(data.masterKey.toByteArray()) else null
|
||||
SvrRepository.onRegistrationComplete(masterKey, data.pin, hasPin, data.reglockEnabled)
|
||||
SvrRepository.onRegistrationComplete(masterKey, data.pin, hasPin, data.reglockEnabled, false)
|
||||
|
||||
AppDependencies.resetNetwork()
|
||||
AppDependencies.startNetwork()
|
||||
|
||||
@@ -241,7 +241,7 @@ object RegistrationRepository {
|
||||
NotificationManagerCompat.from(context).cancel(NotificationIds.UNREGISTERED_NOTIFICATION_ID)
|
||||
|
||||
val masterKey = if (data.masterKey != null) MasterKey(data.masterKey.toByteArray()) else null
|
||||
SvrRepository.onRegistrationComplete(masterKey, data.pin, hasPin, data.reglockEnabled)
|
||||
SvrRepository.onRegistrationComplete(masterKey, data.pin, hasPin, data.reglockEnabled, SignalStore.account.restoredAccountEntropyPool)
|
||||
|
||||
AppDependencies.resetNetwork()
|
||||
AppDependencies.startNetwork()
|
||||
|
||||
Reference in New Issue
Block a user