From 8cb4c267c5c8119cfc867eb0a6b3300578e09feb Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Mon, 28 Jun 2021 13:36:15 +1000 Subject: [PATCH] Show blocked dialog if needed --- .../securesms/conversation/v2/ConversationActivityV2.kt | 4 ++++ .../securesms/conversation/v2/dialogs/BlockedDialog.kt | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index e53ab9727e..3a5f36d555 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -672,6 +672,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe } override fun sendMessage() { + if (thread.isContactRecipient && thread.isBlocked) { + BlockedDialog(thread).show(supportFragmentManager, "Blocked Dialog") + return + } if (inputBar.linkPreview != null || inputBar.quote != null) { sendAttachments(listOf(), getMessageBody(), inputBar.quote, inputBar.linkPreview) } else { diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/dialogs/BlockedDialog.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/dialogs/BlockedDialog.kt index d42e39d1fa..3748add489 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/dialogs/BlockedDialog.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/dialogs/BlockedDialog.kt @@ -13,6 +13,7 @@ import org.session.libsession.messaging.contacts.Contact import org.session.libsession.utilities.recipients.Recipient import org.thoughtcrime.securesms.conversation.v2.utilities.BaseDialog import org.thoughtcrime.securesms.database.DatabaseFactory +import org.thoughtcrime.securesms.database.RecipientDatabase /** Shown upon sending a message to a user that's blocked. */ class BlockedDialog(private val recipient: Recipient) : BaseDialog() { @@ -36,6 +37,7 @@ class BlockedDialog(private val recipient: Recipient) : BaseDialog() { } private fun unblock() { - // TODO: Implement + DatabaseFactory.getRecipientDatabase(requireContext()).setBlocked(recipient, false) + dismiss() } } \ No newline at end of file