Recreate background sync service if credentials changed

This commit is contained in:
ismailgulek 2021-06-18 19:45:14 +03:00
parent 860e883ae0
commit 21dc703ab4
No known key found for this signature in database
GPG key ID: E96336D42D9470A9

View file

@ -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)