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 <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2025-01-16 14:29:12 +01:00
parent 6e1114d4d8
commit 69ddeaa06a
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -14,6 +14,7 @@ import android.util.Log
import android.util.TypedValue import android.util.TypedValue
import android.view.View import android.view.View
import androidx.core.content.res.ResourcesCompat import androidx.core.content.res.ResourcesCompat
import androidx.lifecycle.lifecycleScope
import autodagger.AutoInjector import autodagger.AutoInjector
import coil.load import coil.load
import com.google.android.flexbox.FlexboxLayout 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)) 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) { if (message.isTemporary && !networkMonitor.isOnline.value) {
updateStatus( updateStatus(
R.drawable.ic_signal_wifi_off_white_24dp, R.drawable.ic_signal_wifi_off_white_24dp,