diff --git a/ElementX/Sources/Application/AppSettings.swift b/ElementX/Sources/Application/AppSettings.swift index 1ef5bf28c..a9a645149 100644 --- a/ElementX/Sources/Application/AppSettings.swift +++ b/ElementX/Sources/Application/AppSettings.swift @@ -192,10 +192,6 @@ final class AppSettings { /// Tag describing which set of device specific rules a pusher executes. @UserPreference(key: UserDefaultsKeys.pusherProfileTag, storageType: .userDefaults(store)) var pusherProfileTag: String? - - /// Allows notifications to be filtered based on the push context of the room - @UserPreference(key: SharedUserDefaultsKeys.filterNotificationsByPushRulesEnabled, defaultValue: false, storageType: .userDefaults(store)) - var filterNotificationsByPushRulesEnabled // MARK: - Other diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift index 6186367d8..928113a49 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift @@ -50,7 +50,6 @@ protocol DeveloperOptionsProtocol: AnyObject { var swiftUITimelineEnabled: Bool { get set } var pollsInTimelineEnabled: Bool { get set } var fuzzySearchEnabled: Bool { get set } - var filterNotificationsByPushRulesEnabled: Bool { get set } } extension AppSettings: DeveloperOptionsProtocol { } diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift index 276900c11..aa5172029 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift @@ -49,10 +49,6 @@ struct DeveloperOptionsScreen: View { Toggle(isOn: $context.notificationSettingsEnabled) { Text("Show notification settings") } - - Toggle(isOn: $context.filterNotificationsByPushRulesEnabled) { - Text("Filter notifications by push rules") - } } Section("Room creation") { diff --git a/NSE/Sources/NotificationServiceExtension.swift b/NSE/Sources/NotificationServiceExtension.swift index 91589e8be..6b53faa17 100644 --- a/NSE/Sources/NotificationServiceExtension.swift +++ b/NSE/Sources/NotificationServiceExtension.swift @@ -71,7 +71,7 @@ class NotificationServiceExtension: UNNotificationServiceExtension { MXLog.info("\(tag) run with roomId: \(roomId), eventId: \(eventId)") do { - let userSession = try NSEUserSession(credentials: credentials, filterByPushRulesEnabled: settings.filterNotificationsByPushRulesEnabled) + let userSession = try NSEUserSession(credentials: credentials) self.userSession = userSession guard let itemProxy = await userSession.notificationItemProxy(roomID: roomId, eventID: eventId) else { MXLog.info("\(tag) no notification for the event, discard") diff --git a/NSE/Sources/Other/NSESettings.swift b/NSE/Sources/Other/NSESettings.swift index c0ad21fc9..d0dd2cbb8 100644 --- a/NSE/Sources/Other/NSESettings.swift +++ b/NSE/Sources/Other/NSESettings.swift @@ -21,8 +21,4 @@ final class NSESettings { /// UserDefaults to be used on reads and writes. private static var store: UserDefaults! = UserDefaults(suiteName: suiteName) - - /// Allows notifications to be filtered based on the push context of the room - @UserPreference(key: SharedUserDefaultsKeys.filterNotificationsByPushRulesEnabled, defaultValue: false, storageType: .userDefaults(store)) - var filterNotificationsByPushRulesEnabled } diff --git a/NSE/Sources/Other/NSEUserSession.swift b/NSE/Sources/Other/NSEUserSession.swift index f0a24d30d..e7ce3f7db 100644 --- a/NSE/Sources/Other/NSEUserSession.swift +++ b/NSE/Sources/Other/NSEUserSession.swift @@ -25,7 +25,7 @@ final class NSEUserSession { imageCache: .onlyOnDisk, backgroundTaskService: nil) - init(credentials: KeychainCredentials, filterByPushRulesEnabled: Bool) throws { + init(credentials: KeychainCredentials) throws { userID = credentials.userID baseClient = try ClientBuilder() .basePath(path: URL.sessionsBaseDirectory.path) @@ -34,15 +34,11 @@ final class NSEUserSession { try baseClient.restoreSession(session: credentials.restorationToken.session) - var notificationClientBuilder = try baseClient + notificationClient = try baseClient .notificationClient() .retryDecryption(withCrossProcessLock: true) - - if filterByPushRulesEnabled { - notificationClientBuilder = notificationClientBuilder.filterByPushRules() - } - - notificationClient = notificationClientBuilder.finish() + .filterByPushRules() + .finish() } func notificationItemProxy(roomID: String, eventID: String) async -> NotificationItemProxyProtocol? {