Skip to content

Commit

Permalink
Restore PNI when restoring UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny-signal committed Feb 9, 2023
1 parent da322b8 commit 88472f7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ts/background.ts
Expand Up @@ -3468,12 +3468,14 @@ export async function startApp(): Promise<void> {

const NUMBER_ID_KEY = 'number_id';
const UUID_ID_KEY = 'uuid_id';
const PNI_KEY = 'pni';
const VERSION_KEY = 'version';
const LAST_PROCESSED_INDEX_KEY = 'attachmentMigration_lastProcessedIndex';
const IS_MIGRATION_COMPLETE_KEY = 'attachmentMigration_isComplete';

const previousNumberId = window.textsecure.storage.get(NUMBER_ID_KEY);
const previousUuidId = window.textsecure.storage.get(UUID_ID_KEY);
const previousPni = window.textsecure.storage.get(PNI_KEY);
const lastProcessedIndex = window.textsecure.storage.get(
LAST_PROCESSED_INDEX_KEY
);
Expand All @@ -3492,14 +3494,17 @@ export async function startApp(): Promise<void> {
delete conversation.attributes.senderKeyInfo;
});

// These two bits of data are important to ensure that the app loads up
// These three bits of data are important to ensure that the app loads up
// the conversation list, instead of showing just the QR code screen.
if (previousNumberId !== undefined) {
await window.textsecure.storage.put(NUMBER_ID_KEY, previousNumberId);
}
if (previousUuidId !== undefined) {
await window.textsecure.storage.put(UUID_ID_KEY, previousUuidId);
}
if (previousPni !== undefined) {
await window.textsecure.storage.put(PNI_KEY, previousPni);
}

// These two are important to ensure we don't rip through every message
// in the database attempting to upgrade it after starting up again.
Expand Down

0 comments on commit 88472f7

Please sign in to comment.