mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Rotate profile key when learning of a block by a linked device.
This commit is contained in:
committed by
Jeffrey Starke
parent
cd26929d39
commit
9ccdbb8e40
@@ -176,18 +176,30 @@ public class RecipientUtil {
|
||||
SignalDatabase.recipients().setBlocked(recipient.getId(), true);
|
||||
insertBlockedUpdate(recipient, SignalDatabase.threads().getOrCreateThreadIdFor(recipient));
|
||||
|
||||
if (recipient.isSystemContact() || recipient.isProfileSharing() || isProfileSharedViaGroup(recipient)) {
|
||||
SignalDatabase.recipients().setProfileSharing(recipient.getId(), false);
|
||||
|
||||
AppDependencies.getJobManager().startChain(new RefreshOwnProfileJob())
|
||||
.then(new RotateProfileKeyJob())
|
||||
.enqueue();
|
||||
}
|
||||
RecipientUtil.updateProfileSharingAfterBlock(recipient, true);
|
||||
|
||||
AppDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
|
||||
StorageSyncHelper.scheduleSyncForDataChange();
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
public static boolean updateProfileSharingAfterBlock(@NonNull Recipient recipient, boolean rotateProfileKeyOnBlock) {
|
||||
if (recipient.isSystemContact() || recipient.isProfileSharing() || isProfileSharedViaGroup(recipient)) {
|
||||
SignalDatabase.recipients().setProfileSharing(recipient.getId(), false);
|
||||
|
||||
if (rotateProfileKeyOnBlock) {
|
||||
Log.i(TAG, "Rotating profile key");
|
||||
AppDependencies.getJobManager().startChain(new RefreshOwnProfileJob())
|
||||
.then(new RotateProfileKeyJob())
|
||||
.enqueue();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
public static void unblock(@NonNull Recipient recipient) {
|
||||
if (!isBlockable(recipient)) {
|
||||
|
||||
Reference in New Issue
Block a user