diff options
| author | Dustin Mierau <dustin@mierau.me> | 2024-05-03 14:05:56 -0700 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2024-05-03 14:05:56 -0700 |
| commit | 0471c4c4594f0406e85687ef84a29d99616c16cf (patch) | |
| tree | 9ab5473eb5bce415dcffad34869ec222af37c146 /Hotline/macOS/ChatView.swift | |
| parent | 5d61fbfd67c3f59bcffa997590d1bc7d41e61528 (diff) | |
Add unread badge to public chat in sidebar. Display server messages.
Diffstat (limited to 'Hotline/macOS/ChatView.swift')
| -rw-r--r-- | Hotline/macOS/ChatView.swift | 12 |
1 files changed, 11 insertions, 1 deletions
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) |