mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-11 20:27:39 +00:00
desktop: use the open chat's mute, receipts and member search in info
The info pane stays open when another chat is clicked, but its mute button, a group's "Send receipts" and the member search kept the state of the chat it was showing before: chat B showed "Unmute" while it was not muted, and tapping it applied chat A's next mode to B; group B showed A's receipts setting; and A's member search filter hid B's members, with no search field to clear it in groups of up to 8 members besides you. The mute button also missed changes made outside the pane, such as muting from the chat list menu. Read the mute state from the chat itself, and keep the group's receipts setting and member search per chat.
This commit is contained in:
1 parent
a932c8298a
commit
84b0cf5507
2 files changed
+7
-9
No files matched your search
+2
-3
@@ -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)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
+5
-6
@@ -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) }
|
||||
|
||||
Reference in new issue
Block a user