From 590644a359235009629d4c00121e08e7630780a8 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Thu, 17 Aug 2023 12:52:03 +0100 Subject: [PATCH] ios: show draft even when messages in the list are hidden (#2944) --- .../ios/Shared/Views/ChatList/ChatPreviewView.swift | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/apps/ios/Shared/Views/ChatList/ChatPreviewView.swift b/apps/ios/Shared/Views/ChatList/ChatPreviewView.swift index 7d38cd0d11..eccf0b5b42 100644 --- a/apps/ios/Shared/Views/ChatList/ChatPreviewView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatPreviewView.swift @@ -103,19 +103,16 @@ struct ChatPreviewView: View { .kerning(-2) } - private func chatPreviewLayout(_ text: Text) -> some View { + private func chatPreviewLayout(_ text: Text, draft: Bool = false) -> some View { ZStack(alignment: .topTrailing) { - let t = text + text .lineLimit(2) .multilineTextAlignment(.leading) .frame(maxWidth: .infinity, alignment: .topLeading) .padding(.leading, 8) .padding(.trailing, 36) - if showChatPreviews { - t - } else { - t.privacySensitive(!showChatPreviews).redacted(reason: .privacy) - } + .privacySensitive(!showChatPreviews && !draft) + .redacted(reason: .privacy) let s = chat.chatStats if s.unreadCount > 0 || s.unreadChat { unreadCountText(s.unreadCount) @@ -177,7 +174,7 @@ struct ChatPreviewView: View { @ViewBuilder private func chatMessagePreview(_ cItem: ChatItem?) -> some View { if chatModel.draftChatId == chat.id, let draft = chatModel.draft { - chatPreviewLayout(messageDraft(draft)) + chatPreviewLayout(messageDraft(draft), draft: true) } else if let cItem = cItem { chatPreviewLayout(itemStatusMark(cItem) + chatItemPreview(cItem)) } else {