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 e846d17e84..728f7c087c 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 4eb726b05b..6cbf5abd22 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) } }