Don't delete all data if e164 changes (focus on UUID if we have it)
This commit is contained in:
parent
a918b06841
commit
13371fbeb7
1 changed files with 10 additions and 7 deletions
|
@ -538,20 +538,23 @@ export default class AccountManager extends EventTarget {
|
|||
{ accessKey }
|
||||
);
|
||||
|
||||
const numberChanged = previousNumber && previousNumber !== number;
|
||||
const uuidChanged = previousUuid && uuid && previousUuid !== uuid;
|
||||
|
||||
if (numberChanged || uuidChanged) {
|
||||
if (numberChanged) {
|
||||
window.log.warn(
|
||||
'New number is different from old number; deleting all previous data'
|
||||
);
|
||||
}
|
||||
// We only consider the number changed if we didn't have a UUID before
|
||||
const numberChanged =
|
||||
!previousUuid && previousNumber && previousNumber !== number;
|
||||
|
||||
if (uuidChanged || numberChanged) {
|
||||
if (uuidChanged) {
|
||||
window.log.warn(
|
||||
'New uuid is different from old uuid; deleting all previous data'
|
||||
);
|
||||
}
|
||||
if (numberChanged) {
|
||||
window.log.warn(
|
||||
'New number is different from old number; deleting all previous data'
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
await window.textsecure.storage.protocol.removeAllData();
|
||||
|
|
Loading…
Reference in a new issue