Show blocked dialog if needed

This commit is contained in:
Niels Andriesse 2021-06-28 13:36:15 +10:00
parent 12b008c61c
commit 8cb4c267c5
2 changed files with 7 additions and 1 deletions

View File

@ -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 {

View File

@ -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()
}
}