remove scope cancelation for handleChatOnBackPress (replace with lifecyle event)

handleOnStop will handle this (and more scenarios than just backpress)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2025-01-22 13:59:03 +01:00
parent 1f105d44d3
commit 9b6b01254a
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
4 changed files with 0 additions and 14 deletions

View File

@ -348,7 +348,6 @@ class ChatActivity :
private val onBackPressedCallback = object : OnBackPressedCallback(true) { private val onBackPressedCallback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() { override fun handleOnBackPressed() {
chatViewModel.handleChatOnBackPress()
if (currentlyPlayedVoiceMessage != null) { if (currentlyPlayedVoiceMessage != null) {
stopMediaPlayer(currentlyPlayedVoiceMessage!!) stopMediaPlayer(currentlyPlayedVoiceMessage!!)
} }

View File

@ -74,11 +74,6 @@ interface ChatMessageRepository : LifecycleAwareManager {
*/ */
suspend fun getMessage(messageId: Long, bundle: Bundle): Flow<ChatMessage> suspend fun getMessage(messageId: Long, bundle: Bundle): Flow<ChatMessage>
/**
* Destroys unused resources.
*/
fun handleChatOnBackPress()
@Suppress("LongParameterList") @Suppress("LongParameterList")
suspend fun sendChatMessage( suspend fun sendChatMessage(
credentials: String, credentials: String,

View File

@ -806,10 +806,6 @@ class OfflineFirstChatRepository @Inject constructor(
scope.cancel() scope.cancel()
} }
override fun handleChatOnBackPress() {
scope.cancel()
}
@Suppress("LongParameterList") @Suppress("LongParameterList")
override suspend fun sendChatMessage( override suspend fun sendChatMessage(
credentials: String, credentials: String,

View File

@ -647,10 +647,6 @@ class ChatViewModel @Inject constructor(
_getCapabilitiesViewState.value = GetCapabilitiesStartState _getCapabilitiesViewState.value = GetCapabilitiesStartState
} }
fun handleChatOnBackPress() {
chatRepository.handleChatOnBackPress()
}
fun getMessageById(url: String, conversationModel: ConversationModel, messageId: Long): Flow<ChatMessage> = fun getMessageById(url: String, conversationModel: ConversationModel, messageId: Long): Flow<ChatMessage> =
flow { flow {
val bundle = Bundle() val bundle = Bundle()