@@ -20,6 +20,9 @@ struct SpaceView: Identifiable, Equatable, Hashable {
2020 let uxType : SpaceUxType
2121 let pushNotificationEncryptionKey : String
2222 let pushNotificationMode : SpacePushNotificationsMode
23+ let forceAllIds : [ String ]
24+ let forceMuteIds : [ String ]
25+ let forceMentionIds : [ String ]
2326}
2427
2528extension SpaceView : DetailsModel {
@@ -41,6 +44,9 @@ extension SpaceView: DetailsModel {
4144 self . uxType = details. spaceUxTypeValue ?? . data
4245 self . pushNotificationEncryptionKey = details. spacePushNotificationEncryptionKey
4346 self . pushNotificationMode = details. spacePushNotificationModeValue ?? . all
47+ self . forceAllIds = details. spacePushNotificationForceAllIds
48+ self . forceMuteIds = details. spacePushNotificationForceMuteIds
49+ self . forceMentionIds = details. spacePushNotificationForceMentionIds
4450 }
4551
4652 static let subscriptionKeys : [ BundledPropertyKey ] = . builder {
@@ -62,6 +68,9 @@ extension SpaceView: DetailsModel {
6268 BundledPropertyKey . spaceUxType
6369 BundledPropertyKey . spacePushNotificationEncryptionKey
6470 BundledPropertyKey . spacePushNotificationMode
71+ BundledPropertyKey . spacePushNotificationForceAllIds
72+ BundledPropertyKey . spacePushNotificationForceMuteIds
73+ BundledPropertyKey . spacePushNotificationForceMentionIds
6574 }
6675}
6776
@@ -125,4 +134,17 @@ extension SpaceView {
125134 private func activeWriters( participants: [ Participant ] ) -> Int {
126135 participants. filter { $0. permission == . writer || $0. permission == . owner } . count
127136 }
137+
138+ func effectiveNotificationMode( for chatId: String ) -> SpacePushNotificationsMode {
139+ if forceAllIds. contains ( chatId) {
140+ return . all
141+ }
142+ if forceMuteIds. contains ( chatId) {
143+ return . nothing
144+ }
145+ if forceMentionIds. contains ( chatId) {
146+ return . mentions
147+ }
148+ return pushNotificationMode
149+ }
128150}
0 commit comments