use of org.thoughtcrime.securesms.jobs.RotateProfileKeyJob in project mollyim-android by mollyim.
the class RecipientUtil method block.
/**
* You can call this for any type of recipient but must handle network errors that can occur from
* GV2.
* <p>
* GV2 operations can also take longer due to the network.
*/
@WorkerThread
public static void block(@NonNull Context context, @NonNull Recipient recipient) throws GroupChangeBusyException, IOException, GroupChangeFailedException {
if (!isBlockable(recipient)) {
throw new AssertionError("Recipient is not blockable!");
}
recipient = recipient.resolve();
if (recipient.isGroup() && recipient.getGroupId().get().isPush() && recipient.isActiveGroup()) {
GroupManager.leaveGroupFromBlockOrMessageRequest(context, recipient.getGroupId().get().requirePush());
}
SignalDatabase.recipients().setBlocked(recipient.getId(), true);
if (recipient.isSystemContact() || recipient.isProfileSharing() || isProfileSharedViaGroup(recipient)) {
ApplicationDependencies.getJobManager().add(new RotateProfileKeyJob());
SignalDatabase.recipients().setProfileSharing(recipient.getId(), false);
}
ApplicationDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
StorageSyncHelper.scheduleSyncForDataChange();
}
use of org.thoughtcrime.securesms.jobs.RotateProfileKeyJob in project mollyim-android by mollyim.
the class RecipientUtil method delete.
@WorkerThread
public static void delete(@NonNull Context context, @NonNull Recipient recipient) {
Recipient resolved = recipient.resolve();
ThreadDatabase threadDatabase = SignalDatabase.threads();
long existingThread = threadDatabase.getThreadIdIfExistsFor(resolved.getId());
if (existingThread > -1) {
threadDatabase.deleteConversation(existingThread);
ApplicationDependencies.getMessageNotifier().updateNotification(context);
}
if (recipient.isSystemContact() && recipient.getContactUri() != null) {
SignalDatabase.contacts().lookupAndDeleteContact(recipient.getContactUri());
}
SignalDatabase.recipients().clearFieldsForDeletion(resolved.getId());
NotificationChannels.deleteChannelFor(context, resolved);
if (!resolved.isBlocked()) {
ApplicationDependencies.getJobManager().add(new RotateProfileKeyJob());
}
if (TextSecurePreferences.isMultiDevice(context)) {
ApplicationDependencies.getJobManager().add(MultiDeviceMessageRequestResponseJob.forDelete(recipient.getId()));
}
}
use of org.thoughtcrime.securesms.jobs.RotateProfileKeyJob in project Signal-Android by WhisperSystems.
the class RecipientUtil method block.
/**
* You can call this for any type of recipient but must handle network errors that can occur from
* GV2.
* <p>
* GV2 operations can also take longer due to the network.
*/
@WorkerThread
public static void block(@NonNull Context context, @NonNull Recipient recipient) throws GroupChangeBusyException, IOException, GroupChangeFailedException {
if (!isBlockable(recipient)) {
throw new AssertionError("Recipient is not blockable!");
}
recipient = recipient.resolve();
if (recipient.isGroup() && recipient.getGroupId().get().isPush() && recipient.isActiveGroup()) {
GroupManager.leaveGroupFromBlockOrMessageRequest(context, recipient.getGroupId().get().requirePush());
}
SignalDatabase.recipients().setBlocked(recipient.getId(), true);
if (recipient.isSystemContact() || recipient.isProfileSharing() || isProfileSharedViaGroup(context, recipient)) {
ApplicationDependencies.getJobManager().add(new RotateProfileKeyJob());
SignalDatabase.recipients().setProfileSharing(recipient.getId(), false);
}
ApplicationDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
StorageSyncHelper.scheduleSyncForDataChange();
}
use of org.thoughtcrime.securesms.jobs.RotateProfileKeyJob in project Signal-Android by signalapp.
the class RecipientUtil method block.
/**
* You can call this for any type of recipient but must handle network errors that can occur from
* GV2.
* <p>
* GV2 operations can also take longer due to the network.
*/
@WorkerThread
public static void block(@NonNull Context context, @NonNull Recipient recipient) throws GroupChangeBusyException, IOException, GroupChangeFailedException {
if (!isBlockable(recipient)) {
throw new AssertionError("Recipient is not blockable!");
}
recipient = recipient.resolve();
if (recipient.isGroup() && recipient.getGroupId().get().isPush() && recipient.isActiveGroup()) {
GroupManager.leaveGroupFromBlockOrMessageRequest(context, recipient.getGroupId().get().requirePush());
}
SignalDatabase.recipients().setBlocked(recipient.getId(), true);
if (recipient.isSystemContact() || recipient.isProfileSharing() || isProfileSharedViaGroup(context, recipient)) {
ApplicationDependencies.getJobManager().add(new RotateProfileKeyJob());
SignalDatabase.recipients().setProfileSharing(recipient.getId(), false);
}
ApplicationDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
StorageSyncHelper.scheduleSyncForDataChange();
}
Aggregations