use of org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob in project Signal-Android by signalapp.
the class ConversationActivity method handleUnblock.
private void handleUnblock() {
// noinspection CodeBlock2Expr
new AlertDialog.Builder(this).setTitle(R.string.ConversationActivity_unblock_this_contact_question).setMessage(R.string.ConversationActivity_you_will_once_again_be_able_to_receive_messages_and_calls_from_this_contact).setNegativeButton(android.R.string.cancel, null).setPositiveButton(R.string.ConversationActivity_unblock, (dialog, which) -> {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
DatabaseFactory.getRecipientDatabase(ConversationActivity.this).setBlocked(recipient, false);
ApplicationContext.getInstance(ConversationActivity.this).getJobManager().add(new MultiDeviceBlockedUpdateJob(ConversationActivity.this));
return null;
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}).show();
}
use of org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob in project Signal-Android by WhisperSystems.
the class MessageContentProcessor method handleSynchronizeRequestMessage.
private void handleSynchronizeRequestMessage(@NonNull RequestMessage message, long envelopeTimestamp) {
if (SignalStore.account().isPrimaryDevice()) {
log(envelopeTimestamp, "Synchronize request message.");
} else {
log(envelopeTimestamp, "Linked device ignoring synchronize request message.");
return;
}
if (message.isContactsRequest()) {
ApplicationDependencies.getJobManager().add(new MultiDeviceContactUpdateJob(true));
}
if (message.isGroupsRequest()) {
ApplicationDependencies.getJobManager().add(new MultiDeviceGroupUpdateJob());
}
if (message.isBlockedListRequest()) {
ApplicationDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
}
if (message.isConfigurationRequest()) {
ApplicationDependencies.getJobManager().add(new MultiDeviceConfigurationUpdateJob(TextSecurePreferences.isReadReceiptsEnabled(context), TextSecurePreferences.isTypingIndicatorsEnabled(context), TextSecurePreferences.isShowUnidentifiedDeliveryIndicatorsEnabled(context), SignalStore.settings().isLinkPreviewsEnabled()));
ApplicationDependencies.getJobManager().add(new MultiDeviceStickerPackSyncJob());
}
if (message.isKeysRequest()) {
ApplicationDependencies.getJobManager().add(new MultiDeviceKeysUpdateJob());
}
if (message.isPniIdentityRequest()) {
ApplicationDependencies.getJobManager().add(new MultiDevicePniIdentityUpdateJob());
}
}
use of org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob in project Signal-Android by WhisperSystems.
the class RecipientUtil method unblock.
@WorkerThread
public static void unblock(@NonNull Context context, @NonNull Recipient recipient) {
if (!isBlockable(recipient)) {
throw new AssertionError("Recipient is not blockable!");
}
SignalDatabase.recipients().setBlocked(recipient.getId(), false);
SignalDatabase.recipients().setProfileSharing(recipient.getId(), true);
ApplicationDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
StorageSyncHelper.scheduleSyncForDataChange();
if (recipient.hasServiceId()) {
ApplicationDependencies.getJobManager().add(MultiDeviceMessageRequestResponseJob.forAccept(recipient.getId()));
}
}
use of org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob 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();
}
Aggregations