osx: try badging icon for unread
This commit is contained in:
@@ -101,6 +101,11 @@ struct ConversationListView: View
|
|||||||
.map { Display.Conversation(from: $0) }
|
.map { Display.Conversation(from: $0) }
|
||||||
|
|
||||||
self.conversations = clientConversations
|
self.conversations = clientConversations
|
||||||
|
|
||||||
|
let unreadConversations = clientConversations.filter(\.isUnread)
|
||||||
|
await MainActor.run {
|
||||||
|
NSApplication.shared.dockTile.badgeLabel = unreadConversations.isEmpty ? nil : "\(unreadConversations.count)"
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
print("Error reloading conversations: \(error)")
|
print("Error reloading conversations: \(error)")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,11 @@ enum Display
|
|||||||
var isGroupChat: Bool {
|
var isGroupChat: Bool {
|
||||||
participants.count > 1
|
participants.count > 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isUnread: Bool {
|
||||||
|
unreadCount > 0
|
||||||
|
}
|
||||||
|
|
||||||
init(from c: Serialized.Conversation) {
|
init(from c: Serialized.Conversation) {
|
||||||
self.id = c.guid
|
self.id = c.guid
|
||||||
self.name = c.displayName
|
self.name = c.displayName
|
||||||
|
|||||||
Reference in New Issue
Block a user