mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-08-05 04:45:14 +01:00
Keep the universalSealedSender setting on re-reg in regV5.
This commit is contained in:
committed by
Michelle Tang
parent
e76a584bb7
commit
248a787d74
+2
@@ -54,6 +54,7 @@ import org.thoughtcrime.securesms.profiles.AvatarHelper
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.registration.data.RegistrationRepository
|
||||
import org.thoughtcrime.securesms.registration.util.RegistrationUtil
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.time.LocalDateTime
|
||||
@@ -93,6 +94,7 @@ class AppRegistrationStorageController(private val context: Context) : StorageCo
|
||||
servicePassword = servicePassword,
|
||||
aep = aep,
|
||||
registrationLockEnabled = SignalStore.svr.isRegistrationLockEnabled,
|
||||
unrestrictedUnidentifiedAccess = TextSecurePreferences.isUniversalUnidentifiedAccess(context),
|
||||
aciIdentityKeyPair = aciIdentityKeyPair,
|
||||
pniIdentityKeyPair = pniIdentityKeyPair
|
||||
)
|
||||
|
||||
+6
@@ -42,6 +42,7 @@ object RegistrationPreferences {
|
||||
private const val KEY_PNI_IDENTITY_KEY = "pni_identity_key"
|
||||
private const val KEY_TEMPORARY_MASTER_KEY = "temporary_master_key"
|
||||
private const val KEY_REGISTRATION_LOCK_ENABLED = "registration_lock_enabled"
|
||||
private const val KEY_UNRESTRICTED_UNIDENTIFIED_ACCESS = "unrestricted_unidentified_access"
|
||||
private const val KEY_PIN = "has_pin"
|
||||
private const val KEY_PIN_ALPHANUMERIC = "pin_alphanumeric"
|
||||
private const val KEY_PINS_OPTED_OUT = "pins_opted_out"
|
||||
@@ -117,6 +118,10 @@ object RegistrationPreferences {
|
||||
get() = prefs.getBoolean(KEY_REGISTRATION_LOCK_ENABLED, false)
|
||||
set(value) = prefs.edit { putBoolean(KEY_REGISTRATION_LOCK_ENABLED, value) }
|
||||
|
||||
var unrestrictedUnidentifiedAccess: Boolean
|
||||
get() = prefs.getBoolean(KEY_UNRESTRICTED_UNIDENTIFIED_ACCESS, false)
|
||||
set(value) = prefs.edit { putBoolean(KEY_UNRESTRICTED_UNIDENTIFIED_ACCESS, value) }
|
||||
|
||||
val hasPin: Boolean
|
||||
get() = pin != null
|
||||
|
||||
@@ -197,6 +202,7 @@ object RegistrationPreferences {
|
||||
servicePassword = servicePassword,
|
||||
aep = aep,
|
||||
registrationLockEnabled = registrationLockEnabled,
|
||||
unrestrictedUnidentifiedAccess = unrestrictedUnidentifiedAccess,
|
||||
aciIdentityKeyPair = aciIdentityKeyPair,
|
||||
pniIdentityKeyPair = pniIdentityKeyPair
|
||||
)
|
||||
|
||||
+5
-3
@@ -214,7 +214,8 @@ class RegistrationRepository(val context: Context, val networkController: Networ
|
||||
skipDeviceTransfer = skipDeviceTransfer,
|
||||
existingAccountEntropyPool = existingAccountEntropyPool ?: preExistingRegistrationData?.aep,
|
||||
existingAciIdentityKeyPair = preExistingRegistrationData?.aciIdentityKeyPair,
|
||||
existingPniIdentityKeyPair = preExistingRegistrationData?.pniIdentityKeyPair
|
||||
existingPniIdentityKeyPair = preExistingRegistrationData?.pniIdentityKeyPair,
|
||||
unrestrictedUnidentifiedAccess = preExistingRegistrationData?.unrestrictedUnidentifiedAccess ?: false
|
||||
)
|
||||
}
|
||||
|
||||
@@ -330,7 +331,8 @@ class RegistrationRepository(val context: Context, val networkController: Networ
|
||||
skipDeviceTransfer: Boolean = true,
|
||||
existingAccountEntropyPool: AccountEntropyPool? = null,
|
||||
existingAciIdentityKeyPair: IdentityKeyPair? = null,
|
||||
existingPniIdentityKeyPair: IdentityKeyPair? = null
|
||||
existingPniIdentityKeyPair: IdentityKeyPair? = null,
|
||||
unrestrictedUnidentifiedAccess: Boolean = false
|
||||
): RequestResult<Pair<RegisterAccountResponse, KeyMaterial>, RegisterAccountError> = withContext(Dispatchers.IO) {
|
||||
check(sessionId != null || recoveryPassword != null) { "Either sessionId or recoveryPassword must be provided" }
|
||||
check(sessionId == null || recoveryPassword == null) { "Either sessionId or recoveryPassword must be provided, but not both" }
|
||||
@@ -377,7 +379,7 @@ class RegistrationRepository(val context: Context, val networkController: Networ
|
||||
fetchesMessages = fcmToken == null,
|
||||
registrationLock = registrationLock,
|
||||
unidentifiedAccessKey = keyMaterial.unidentifiedAccessKey,
|
||||
unrestrictedUnidentifiedAccess = false,
|
||||
unrestrictedUnidentifiedAccess = unrestrictedUnidentifiedAccess,
|
||||
discoverableByPhoneNumber = false, // Important -- this should be false initially, and then the user should be given a choice as to whether to turn it on later
|
||||
capabilities = AccountAttributes.Capabilities(
|
||||
storage = true, // True initially -- can turn off later if users opt-out
|
||||
|
||||
@@ -226,6 +226,7 @@ data class PreExistingRegistrationData(
|
||||
val servicePassword: String,
|
||||
val aep: AccountEntropyPool,
|
||||
val registrationLockEnabled: Boolean,
|
||||
val unrestrictedUnidentifiedAccess: Boolean,
|
||||
val aciIdentityKeyPair: IdentityKeyPair,
|
||||
val pniIdentityKeyPair: IdentityKeyPair
|
||||
) : Parcelable
|
||||
|
||||
Reference in New Issue
Block a user