From 49d0b474e60e46db75d7590249927d8e62e4e7a3 Mon Sep 17 00:00:00 2001 From: zoff99 Date: Wed, 14 Feb 2024 22:13:00 +0100 Subject: [PATCH] fix scope on some calls --- .../org/briarproject/briar/desktop/contact/ContactList.kt | 4 +++- .../org/briarproject/briar/desktop/contact/GroupList.kt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactList.kt b/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactList.kt index 5a57a059..eff254fe 100644 --- a/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactList.kt +++ b/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactList.kt @@ -10,6 +10,7 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.selection.selectableGroup import androidx.compose.runtime.Composable +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.semantics.contentDescription @@ -50,9 +51,10 @@ fun ContactList( key = { item -> item.pubkey }, contentType = { item -> item::class } ) { item -> + val ListItemViewScope = rememberCoroutineScope() ListItemView( onSelect = { - GlobalScope.launch { globalstore.try_clear_unread_message_count() } + ListItemViewScope.launch { globalstore.try_clear_unread_message_count() } globalfrndstoreunreadmsgs.hard_clear_unread_per_friend_message_count(item.pubkey) contactstore.select(item.pubkey) }, diff --git a/src/main/kotlin/org/briarproject/briar/desktop/contact/GroupList.kt b/src/main/kotlin/org/briarproject/briar/desktop/contact/GroupList.kt index 91e489f7..c19edf2c 100644 --- a/src/main/kotlin/org/briarproject/briar/desktop/contact/GroupList.kt +++ b/src/main/kotlin/org/briarproject/briar/desktop/contact/GroupList.kt @@ -12,6 +12,7 @@ import androidx.compose.foundation.selection.selectableGroup import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.semantics.contentDescription @@ -52,10 +53,11 @@ fun GroupList( key = { item -> item.groupId }, contentType = { item -> item::class } ) { item -> + val ListItemViewScope = rememberCoroutineScope() ListItemView( onSelect = { groupsettingsstore.visible(false) - GlobalScope.launch { + ListItemViewScope.launch { globalstore.try_clear_unread_group_message_count() } globalgrpstoreunreadmsgs.hard_clear_unread_per_group_message_count(item.groupId)