This commit is contained in:
spaced4ndy
2023-08-16 21:54:26 +04:00
parent 9d3280167f
commit 01b570913f
2 changed files with 7 additions and 6 deletions

View File

@@ -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,

View File

@@ -31,7 +31,7 @@ import dev.icerock.moko.resources.ImageResource
@Composable
fun ChatPreviewView(
chat: Chat,
showChatPreviews: Boolean,
showChatPreviews: MutableState<Boolean>,
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)
}
}