kopia lustrzana https://github.com/ryukoposting/Signal-Android
Address issues with PNI app migration.
rodzic
a207bf965a
commit
4f1aa34a46
|
@ -162,6 +162,10 @@ internal class AccountValues internal constructor(store: KeyValueStore) : Signal
|
|||
.commit()
|
||||
}
|
||||
|
||||
fun hasPniIdentityKey(): Boolean {
|
||||
return store.containsKey(KEY_PNI_IDENTITY_PUBLIC_KEY)
|
||||
}
|
||||
|
||||
/** Generates and saves an identity key pair for the PNI identity. Should only be done once. */
|
||||
fun generatePniIdentityKey() {
|
||||
Log.i(TAG, "Generating a new PNI identity key pair.")
|
||||
|
|
|
@ -98,9 +98,10 @@ public class ApplicationMigrations {
|
|||
static final int CHANGE_NUMBER_CAPABILITY_4 = 54;
|
||||
static final int KBS_MIGRATION = 55;
|
||||
static final int PNI_IDENTITY = 56;
|
||||
static final int PNI_IDENTITY_2 = 57;
|
||||
}
|
||||
|
||||
public static final int CURRENT_VERSION = 56;
|
||||
public static final int CURRENT_VERSION = 57;
|
||||
|
||||
/**
|
||||
* This *must* be called after the {@link JobManager} has been instantiated, but *before* the call
|
||||
|
@ -426,6 +427,10 @@ public class ApplicationMigrations {
|
|||
jobs.put(Version.PNI_IDENTITY, new PniAccountInitializationMigrationJob());
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.PNI_IDENTITY_2) {
|
||||
jobs.put(Version.PNI_IDENTITY_2, new PniAccountInitializationMigrationJob());
|
||||
}
|
||||
|
||||
return jobs;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,11 @@ public class PniAccountInitializationMigrationJob extends MigrationJob {
|
|||
return;
|
||||
}
|
||||
|
||||
if (SignalStore.account().hasPniIdentityKey()) {
|
||||
Log.w(TAG, "Already generated the PNI identity. Skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
SignalStore.account().generatePniIdentityKey();
|
||||
|
||||
SignalServiceAccountManager accountManager = ApplicationDependencies.getSignalServiceAccountManager();
|
||||
|
|
Ładowanie…
Reference in New Issue