mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-21 15:05: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
|
val recipient = viewModel.recipient?.takeUnless { it.isGroupRecipient } ?: return
|
||||||
binding.blockedBannerTextView.text = applicationContext.getString(R.string.blockBlockedDescription)
|
binding.blockedBannerTextView.text = applicationContext.getString(R.string.blockBlockedDescription)
|
||||||
binding.blockedBanner.isVisible = recipient.isBlocked
|
binding.blockedBanner.isVisible = recipient.isBlocked
|
||||||
binding.blockedBanner.setOnClickListener {
|
binding.blockedBanner.setOnClickListener { viewModel.unblock() }
|
||||||
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()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpOutdatedClientBanner() {
|
private fun setUpOutdatedClientBanner() {
|
||||||
@ -1242,13 +1237,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
.put(NAME_KEY, recipient.name)
|
.put(NAME_KEY, recipient.name)
|
||||||
.format()
|
.format()
|
||||||
)
|
)
|
||||||
dangerButton(R.string.blockUnblock, R.string.AccessibilityId_unblockConfirm) {
|
dangerButton(R.string.blockUnblock, R.string.AccessibilityId_unblockConfirm) { viewModel.unblock() }
|
||||||
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()
|
|
||||||
}
|
|
||||||
cancelButton()
|
cancelButton()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1259,10 +1248,9 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
if (actionMode != null) {
|
if (actionMode != null) {
|
||||||
onDeselect(message, position, actionMode)
|
onDeselect(message, position, actionMode)
|
||||||
} else {
|
} else {
|
||||||
// NOTE:
|
// NOTE: We have to use onContentClick (rather than a click listener directly on
|
||||||
// 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
|
// 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)
|
view.onContentClick(event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -644,9 +644,6 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
binding.recyclerView.adapter!!.notifyDataSetChanged()
|
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()
|
cancelButton()
|
||||||
}
|
}
|
||||||
|
@ -26,26 +26,6 @@ class BlockedContactsActivity: PassphraseRequiredActionBarActivity() {
|
|||||||
|
|
||||||
val adapter: BlockedContactsAdapter by lazy { BlockedContactsAdapter(viewModel) }
|
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() {
|
private fun unblock() {
|
||||||
showSessionDialog {
|
showSessionDialog {
|
||||||
title(viewModel.getTitle(this@BlockedContactsActivity))
|
title(viewModel.getTitle(this@BlockedContactsActivity))
|
||||||
@ -70,17 +50,7 @@ class BlockedContactsActivity: PassphraseRequiredActionBarActivity() {
|
|||||||
}
|
}
|
||||||
text(txt)
|
text(txt)
|
||||||
|
|
||||||
dangerButton(R.string.blockUnblock, R.string.AccessibilityId_unblockConfirm) {
|
dangerButton(R.string.blockUnblock, R.string.AccessibilityId_unblockConfirm) { viewModel.unblock() }
|
||||||
// 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()
|
|
||||||
}
|
|
||||||
cancelButton()
|
cancelButton()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user