Search in sources :

Example 1 with MultiDeviceBlockedUpdateJob

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Bundle(android.os.Bundle) GroupContext(org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupContext) UntrustedSendDialog(org.thoughtcrime.securesms.components.identity.UntrustedSendDialog) SendButton(org.thoughtcrime.securesms.components.SendButton) Uri(android.net.Uri) ColorDrawable(android.graphics.drawable.ColorDrawable) Dialogs(org.thoughtcrime.securesms.util.Dialogs) SecureRandom(java.security.SecureRandom) Manifest(android.Manifest) OutgoingTextMessage(org.thoughtcrime.securesms.sms.OutgoingTextMessage) TargetApi(android.annotation.TargetApi) Log(android.util.Log) ServiceUtil(org.thoughtcrime.securesms.util.ServiceUtil) DrawerState(org.thoughtcrime.securesms.components.camera.QuickAttachmentDrawer.DrawerState) IntentFilter(android.content.IntentFilter) AnimatingToggle(org.thoughtcrime.securesms.components.AnimatingToggle) ThreadDatabase(org.thoughtcrime.securesms.database.ThreadDatabase) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) GroupUtil(org.thoughtcrime.securesms.util.GroupUtil) MultiDeviceBlockedUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob) TextWatcher(android.text.TextWatcher) OutgoingMediaMessage(org.thoughtcrime.securesms.mms.OutgoingMediaMessage) MediaUtil(org.thoughtcrime.securesms.util.MediaUtil) Types(org.thoughtcrime.securesms.database.MmsSmsColumns.Types) Util(org.thoughtcrime.securesms.util.Util) AttachmentTypeSelector(org.thoughtcrime.securesms.components.AttachmentTypeSelector) IdentityDatabase(org.thoughtcrime.securesms.database.IdentityDatabase) GroupRecord(org.thoughtcrime.securesms.database.GroupDatabase.GroupRecord) WebRtcCallService(org.thoughtcrime.securesms.service.WebRtcCallService) NonNull(android.support.annotation.NonNull) RetrieveProfileJob(org.thoughtcrime.securesms.jobs.RetrieveProfileJob) Editable(android.text.Editable) AttachmentDrawerListener(org.thoughtcrime.securesms.components.camera.QuickAttachmentDrawer.AttachmentDrawerListener) RecipientFormattingException(org.thoughtcrime.securesms.recipients.RecipientFormattingException) AudioRecorder(org.thoughtcrime.securesms.audio.AudioRecorder) ReminderView(org.thoughtcrime.securesms.components.reminder.ReminderView) KeyCachingService(org.thoughtcrime.securesms.service.KeyCachingService) DynamicTheme(org.thoughtcrime.securesms.util.DynamicTheme) QuickAttachmentDrawer(org.thoughtcrime.securesms.components.camera.QuickAttachmentDrawer) MenuInflater(android.view.MenuInflater) OutgoingEndSessionMessage(org.thoughtcrime.securesms.sms.OutgoingEndSessionMessage) Toast(android.widget.Toast) Menu(android.view.Menu) InputAwareLayout(org.thoughtcrime.securesms.components.InputAwareLayout) UnverifiedBannerView(org.thoughtcrime.securesms.components.identity.UnverifiedBannerView) Type(org.thoughtcrime.securesms.TransportOption.Type) OutgoingEncryptedMessage(org.thoughtcrime.securesms.sms.OutgoingEncryptedMessage) IdentityUtil(org.thoughtcrime.securesms.util.IdentityUtil) ListenableFuture(org.thoughtcrime.securesms.util.concurrent.ListenableFuture) AudioSlidePlayer(org.thoughtcrime.securesms.audio.AudioSlidePlayer) Permissions(org.thoughtcrime.securesms.permissions.Permissions) TextUtils(android.text.TextUtils) IOException(java.io.IOException) InviteReminder(org.thoughtcrime.securesms.components.reminder.InviteReminder) IdentityRecordList(org.thoughtcrime.securesms.database.identity.IdentityRecordList) Optional(org.whispersystems.libsignal.util.guava.Optional) ExecutionException(java.util.concurrent.ExecutionException) AudioSlide(org.thoughtcrime.securesms.mms.AudioSlide) AlertDialog(android.support.v7.app.AlertDialog) ContactAccessor(org.thoughtcrime.securesms.contacts.ContactAccessor) Configuration(android.content.res.Configuration) Drafts(org.thoughtcrime.securesms.database.DraftDatabase.Drafts) Telephony(android.provider.Telephony) WindowCompat(android.support.v4.view.WindowCompat) ImageButton(android.widget.ImageButton) LinearLayout(android.widget.LinearLayout) UnverifiedSendDialog(org.thoughtcrime.securesms.components.identity.UnverifiedSendDialog) MessageNotifier(org.thoughtcrime.securesms.notifications.MessageNotifier) SlideDeck(org.thoughtcrime.securesms.mms.SlideDeck) MessageSender(org.thoughtcrime.securesms.sms.MessageSender) DatabaseFactory(org.thoughtcrime.securesms.database.DatabaseFactory) WindowManager(android.view.WindowManager) Address(org.thoughtcrime.securesms.database.Address) MarkedMessageInfo(org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo) ViewUtil(org.thoughtcrime.securesms.util.ViewUtil) Browser(android.provider.Browser) AttachmentManager(org.thoughtcrime.securesms.mms.AttachmentManager) LocationSlide(org.thoughtcrime.securesms.mms.LocationSlide) ContactsContract(android.provider.ContactsContract) OnFocusChangeListener(android.view.View.OnFocusChangeListener) SecurityEvent(org.thoughtcrime.securesms.crypto.SecurityEvent) RegisteredState(org.thoughtcrime.securesms.database.RecipientDatabase.RegisteredState) View(android.view.View) Button(android.widget.Button) Recipient(org.thoughtcrime.securesms.recipients.Recipient) ExpiredBuildReminder(org.thoughtcrime.securesms.components.reminder.ExpiredBuildReminder) AsyncTask(android.os.AsyncTask) MenuItemCompat(android.support.v4.view.MenuItemCompat) InputPanel(org.thoughtcrime.securesms.components.InputPanel) OutgoingSecureMediaMessage(org.thoughtcrime.securesms.mms.OutgoingSecureMediaMessage) InvalidMessageException(org.whispersystems.libsignal.InvalidMessageException) CharacterState(org.thoughtcrime.securesms.util.CharacterCalculator.CharacterState) DraftDatabase(org.thoughtcrime.securesms.database.DraftDatabase) PorterDuff(android.graphics.PorterDuff) ThreadMode(org.greenrobot.eventbus.ThreadMode) BroadcastReceiver(android.content.BroadcastReceiver) OutgoingExpirationUpdateMessage(org.thoughtcrime.securesms.mms.OutgoingExpirationUpdateMessage) ScribbleActivity(org.thoughtcrime.securesms.scribbles.ScribbleActivity) ByteString(com.google.protobuf.ByteString) MediaType(org.thoughtcrime.securesms.mms.AttachmentManager.MediaType) List(java.util.List) TextView(android.widget.TextView) Slide(org.thoughtcrime.securesms.mms.Slide) MarkReadReceiver(org.thoughtcrime.securesms.notifications.MarkReadReceiver) DirectoryHelper(org.thoughtcrime.securesms.util.DirectoryHelper) ActivityNotFoundException(android.content.ActivityNotFoundException) SignalPlace(org.thoughtcrime.securesms.components.location.SignalPlace) Draft(org.thoughtcrime.securesms.database.DraftDatabase.Draft) SESSION_LOCK(org.whispersystems.libsignal.SessionCipher.SESSION_LOCK) GlideRequests(org.thoughtcrime.securesms.mms.GlideRequests) Nullable(android.support.annotation.Nullable) EditorInfo(android.view.inputmethod.EditorInfo) GlideApp(org.thoughtcrime.securesms.mms.GlideApp) Context(android.content.Context) KeyEvent(android.view.KeyEvent) IdentityRecord(org.thoughtcrime.securesms.database.IdentityDatabase.IdentityRecord) DynamicLanguage(org.thoughtcrime.securesms.util.DynamicLanguage) Pair(android.util.Pair) EmojiDrawer(org.thoughtcrime.securesms.components.emoji.EmojiDrawer) Intent(android.content.Intent) MaterialColor(org.thoughtcrime.securesms.color.MaterialColor) ExpirationUtil(org.thoughtcrime.securesms.util.ExpirationUtil) OutgoingGroupMediaMessage(org.thoughtcrime.securesms.mms.OutgoingGroupMediaMessage) TypedArray(android.content.res.TypedArray) MenuItem(android.view.MenuItem) IdentityKeyParcelable(org.thoughtcrime.securesms.crypto.IdentityKeyParcelable) TextSecurePreferences(org.thoughtcrime.securesms.util.TextSecurePreferences) AssertedSuccessListener(org.thoughtcrime.securesms.util.concurrent.AssertedSuccessListener) OnKeyboardShownListener(org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout.OnKeyboardShownListener) SuppressLint(android.annotation.SuppressLint) PlacePicker(com.google.android.gms.location.places.ui.PlacePicker) EventBus(org.greenrobot.eventbus.EventBus) Build(android.os.Build) GroupShareProfileView(org.thoughtcrime.securesms.profiles.GroupShareProfileView) LinkedList(java.util.LinkedList) ActionBar(android.support.v7.app.ActionBar) SettableFuture(org.thoughtcrime.securesms.util.concurrent.SettableFuture) HidingLinearLayout(org.thoughtcrime.securesms.components.HidingLinearLayout) VerifiedStatus(org.thoughtcrime.securesms.database.IdentityDatabase.VerifiedStatus) Stub(org.thoughtcrime.securesms.util.views.Stub) Color(android.graphics.Color) OnKeyListener(android.view.View.OnKeyListener) ComposeText(org.thoughtcrime.securesms.components.ComposeText) PersistentBlobProvider(org.thoughtcrime.securesms.providers.PersistentBlobProvider) Subscribe(org.greenrobot.eventbus.Subscribe) RecipientModifiedListener(org.thoughtcrime.securesms.recipients.RecipientModifiedListener) ReminderUpdateEvent(org.thoughtcrime.securesms.events.ReminderUpdateEvent) MediaConstraints(org.thoughtcrime.securesms.mms.MediaConstraints) Mode(android.graphics.PorterDuff.Mode) Vibrator(android.os.Vibrator) ContactData(org.thoughtcrime.securesms.contacts.ContactAccessor.ContactData) OnClickListener(android.view.View.OnClickListener) UnauthorizedReminder(org.thoughtcrime.securesms.components.reminder.UnauthorizedReminder) AsyncTask(android.os.AsyncTask) MultiDeviceBlockedUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob)

