mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Apply (polls) push rules client side for encrypted rooms (#7356)
* managing dont notify push rule * private extension for push rule * remove mentions and keyword notice footer
This commit is contained in:
parent
75049c29e8
commit
f36f5782fb
3 changed files with 16 additions and 3 deletions
|
@ -383,6 +383,12 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
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 }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
1
changelog.d/pr-7356.change
Normal file
1
changelog.d/pr-7356.change
Normal file
|
@ -0,0 +1 @@
|
|||
Push Rules: Apply push rules client side for encrypted rooms, hiding in case of dont_notify action
|
Loading…
Reference in a new issue