Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply (polls) push rules client side for encrypted rooms #7356

Merged
merged 6 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion RiotNSE/NotificationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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 }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
1 change: 1 addition & 0 deletions changelog.d/pr-7356.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Push Rules: Apply push rules client side for encrypted rooms, hiding in case of dont_notify action