From ac4b1e9406ae0e7cdb4ad61d58437a8b666068dd Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Mon, 5 Aug 2024 19:39:16 +0400 Subject: [PATCH] multiplatform: improve deleted chats design (#4581) --- .../common/views/contacts/ContactListNavView.kt | 6 +++--- .../common/views/contacts/ContactPreviewView.kt | 16 ++++++++++++++-- .../simplex/common/views/newchat/NewChatSheet.kt | 6 +++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/contacts/ContactListNavView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/contacts/ContactListNavView.kt index 9ef38972a2..b1f53061a1 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/contacts/ContactListNavView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/contacts/ContactListNavView.kt @@ -28,7 +28,7 @@ fun onRequestAccepted(chat: Chat) { } @Composable -fun ContactListNavLinkView(chat: Chat, nextChatSelected: State) { +fun ContactListNavLinkView(chat: Chat, nextChatSelected: State, showDeletedChatIcon: Boolean) { val oneHandUI = remember { appPrefs.oneHandUI.state } val showMenu = remember { mutableStateOf(false) } val rhId = chat.remoteHostId @@ -48,7 +48,7 @@ fun ContactListNavLinkView(chat: Chat, nextChatSelected: State) { ChatListNavLinkLayout( chatLinkPreview = { tryOrShowError("${chat.id}ContactListNavLink", error = { ErrorChatListItem() }) { - ContactPreviewView(chat, disabled) + ContactPreviewView(chat, disabled, showDeletedChatIcon) } }, click = { @@ -97,7 +97,7 @@ fun ContactListNavLinkView(chat: Chat, nextChatSelected: State) { ChatListNavLinkLayout( chatLinkPreview = { tryOrShowError("${chat.id}ContactListNavLink", error = { ErrorChatListItem() }) { - ContactPreviewView(chat, disabled) + ContactPreviewView(chat, disabled, showDeletedChatIcon) } }, click = { diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/contacts/ContactPreviewView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/contacts/ContactPreviewView.kt index d47853f03c..dd03bca921 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/contacts/ContactPreviewView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/contacts/ContactPreviewView.kt @@ -21,6 +21,7 @@ import chat.simplex.res.MR fun ContactPreviewView( chat: Chat, disabled: Boolean, + showDeletedChatIcon: Boolean ) { val cInfo = chat.chatInfo val contactType = chatContactType(chat) @@ -104,10 +105,21 @@ fun ContactPreviewView( ) } - if (chat.chatInfo.chatSettings?.favorite == true) { + if (showDeletedChatIcon && chat.chatInfo.chatDeleted) { + Icon( + painterResource(MR.images.ic_inventory_2), + contentDescription = null, + tint = MaterialTheme.colors.secondary, + modifier = Modifier + .size(17.dp) + ) + if (chat.chatInfo.incognito) { + Spacer(Modifier.width(DEFAULT_SPACE_AFTER_ICON)) + } + } else if (chat.chatInfo.chatSettings?.favorite == true) { Icon( painterResource(MR.images.ic_star_filled), - contentDescription = generalGetString(MR.strings.favorite_chat), + contentDescription = null, tint = MaterialTheme.colors.secondary, modifier = Modifier .size(17.dp) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/NewChatSheet.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/NewChatSheet.kt index 6ebe0ae9d2..d84ef62658 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/NewChatSheet.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/NewChatSheet.kt @@ -262,7 +262,7 @@ private fun NewChatSheetLayout( } ) { Icon( - painterResource(MR.images.ic_folder_open), + painterResource(MR.images.ic_inventory_2), contentDescription = stringResource(MR.strings.deleted_chats), tint = MaterialTheme.colors.secondary, ) @@ -291,7 +291,7 @@ private fun NewChatSheetLayout( chatModel.chatId.value != null && filteredContactChats.getOrNull(index + 1)?.id == chatModel.chatId.value } } - ContactListNavLinkView(chat, nextChatSelected) + ContactListNavLinkView(chat, nextChatSelected, showDeletedChatIcon = true) } } @@ -596,7 +596,7 @@ private fun DeletedContactsView(rh: RemoteHostInfo?, closeDeletedChats: () -> Un chatModel.chatId.value != null && filteredContactChats.getOrNull(index + 1)?.id == chatModel.chatId.value } } - ContactListNavLinkView(chat, nextChatSelected) + ContactListNavLinkView(chat, nextChatSelected, showDeletedChatIcon = false) } } if (filteredContactChats.isEmpty() && allChats.isNotEmpty()) {