mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 10:35:19 +00:00
SS-64 Removed all 'Unblocked {name}' toasts as per instructions
This commit is contained in:
parent
c3c35de408
commit
b0b835092d
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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<String>, 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<String>()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user