From ad7a39b0c7e2e888b5ea69c600e90298c470ee12 Mon Sep 17 00:00:00 2001 From: Diogo Date: Mon, 20 Jan 2025 13:39:37 +0000 Subject: [PATCH] changes matching ios --- .../simplex/common/views/chat/ChatInfoView.kt | 21 ++++++++++------ .../views/chat/group/GroupChatInfoView.kt | 24 ++++++++++++------- .../common/views/database/DatabaseView.kt | 5 ++-- .../commonMain/resources/MR/base/strings.xml | 5 ++-- 4 files changed, 34 insertions(+), 21 deletions(-) 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 31da1161ea..badb278d4f 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 @@ -92,6 +92,9 @@ fun ChatInfoView( }, chatItemTTL = chatItemTTL, setChatItemTTL = { + if (it == chatItemTTL.value) { + return@ChatInfoLayout + } val previousChatTTL = chatItemTTL.value chatItemTTL.value = it @@ -604,13 +607,6 @@ fun ChatInfoLayout( // } else if (developerTools) { // SynchronizeConnectionButtonForce(syncContactConnectionForce) // } - TtlOptions( - chatItemTTL, - enabled = remember { mutableStateOf(true) }, - onSelected = setChatItemTTL, - default = chatModel.chatItemTTL, - icon = painterResource(MR.images.ic_delete), - ) } WallpaperButton { @@ -625,6 +621,17 @@ fun ChatInfoLayout( } SectionDividerSpaced(maxBottomPadding = false) + SectionView { + TtlOptions( + chatItemTTL, + enabled = remember { mutableStateOf(true) }, + onSelected = setChatItemTTL, + default = chatModel.chatItemTTL + ) + } + SectionTextFooter(stringResource(MR.strings.chat_ttl_options_footer)) + SectionDividerSpaced(maxTopPadding = true, maxBottomPadding = false) + val conn = contact.activeConn if (conn != null) { SectionView { 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 bbc1e6089b..c478c3f005 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 @@ -73,6 +73,9 @@ fun ModalData.GroupChatInfoView(chatModel: ChatModel, rhId: Long?, chatId: Strin }, chatItemTTL = chatItemTTL, setChatItemTTL = { + if (it == chatItemTTL.value) { + return@GroupChatInfoLayout + } val previousChatTTL = chatItemTTL.value chatItemTTL.value = it @@ -402,14 +405,6 @@ fun ModalData.GroupChatInfoLayout( SendReceiptsOptionDisabled() } - TtlOptions( - chatItemTTL, - enabled = remember { mutableStateOf(true) }, - onSelected = setChatItemTTL, - default = chatModel.chatItemTTL, - icon = painterResource(MR.images.ic_delete), - ) - WallpaperButton { ModalManager.end.showModal { val chat = remember { derivedStateOf { chatModel.chats.value.firstOrNull { it.id == chat.id } } } @@ -422,7 +417,18 @@ fun ModalData.GroupChatInfoLayout( } val footerId = if (groupInfo.businessChat == null) MR.strings.only_group_owners_can_change_prefs else MR.strings.only_chat_owners_can_change_prefs SectionTextFooter(stringResource(footerId)) - SectionDividerSpaced(maxTopPadding = true) + SectionDividerSpaced(maxTopPadding = true, maxBottomPadding = false) + + SectionView { + TtlOptions( + chatItemTTL, + enabled = remember { mutableStateOf(true) }, + onSelected = setChatItemTTL, + default = chatModel.chatItemTTL + ) + } + SectionTextFooter(stringResource(MR.strings.chat_ttl_options_footer)) + SectionDividerSpaced(maxTopPadding = true, maxBottomPadding = false) SectionView(title = String.format(generalGetString(MR.strings.group_info_section_title_num_members), members.count() + 1)) { if (groupInfo.canAddMembers) { diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/database/DatabaseView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/database/DatabaseView.kt index 4d07bb9d4f..97070f47b1 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/database/DatabaseView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/database/DatabaseView.kt @@ -308,8 +308,7 @@ fun TtlOptions( current: State, enabled: State, onSelected: (ChatItemTTL?) -> Unit, - default: State? = null, - icon: Painter? = null + default: State? = null ) { val values = remember { val all: ArrayList = arrayListOf(ChatItemTTL.None, ChatItemTTL.Year, ChatItemTTL.Month, ChatItemTTL.Week, ChatItemTTL.Day) @@ -331,7 +330,7 @@ fun TtlOptions( generalGetString(MR.strings.delete_messages_after), values, current, - icon = icon, + icon = null, enabled = enabled, onSelected = onSelected ) diff --git a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml index 6d52586198..ded58ac9b3 100644 --- a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml +++ b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml @@ -542,9 +542,10 @@ Notifications Disable automatic message deletion? Change automatic message deletion? - Messages on this chat will never be deleted. - This action cannot be undone - the messages sent and received on this chat earlier than selected will be deleted. It may take several minutes. + Messages in this chat will never be deleted. + This action cannot be undone - the messages sent and received in this chat earlier than selected will be deleted. Disable delete messages + Delete chat messages from your device. connect