open chat when navigating back from thread

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2025-06-20 14:47:59 +02:00
parent abf15ae2f2
commit c468ba4df6
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -393,9 +393,14 @@ class ChatActivity :
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
val intent = Intent(this@ChatActivity, ConversationsListActivity::class.java)
intent.putExtras(Bundle())
startActivity(intent)
if (isChatThread()) {
isEnabled = false
onBackPressedDispatcher.onBackPressed()
} else {
val intent = Intent(this@ChatActivity, ConversationsListActivity::class.java)
intent.putExtras(Bundle())
startActivity(intent)
}
}
}
@ -2603,7 +2608,7 @@ class ChatActivity :
viewThemeUtils.platform.colorTextView(title, ColorRole.ON_SURFACE)
title.text =
if (threadId != null && threadId!! > 0) {
if (isChatThread()) {
"Thread $threadId"
} else if (currentConversation?.displayName != null) {
try {
@ -4118,6 +4123,8 @@ class ChatActivity :
}
}
private fun isChatThread(): Boolean = threadId != null && threadId!! > 0
fun openThread(roomToken: String, threadId: Long) {
val bundle = Bundle()
bundle.putString(KEY_ROOM_TOKEN, roomToken)