From 0471c4c4594f0406e85687ef84a29d99616c16cf Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Fri, 3 May 2024 14:05:56 -0700 Subject: Add unread badge to public chat in sidebar. Display server messages. --- Hotline/macOS/ChatView.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'Hotline/macOS/ChatView.swift') diff --git a/Hotline/macOS/ChatView.swift b/Hotline/macOS/ChatView.swift index 951544f..5bd626f 100644 --- a/Hotline/macOS/ChatView.swift +++ b/Hotline/macOS/ChatView.swift @@ -67,6 +67,13 @@ struct ChatView: View { .clipShape(RoundedRectangle(cornerRadius: 8)) .padding(.bottom, 16) } + // MARK: Server Message + else if msg.type == .server { + Text(msg.text) + .lineSpacing(4) + .multilineTextAlignment(.leading) + .textSelection(.enabled) + } // MARK: Status else if msg.type == .status { HStack { @@ -141,7 +148,10 @@ struct ChatView: View { .frame(maxWidth: .infinity, maxHeight: .infinity) .defaultScrollAnchor(.bottom) .onChange(of: model.chat.count) { - reader.scrollTo(bottomID, anchor: .bottom) + withAnimation(.easeOut(duration: 0.15).delay(0.25)) { + reader.scrollTo(bottomID, anchor: .bottom) + } + model.markPublicChatAsRead() } .onAppear { reader.scrollTo(bottomID, anchor: .bottom) -- cgit