From 69ddeaa06afee721959de1784abd280fc3ef6c30 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Thu, 16 Jan 2025 14:29:12 +0100 Subject: [PATCH] use lifecycleScope from chatActivity in OutcomingTextMessageViewHolder defining an own scope and clearing it via onViewRecycled did not work out somehow (offline icon was wrong) Signed-off-by: Marcel Hibbe --- .../talk/adapters/messages/OutcomingTextMessageViewHolder.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt index 81ce90b4a..dfb8b9e2e 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt @@ -14,6 +14,7 @@ import android.util.Log import android.util.TypedValue import android.view.View import androidx.core.content.res.ResourcesCompat +import androidx.lifecycle.lifecycleScope import autodagger.AutoInjector import coil.load import com.google.android.flexbox.FlexboxLayout @@ -133,7 +134,9 @@ class OutcomingTextMessageViewHolder(itemView: View) : updateStatus(R.drawable.ic_check, context.resources?.getString(R.string.nc_message_sent)) } - CoroutineScope(Dispatchers.Main).launch { + val chatActivity = commonMessageInterface as ChatActivity + + chatActivity.lifecycleScope.launch { if (message.isTemporary && !networkMonitor.isOnline.value) { updateStatus( R.drawable.ic_signal_wifi_off_white_24dp,