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,