diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatInfoView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatInfoView.kt index 9c019ad535..6466b706a6 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatInfoView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatInfoView.kt @@ -906,8 +906,7 @@ fun MuteButton( chat: Chat, contact: Contact ) { - val enableNtfs = remember { mutableStateOf(contact.chatSettings.enableNtfs ) } - val nextNtfMode by remember { derivedStateOf { enableNtfs.value.nextMode(false) } } + val nextNtfMode = contact.chatSettings.enableNtfs.nextMode(false) val disabled = !contact.ready || !contact.active InfoViewActionButton( @@ -917,7 +916,7 @@ fun MuteButton( disabled = disabled, disabledLook = disabled, onClick = { - toggleNotifications(chat.remoteHostId, chat.chatInfo, nextNtfMode, chatModel, enableNtfs) + toggleNotifications(chat.remoteHostId, chat.chatInfo, nextNtfMode, chatModel) } ) } diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt index 973b684d38..9811b4601b 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt @@ -77,7 +77,7 @@ fun ModalData.GroupChatInfoView( val developerTools = chatModel.controller.appPrefs.developerTools.get() if (chat != null && chat.chatInfo is ChatInfo.Group && currentUser != null) { val groupInfo = chat.chatInfo.groupInfo - val sendReceipts = remember { mutableStateOf(SendReceipts.fromBool(groupInfo.chatSettings.sendRcpts, currentUser.sendRcptsSmallGroups)) } + val sendReceipts = remember(groupInfo.id) { mutableStateOf(SendReceipts.fromBool(groupInfo.chatSettings.sendRcpts, currentUser.sendRcptsSmallGroups)) } val chatItemTTL = remember(groupInfo.id) { mutableStateOf(if (groupInfo.chatItemTTL != null) ChatItemTTL.fromSeconds(groupInfo.chatItemTTL) else null) } val deletingItems = rememberSaveable(groupInfo.id) { mutableStateOf(false) } val scope = rememberCoroutineScope() @@ -421,8 +421,7 @@ fun MuteButton( chat: Chat, groupInfo: GroupInfo ) { - val notificationMode = remember { mutableStateOf(groupInfo.chatSettings.enableNtfs) } - val nextNotificationMode by remember { derivedStateOf { notificationMode.value.nextMode(true) } } + val nextNotificationMode = groupInfo.chatSettings.enableNtfs.nextMode(true) InfoViewActionButton( modifier = modifier, @@ -431,7 +430,7 @@ fun MuteButton( disabled = !groupInfo.ready, disabledLook = !groupInfo.ready, onClick = { - toggleNotifications(chat.remoteHostId, chat.chatInfo, nextNotificationMode, chatModel, notificationMode) + toggleNotifications(chat.remoteHostId, chat.chatInfo, nextNotificationMode, chatModel) } ) } @@ -545,8 +544,8 @@ fun ModalData.GroupChatInfoLayout( KeyChangeEffect(chat.id) { scope.launch { listState.scrollToItem(0) } } - val searchText = remember { stateGetOrPut("searchText") { TextFieldValue() } } - val filteredMembers = remember(activeSortedMembers) { + val searchText = remember(chat.id) { stateGetOrPut("searchText:${chat.id}") { TextFieldValue() } } + val filteredMembers = remember(activeSortedMembers, searchText) { derivedStateOf { val s = searchText.value.text.trim().lowercase() if (s.isEmpty()) activeSortedMembers else activeSortedMembers.filter { m -> m.anyNameContains(s) }