diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt b/app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt
index 82b9f16dcd..ed7abc7fcd 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt
@@ -8,6 +8,7 @@ import android.view.ViewGroup
import androidx.core.view.isVisible
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import dagger.hilt.android.AndroidEntryPoint
+import network.loki.messenger.R
import network.loki.messenger.databinding.FragmentConversationBottomSheetBinding
import org.thoughtcrime.securesms.database.model.ThreadRecord
import org.thoughtcrime.securesms.dependencies.ConfigFactory
@@ -82,7 +83,33 @@ class ConversationOptionsBottomSheet(private val parentContext: Context) : Botto
binding.muteNotificationsTextView.setOnClickListener(this)
binding.notificationsTextView.isVisible = recipient.isGroupRecipient && !recipient.isMuted
binding.notificationsTextView.setOnClickListener(this)
- binding.deleteTextView.setOnClickListener(this)
+
+ // delete
+ binding.deleteTextView.apply {
+ setOnClickListener(this@ConversationOptionsBottomSheet)
+
+ // the text and content description will change depending on the type
+ when{
+ // groups and communities
+ recipient.isGroupRecipient -> {
+ text = context.getString(R.string.leave)
+ contentDescription = context.getString(R.string.AccessibilityId_leave)
+ }
+
+ // note to self
+ recipient.isLocalNumber -> {
+ text = context.getString(R.string.clear)
+ contentDescription = context.getString(R.string.AccessibilityId_clear)
+ }
+
+ // 1on1
+ else -> {
+ text = context.getString(R.string.delete)
+ contentDescription = context.getString(R.string.AccessibilityId_delete)
+ }
+ }
+ }
+
binding.markAllAsReadTextView.isVisible = thread.unreadCount > 0 || configFactory.convoVolatile?.getConversationUnread(thread) == true
binding.markAllAsReadTextView.setOnClickListener(this)
binding.pinTextView.isVisible = !thread.isPinned
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 5af7e7be52..69442b512e 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt
@@ -583,16 +583,20 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
val recipient = thread.recipient
val title: String
val message: CharSequence
+ var positiveButtonId: Int = R.string.yes
+ var negativeButtonId: Int = R.string.no
if (recipient.isGroupRecipient) {
val group = groupDatabase.getGroup(recipient.address.toString()).orNull()
// If you are an admin of this group you can delete it
if (group != null && group.admins.map { it.toString() }.contains(textSecurePreferences.getLocalNumber())) {
- title = getString(R.string.groupDelete)
+ title = getString(R.string.groupLeave)
message = Phrase.from(this.applicationContext, R.string.groupDeleteDescription)
.put(GROUP_NAME_KEY, group.title)
.format()
+ positiveButtonId = R.string.leave
+ negativeButtonId = R.string.cancel
} else {
// Otherwise this is either a community, or it's a group you're not an admin of
title = if (recipient.isCommunityRecipient) getString(R.string.communityLeave) else getString(R.string.groupLeave)
@@ -610,15 +614,17 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
}
else {
// If not group-related and we don't have a recipient name then this must be our Note to Self conversation
- title = getString(R.string.noteToSelf)
+ title = getString(R.string.clearMessages)
message = getString(R.string.clearMessagesNoteToSelfDescription)
+ positiveButtonId = R.string.clear
+ negativeButtonId = R.string.cancel
}
}
showSessionDialog {
title(title)
text(message)
- button(R.string.yes) {
+ dangerButton(positiveButtonId) {
lifecycleScope.launch(Dispatchers.Main) {
val context = this@HomeActivity
// Cancel any outstanding jobs
@@ -650,7 +656,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
Toast.makeText(context, toastMessage, Toast.LENGTH_LONG).show()
}
}
- button(R.string.no)
+ button(negativeButtonId)
}
}
diff --git a/content-descriptions/src/main/res/values/strings.xml b/content-descriptions/src/main/res/values/strings.xml
index 541e62e29b..4dae1db1c5 100644
--- a/content-descriptions/src/main/res/values/strings.xml
+++ b/content-descriptions/src/main/res/values/strings.xml
@@ -66,6 +66,8 @@
Confirm block
Confirm unblock
Delete
+ Leave
+ Clear
Disappearing messages
Enable
Mute notifications
@@ -73,7 +75,7 @@
Search
Accept name change
- Add members
+ Invite Contacts
Apply changes
Cancel name change
Contact mentions
diff --git a/libsession/src/main/java/org/session/libsession/messaging/utilities/UpdateMessageBuilder.kt b/libsession/src/main/java/org/session/libsession/messaging/utilities/UpdateMessageBuilder.kt
index 51a07ca65d..dc85b58e77 100644
--- a/libsession/src/main/java/org/session/libsession/messaging/utilities/UpdateMessageBuilder.kt
+++ b/libsession/src/main/java/org/session/libsession/messaging/utilities/UpdateMessageBuilder.kt
@@ -196,11 +196,19 @@ object UpdateMessageBuilder {
if (duration <= 0) {
// ..by you..
return if (isOutgoing) {
- context.getText(R.string.disappearingMessagesTurnedOffYou)
+ // in a group
+ if(isGroup) context.getText(R.string.disappearingMessagesTurnedOffYouGroup)
+ // 1on1
+ else context.getText(R.string.disappearingMessagesTurnedOffYou)
}
else // ..or by someone else.
{
- Phrase.from(context, R.string.disappearingMessagesTurnedOff)
+ Phrase.from(context,
+ // in a group
+ if(isGroup) R.string.disappearingMessagesTurnedOffGroup
+ // 1on1
+ else R.string.disappearingMessagesTurnedOff
+ )
.put(NAME_KEY, senderName)
.format()
}