multiplatform: improve deleted chats design (#4581)

This commit is contained in:
spaced4ndy
2024-08-05 19:39:16 +04:00
committed by GitHub
parent b04f159970
commit ac4b1e9406
3 changed files with 20 additions and 8 deletions
@@ -28,7 +28,7 @@ fun onRequestAccepted(chat: Chat) {
}
@Composable
fun ContactListNavLinkView(chat: Chat, nextChatSelected: State<Boolean>) {
fun ContactListNavLinkView(chat: Chat, nextChatSelected: State<Boolean>, 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<Boolean>) {
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<Boolean>) {
ChatListNavLinkLayout(
chatLinkPreview = {
tryOrShowError("${chat.id}ContactListNavLink", error = { ErrorChatListItem() }) {
ContactPreviewView(chat, disabled)
ContactPreviewView(chat, disabled, showDeletedChatIcon)
}
},
click = {
@@ -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)
@@ -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()) {