mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Prevent startup crash on first launch.
This commit is contained in:
committed by
mtang-signal
parent
9a24455085
commit
1e58f8097a
@@ -30,7 +30,7 @@ import org.whispersystems.signalservice.api.util.UuidUtil
|
||||
import org.whispersystems.signalservice.api.util.toByteArray
|
||||
import java.security.SecureRandom
|
||||
|
||||
class AccountValues internal constructor(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
class AccountValues internal constructor(store: KeyValueStore, context: Context) : SignalStoreValues(store) {
|
||||
|
||||
companion object {
|
||||
private val TAG = Log.tag(AccountValues::class.java)
|
||||
@@ -80,11 +80,11 @@ class AccountValues internal constructor(store: KeyValueStore) : SignalStoreValu
|
||||
|
||||
init {
|
||||
if (!store.containsKey(KEY_ACI)) {
|
||||
migrateFromSharedPrefsV1(AppDependencies.application)
|
||||
migrateFromSharedPrefsV1(context)
|
||||
}
|
||||
|
||||
if (!store.containsKey(KEY_ACI_IDENTITY_PUBLIC_KEY)) {
|
||||
migrateFromSharedPrefsV2(AppDependencies.application)
|
||||
migrateFromSharedPrefsV2(context)
|
||||
}
|
||||
|
||||
store.getString(KEY_PNI, null)?.let { pni ->
|
||||
|
||||
@@ -78,11 +78,11 @@ public final class SettingsValues extends SignalStoreValues {
|
||||
|
||||
private final SingleLiveEvent<String> onConfigurationSettingChanged = new SingleLiveEvent<>();
|
||||
|
||||
SettingsValues(@NonNull KeyValueStore store) {
|
||||
SettingsValues(@NonNull KeyValueStore store, Context context) {
|
||||
super(store);
|
||||
|
||||
if (!store.containsKey(SCREEN_LOCK_ENABLED)) {
|
||||
migrateFromSharedPrefsV1(AppDependencies.getApplication());
|
||||
migrateFromSharedPrefsV1(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.thoughtcrime.securesms.database.KeyValueDatabase
|
||||
*/
|
||||
class SignalStore(context: Application, private val store: KeyValueStore) {
|
||||
|
||||
val accountValues = AccountValues(store)
|
||||
val accountValues = AccountValues(store, context)
|
||||
val svrValues = SvrValues(store)
|
||||
val registrationValues = RegistrationValues(store)
|
||||
val pinValues = PinValues(store)
|
||||
@@ -21,7 +21,7 @@ class SignalStore(context: Application, private val store: KeyValueStore) {
|
||||
val miscValues = MiscellaneousValues(store)
|
||||
val internalValues = InternalValues(store)
|
||||
val emojiValues = EmojiValues(store)
|
||||
val settingsValues = SettingsValues(store)
|
||||
val settingsValues = SettingsValues(store, context)
|
||||
val certificateValues = CertificateValues(store)
|
||||
val phoneNumberPrivacyValues = PhoneNumberPrivacyValues(store)
|
||||
val onboardingValues = OnboardingValues(store)
|
||||
|
||||
Reference in New Issue
Block a user