+ disposable.add(account.getIdentityKeyStore().getIdentityChanges().subscribe(recipientId -> {
+ logger.trace("Archiving old sessions");
+ account.getSessionStore().archiveSessions(recipientId);
+ account.getSenderKeyStore().deleteSharedWith(recipientId);
+ final var profile = account.getRecipientStore().getProfile(recipientId);
+ if (profile != null) {
+ account.getRecipientStore()
+ .storeProfile(recipientId,
+ Profile.newBuilder(profile)
+ .withUnidentifiedAccessMode(Profile.UnidentifiedAccessMode.UNKNOWN)
+ .withLastUpdateTimestamp(0)
+ .build());
+ }
+ }));