aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Models
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/Models
parent5d61fbfd67c3f59bcffa997590d1bc7d41e61528 (diff)
Add unread badge to public chat in sidebar. Display server messages.
Diffstat (limited to 'Hotline/Models')
-rw-r--r--Hotline/Models/Hotline.swift6
1 files changed, 6 insertions, 0 deletions
diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift
index 564845a..ccc23c1 100644
--- a/Hotline/Models/Hotline.swift
+++ b/Hotline/Models/Hotline.swift
@@ -136,6 +136,7 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate {
var transfers: [TransferInfo] = []
var downloads: [HotlineFileClient] = []
var unreadInstantMessages: [UInt16:UInt16] = [:]
+ var unreadPublicChat: Bool = false
@ObservationIgnored var bannerClient: HotlineFileClient?
#if os(macOS)
@@ -226,6 +227,10 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate {
}
}
+ func markPublicChatAsRead() {
+ self.unreadPublicChat = false
+ }
+
func hasUnreadInstantMessages(userID: UInt16) -> Bool {
return self.unreadInstantMessages[userID] != nil
}
@@ -737,6 +742,7 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate {
SoundEffectPlayer.shared.playSoundEffect(.chatMessage)
}
self.chat.append(ChatMessage(text: message, type: .message, date: Date()))
+ self.unreadPublicChat = true
}
func hotlineReceivedUserList(users: [HotlineUser]) {