Move logic in AppConfiguration

This commit is contained in:
Alfonso Grillo
2023-02-02 11:04:28 +01:00
parent 4b25e0edce
commit 0de90435fb
4 changed files with 51 additions and 34 deletions

View File

@@ -38,14 +38,14 @@ class MXNotificationSettingsService: NotificationSettingsServiceType {
let rulesUpdated = NotificationCenter.default.publisher(for: NSNotification.Name(rawValue: kMXNotificationCenterDidUpdateRules))
// Set initial value of the content rules
if let contentRules = session.notificationCenter.rules.global.content as? [MXPushRule] {
if let contentRules = session.notificationCenter.rules?.global.content as? [MXPushRule] {
self.contentRules = contentRules
}
// Observe future updates to content rules
rulesUpdated
.compactMap { [weak self] _ in
self?.session.notificationCenter.rules.global.content as? [MXPushRule]
self?.session.notificationCenter.rules?.global.content as? [MXPushRule]
}
.assign(to: &$contentRules)