diff --git a/RiotNSE/NotificationService.swift b/RiotNSE/NotificationService.swift index 6560290ab..f0c0b1fab 100644 --- a/RiotNSE/NotificationService.swift +++ b/RiotNSE/NotificationService.swift @@ -382,7 +382,13 @@ class NotificationService: UNNotificationServiceExtension { let currentUserId = account.mxCredentials.userId let roomDisplayName = roomSummary?.displayname let pushRule = NotificationService.backgroundSyncService.pushRule(matching: event, roomState: roomState) - + + // if the push rule must not be notified we complete and return + if pushRule?.dontNotify == true { + onComplete(nil, false) + return + } + switch event.eventType { case .callInvite: let offer = event.content["offer"] as? [AnyHashable: Any] @@ -887,3 +893,10 @@ class NotificationService: UNNotificationServiceExtension { return String(format: format, locale: locale, arguments: args) } } + +private extension MXPushRule { + var dontNotify: Bool { + let actions = (actions as? [MXPushRuleAction]) ?? [] + return actions.contains { $0.actionType == MXPushRuleActionTypeDontNotify } + } +} diff --git a/RiotSwiftUI/Modules/Settings/Notifications/View/MentionsAndKeywordNotificationSettings.swift b/RiotSwiftUI/Modules/Settings/Notifications/View/MentionsAndKeywordNotificationSettings.swift index ac1316bfd..6139eb72b 100644 --- a/RiotSwiftUI/Modules/Settings/Notifications/View/MentionsAndKeywordNotificationSettings.swift +++ b/RiotSwiftUI/Modules/Settings/Notifications/View/MentionsAndKeywordNotificationSettings.swift @@ -21,8 +21,7 @@ struct MentionsAndKeywordNotificationSettings: View { var keywordSection: some View { SwiftUI.Section( - header: FormSectionHeader(text: VectorL10n.settingsYourKeywords), - footer: FormSectionFooter(text: VectorL10n.settingsMentionsAndKeywordsEncryptionNotice) + header: FormSectionHeader(text: VectorL10n.settingsYourKeywords) ) { NotificationSettingsKeywords(viewModel: viewModel) } diff --git a/changelog.d/pr-7356.change b/changelog.d/pr-7356.change new file mode 100644 index 000000000..d0f12bb92 --- /dev/null +++ b/changelog.d/pr-7356.change @@ -0,0 +1 @@ +Push Rules: Apply push rules client side for encrypted rooms, hiding in case of dont_notify action \ No newline at end of file