Clear cached self id on successful registration.

This commit is contained in:
Alex Hart 2020-01-15 09:25:49 -04:00 committed by Greyson Parrelli
parent 4b5b9fbde8
commit 92e97e61c1
2 changed files with 8 additions and 1 deletions

View file

@ -129,6 +129,11 @@ public final class LiveRecipientCache {
});
}
@AnyThread
public synchronized void clearSelf() {
localRecipientId = null;
}
@AnyThread
public synchronized void clear() {
recipients.clear();

View file

@ -186,12 +186,14 @@ public final class CodeVerificationRequest {
TextSecurePreferences.setLocalNumber(context, credentials.getE164number());
TextSecurePreferences.setLocalUuid(context, uuid);
ApplicationDependencies.getRecipientCache().clearSelf();
TextSecurePreferences.setFcmToken(context, fcmToken);
TextSecurePreferences.setFcmDisabled(context, !present);
TextSecurePreferences.setWebsocketRegistered(context, true);
DatabaseFactory.getIdentityDatabase(context)
.saveIdentity(Recipient.self().getId(),
.saveIdentity(selfId,
identityKey.getPublicKey(), IdentityDatabase.VerifiedStatus.VERIFIED,
true, System.currentTimeMillis(), true);