From 01b570913fc8b8ed426fe7bc1e3be104041e6077 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Wed, 16 Aug 2023 21:54:26 +0400 Subject: [PATCH] wip --- .../simplex/common/views/chatlist/ChatListNavLinkView.kt | 7 ++++--- .../chat/simplex/common/views/chatlist/ChatPreviewView.kt | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt index e846d17e8..728f7c087 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt @@ -44,7 +44,8 @@ fun ChatListNavLinkView(chat: Chat, chatModel: ChatModel) { showMenu.value = false delay(500L) } - val showChatPreviews = chatModel.controller.appPrefs.privacyShowChatPreviews.get() + // TODO repeat stopped + val showChatPreviews = remember { mutableStateOf(chatModel.controller.appPrefs.privacyShowChatPreviews.get()) } when (chat.chatInfo) { is ChatInfo.Direct -> { val contactNetworkStatus = chatModel.contactNetworkStatus(chat.chatInfo.contact) @@ -669,7 +670,7 @@ fun PreviewChatListNavLinkDirect() { ), chatStats = Chat.ChatStats() ), - true, + remember { mutableStateOf(false) }, null, null, null, @@ -709,7 +710,7 @@ fun PreviewChatListNavLinkGroup() { ), chatStats = Chat.ChatStats() ), - true, + remember { mutableStateOf(false) }, null, null, null, diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatPreviewView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatPreviewView.kt index 4eb726b05..6cbf5abd2 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatPreviewView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatPreviewView.kt @@ -31,7 +31,7 @@ import dev.icerock.moko.resources.ImageResource @Composable fun ChatPreviewView( chat: Chat, - showChatPreviews: Boolean, + showChatPreviews: MutableState, chatModelDraft: ComposeState?, chatModelDraftChatId: ChatId?, currentUserProfileDisplayName: String?, @@ -141,7 +141,7 @@ fun ChatPreviewView( fun chatPreviewText() { val ci = chat.chatItems.lastOrNull() if (ci != null) { - if (showChatPreviews) { + if (showChatPreviews.value) { val (text: CharSequence, inlineTextContent) = when { chatModelDraftChatId == chat.id && chatModelDraft != null -> remember(chatModelDraft) { messageDraft(chatModelDraft) } ci.meta.itemDeleted == null -> ci.text to null @@ -339,6 +339,6 @@ fun unreadCountStr(n: Int): String { @Composable fun PreviewChatPreviewView() { SimpleXTheme { - ChatPreviewView(Chat.sampleData, true, null, null, "", contactNetworkStatus = NetworkStatus.Connected(), stopped = false, linkMode = SimplexLinkMode.DESCRIPTION) + ChatPreviewView(Chat.sampleData, remember { mutableStateOf(false) }, null, null, "", contactNetworkStatus = NetworkStatus.Connected(), stopped = false, linkMode = SimplexLinkMode.DESCRIPTION) } }