aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS/ChatView.swift
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2024-05-03 14:05:56 -0700
committerDustin Mierau <dustin@mierau.me>2024-05-03 14:05:56 -0700
commit0471c4c4594f0406e85687ef84a29d99616c16cf (patch)
tree9ab5473eb5bce415dcffad34869ec222af37c146 /Hotline/macOS/ChatView.swift
parent5d61fbfd67c3f59bcffa997590d1bc7d41e61528 (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.swift12
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)