diff --git a/CHANGES.rst b/CHANGES.rst index ed19d3fdb..c2c909dde 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -24,6 +24,7 @@ Changes to be released in next version * VoIP: Handle application inactive state too for VoIP pushes (#4269). * VoIP: Do not terminate the app if protected data not available (#4419). * KeyVerification: Listen for request state changes and show QR reader option when it's ready. + * NSE: Recreate background sync service if credentials changed (#3695). ⚠️ API Changes * diff --git a/RiotNSE/NotificationService.swift b/RiotNSE/NotificationService.swift index 3ac8cd0bd..85bdde3d5 100644 --- a/RiotNSE/NotificationService.swift +++ b/RiotNSE/NotificationService.swift @@ -163,7 +163,7 @@ class NotificationService: UNNotificationServiceExtension { MXKAccountManager.shared()?.forceReloadAccounts() self.userAccount = MXKAccountManager.shared()?.activeAccounts.first if let userAccount = userAccount { - if NotificationService.backgroundSyncService == nil { + if NotificationService.backgroundSyncService?.credentials != userAccount.mxCredentials { MXLog.debug("[NotificationService] setup: MXBackgroundSyncService init: BEFORE") self.logMemory() NotificationService.backgroundSyncService = MXBackgroundSyncService(withCredentials: userAccount.mxCredentials)