From 6e2c133faa47f198b48ebe521868b3e360af6cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=E2=80=99Aquino?= Date: Sat, 13 Jul 2024 00:31:30 +0000 Subject: [PATCH] Truncate long text messages on chat event view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Very large messages on the chat event view cause issues with swipe and long-press interactions, and they might be a nuisance during scrolling. This commit adds text truncation to the chat event view. The "show more" button causes the user to navigate to the message, which is reasonable to avoid overloading too many interactions on the same view and having a huge text bubble that is difficult to interact with. Closes: https://github.com/damus-io/damus/issues/2326 Signed-off-by: Daniel D’Aquino --- damus/Views/Chat/ChatEventView.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/damus/Views/Chat/ChatEventView.swift b/damus/Views/Chat/ChatEventView.swift index 136c0bcf..0251b0f5 100644 --- a/damus/Views/Chat/ChatEventView.swift +++ b/damus/Views/Chat/ChatEventView.swift @@ -124,13 +124,13 @@ struct ChatEventView: View { } let blur_images = should_blur_images(settings: damus_state.settings, contacts: damus_state.contacts, ev: event, our_pubkey: damus_state.pubkey) - NoteContentView(damus_state: damus_state, event: event, blur_images: blur_images, size: .normal, options: []) + NoteContentView(damus_state: damus_state, event: event, blur_images: blur_images, size: .normal, options: [.truncate_content]) .padding(2) } .frame(minWidth: 5, alignment: is_ours ? .trailing : .leading) .padding(10) } - .tint(is_ours ? Color.white : Color.accentColor) + .tint(Color.accentColor) .overlay( ZStack(alignment: is_ours ? .bottomLeading : .bottomTrailing) { VStack {