From b0b835092dffab3a112f61f203dd9138a9a1c9b1 Mon Sep 17 00:00:00 2001 From: alansley Date: Thu, 22 Aug 2024 14:07:49 +1000 Subject: [PATCH] SS-64 Removed all 'Unblocked {name}' toasts as per instructions --- .../conversation/v2/ConversationActivityV2.kt | 20 +++--------- .../securesms/home/HomeActivity.kt | 3 -- .../preferences/BlockedContactsActivity.kt | 32 +------------------ 3 files changed, 5 insertions(+), 50 deletions(-) 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 bd2f668565..8e704f9883 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 @@ -772,12 +772,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe val recipient = viewModel.recipient?.takeUnless { it.isGroupRecipient } ?: return binding.blockedBannerTextView.text = applicationContext.getString(R.string.blockBlockedDescription) binding.blockedBanner.isVisible = recipient.isBlocked - binding.blockedBanner.setOnClickListener { - viewModel.unblock() - // Unblock confirmation toast added as per SS-64 - val txt = Phrase.from(applicationContext, R.string.blockUnblockedUser).put(NAME_KEY, recipient.name).format().toString() - Toast.makeText(applicationContext, txt, Toast.LENGTH_LONG).show() - } + binding.blockedBanner.setOnClickListener { viewModel.unblock() } } private fun setUpOutdatedClientBanner() { @@ -1242,13 +1237,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe .put(NAME_KEY, recipient.name) .format() ) - dangerButton(R.string.blockUnblock, R.string.AccessibilityId_unblockConfirm) { - viewModel.unblock() - - // Unblock confirmation toast added as per SS-64 - val txt = Phrase.from(context, R.string.blockUnblockedUser).put(NAME_KEY, recipient.name).format().toString() - Toast.makeText(context, txt, Toast.LENGTH_LONG).show() - } + dangerButton(R.string.blockUnblock, R.string.AccessibilityId_unblockConfirm) { viewModel.unblock() } cancelButton() } } @@ -1259,10 +1248,9 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe if (actionMode != null) { onDeselect(message, position, actionMode) } else { - // NOTE: - // We have to use onContentClick (rather than a click listener directly on + // NOTE: We have to use onContentClick (rather than a click listener directly on // the view) so as to not interfere with all the other gestures. Do not add - // onClickListeners directly to message content views. + // onClickListeners directly to message content views! view.onContentClick(event) } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt index 1c550eb5eb..6e9a265adc 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt @@ -644,9 +644,6 @@ class HomeActivity : PassphraseRequiredActionBarActivity(), binding.recyclerView.adapter!!.notifyDataSetChanged() } } - // Unblock confirmation toast added as per SS-64 - val txt = Phrase.from(context, R.string.blockUnblockedUser).put(NAME_KEY, thread.recipient.name).format().toString() - Toast.makeText(context, txt, Toast.LENGTH_LONG).show() } cancelButton() } diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/BlockedContactsActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/BlockedContactsActivity.kt index f2b394fdae..e7a2552e8d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/BlockedContactsActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/BlockedContactsActivity.kt @@ -26,26 +26,6 @@ class BlockedContactsActivity: PassphraseRequiredActionBarActivity() { val adapter: BlockedContactsAdapter by lazy { BlockedContactsAdapter(viewModel) } - // Method to show a sequence of toasts one after the other - private fun showToastSequence(toastStrings: List, toastLengthSetting: Int,context: Context) { - val handler = Handler(Looper.getMainLooper()) - - val delayStepMilliseconds = when (toastLengthSetting) { - Toast.LENGTH_SHORT -> 2000L - Toast.LENGTH_LONG -> 3500L - else -> { - Log.w("BlockContactsActivity", "Invalid toast length setting - using Toast.LENGTH_SHORT") - 2000L - } - } - - var delayMilliseconds = 0L - toastStrings.forEach { message -> - handler.postDelayed( { Toast.makeText(context, message, Toast.LENGTH_SHORT).show() }, delayMilliseconds) - delayMilliseconds += delayStepMilliseconds // Increment delay by the duration of a Toast message - } - } - private fun unblock() { showSessionDialog { title(viewModel.getTitle(this@BlockedContactsActivity)) @@ -70,17 +50,7 @@ class BlockedContactsActivity: PassphraseRequiredActionBarActivity() { } text(txt) - dangerButton(R.string.blockUnblock, R.string.AccessibilityId_unblockConfirm) { - // Show individual toasts for each unblocked user (we don't have suitable strings to do it as a single toast) - val contactsToUnblockNames = contactsToUnblock.map { it.name } - val toastStrings = mutableListOf() - for (name in contactsToUnblockNames) { - toastStrings.add(Phrase.from(context, R.string.blockUnblockedUser).put(NAME_KEY, name).format().toString()) - } - showToastSequence(toastStrings, Toast.LENGTH_SHORT, this@BlockedContactsActivity) - - viewModel.unblock() - } + dangerButton(R.string.blockUnblock, R.string.AccessibilityId_unblockConfirm) { viewModel.unblock() } cancelButton() } }