removed filter by push rules ff

This commit is contained in:
Mauro Romito 2023-08-17 11:08:58 +02:00 committed by Mauro
parent 035d57537f
commit d6b3a000f0
6 changed files with 5 additions and 22 deletions

View File

@ -192,10 +192,6 @@ final class AppSettings {
/// Tag describing which set of device specific rules a pusher executes. /// Tag describing which set of device specific rules a pusher executes.
@UserPreference(key: UserDefaultsKeys.pusherProfileTag, storageType: .userDefaults(store)) @UserPreference(key: UserDefaultsKeys.pusherProfileTag, storageType: .userDefaults(store))
var pusherProfileTag: String? 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 // MARK: - Other

View File

@ -50,7 +50,6 @@ protocol DeveloperOptionsProtocol: AnyObject {
var swiftUITimelineEnabled: Bool { get set } var swiftUITimelineEnabled: Bool { get set }
var pollsInTimelineEnabled: Bool { get set } var pollsInTimelineEnabled: Bool { get set }
var fuzzySearchEnabled: Bool { get set } var fuzzySearchEnabled: Bool { get set }
var filterNotificationsByPushRulesEnabled: Bool { get set }
} }
extension AppSettings: DeveloperOptionsProtocol { } extension AppSettings: DeveloperOptionsProtocol { }

View File

@ -49,10 +49,6 @@ struct DeveloperOptionsScreen: View {
Toggle(isOn: $context.notificationSettingsEnabled) { Toggle(isOn: $context.notificationSettingsEnabled) {
Text("Show notification settings") Text("Show notification settings")
} }
Toggle(isOn: $context.filterNotificationsByPushRulesEnabled) {
Text("Filter notifications by push rules")
}
} }
Section("Room creation") { Section("Room creation") {

View File

@ -71,7 +71,7 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
MXLog.info("\(tag) run with roomId: \(roomId), eventId: \(eventId)") MXLog.info("\(tag) run with roomId: \(roomId), eventId: \(eventId)")
do { do {
let userSession = try NSEUserSession(credentials: credentials, filterByPushRulesEnabled: settings.filterNotificationsByPushRulesEnabled) let userSession = try NSEUserSession(credentials: credentials)
self.userSession = userSession self.userSession = userSession
guard let itemProxy = await userSession.notificationItemProxy(roomID: roomId, eventID: eventId) else { guard let itemProxy = await userSession.notificationItemProxy(roomID: roomId, eventID: eventId) else {
MXLog.info("\(tag) no notification for the event, discard") MXLog.info("\(tag) no notification for the event, discard")

View File

@ -21,8 +21,4 @@ final class NSESettings {
/// UserDefaults to be used on reads and writes. /// UserDefaults to be used on reads and writes.
private static var store: UserDefaults! = UserDefaults(suiteName: suiteName) 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
} }

View File

@ -25,7 +25,7 @@ final class NSEUserSession {
imageCache: .onlyOnDisk, imageCache: .onlyOnDisk,
backgroundTaskService: nil) backgroundTaskService: nil)
init(credentials: KeychainCredentials, filterByPushRulesEnabled: Bool) throws { init(credentials: KeychainCredentials) throws {
userID = credentials.userID userID = credentials.userID
baseClient = try ClientBuilder() baseClient = try ClientBuilder()
.basePath(path: URL.sessionsBaseDirectory.path) .basePath(path: URL.sessionsBaseDirectory.path)
@ -34,15 +34,11 @@ final class NSEUserSession {
try baseClient.restoreSession(session: credentials.restorationToken.session) try baseClient.restoreSession(session: credentials.restorationToken.session)
var notificationClientBuilder = try baseClient notificationClient = try baseClient
.notificationClient() .notificationClient()
.retryDecryption(withCrossProcessLock: true) .retryDecryption(withCrossProcessLock: true)
.filterByPushRules()
if filterByPushRulesEnabled { .finish()
notificationClientBuilder = notificationClientBuilder.filterByPushRules()
}
notificationClient = notificationClientBuilder.finish()
} }
func notificationItemProxy(roomID: String, eventID: String) async -> NotificationItemProxyProtocol? { func notificationItemProxy(roomID: String, eventID: String) async -> NotificationItemProxyProtocol? {