Prevent startup crash on first launch.

This commit is contained in:
Nicholas Tinsley
2024-08-20 14:52:29 -04:00
committed by mtang-signal
parent 9a24455085
commit 1e58f8097a
3 changed files with 7 additions and 7 deletions

View File

@@ -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 ->

View File

@@ -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);
}
}

View File

@@ -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)