Example 2 with MultiDeviceBlockedUpdateJob

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());
    }
}
Also used : MultiDeviceContactUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceContactUpdateJob) MultiDeviceGroupUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceGroupUpdateJob) MultiDeviceConfigurationUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceConfigurationUpdateJob) MultiDeviceKeysUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceKeysUpdateJob) MultiDevicePniIdentityUpdateJob(org.thoughtcrime.securesms.jobs.MultiDevicePniIdentityUpdateJob) MultiDeviceBlockedUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob) MultiDeviceStickerPackSyncJob(org.thoughtcrime.securesms.jobs.MultiDeviceStickerPackSyncJob)

Example 3 with MultiDeviceBlockedUpdateJob

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()));
    }
}
Also used : MultiDeviceBlockedUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob) WorkerThread(androidx.annotation.WorkerThread)

Example 4 with MultiDeviceBlockedUpdateJob

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();
}
Also used : RotateProfileKeyJob(org.thoughtcrime.securesms.jobs.RotateProfileKeyJob) MultiDeviceBlockedUpdateJob(org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob) WorkerThread(androidx.annotation.WorkerThread)

Aggregations

MultiDeviceBlockedUpdateJob (org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob)4 Manifest (android.Manifest)1 SuppressLint (android.annotation.SuppressLint)1 TargetApi (android.annotation.TargetApi)1 ActivityNotFoundException (android.content.ActivityNotFoundException)1 BroadcastReceiver (android.content.BroadcastReceiver)1 Context (android.content.Context)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 Configuration (android.content.res.Configuration)1 TypedArray (android.content.res.TypedArray)1 Color (android.graphics.Color)1 PorterDuff (android.graphics.PorterDuff)1 Mode (android.graphics.PorterDuff.Mode)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 Uri (android.net.Uri)1 AsyncTask (android.os.AsyncTask)1 Build (android.os.Build)1 Bundle (android.os.Bundle)1 Vibrator (android.os.Vibrator)1