CryptoSDK phased rollout feature

This commit is contained in:
Andy Uhnak
2023-02-14 17:03:25 +00:00
parent 292ea0c347
commit 81cdb68ce4
21 changed files with 463 additions and 84 deletions

View File

@@ -200,11 +200,14 @@ class NotificationService: UNNotificationServiceExtension {
MXLog.debug("[NotificationService] setup: MXBackgroundSyncService init: BEFORE")
self.logMemory()
NotificationService.backgroundSyncService = MXBackgroundSyncService(withCredentials: userAccount.mxCredentials, persistTokenDataHandler: { persistTokenDataHandler in
MXKAccountManager.shared().readAndWriteCredentials(persistTokenDataHandler)
}, unauthenticatedHandler: { error, softLogout, refreshTokenAuth, completion in
userAccount.handleUnauthenticatedWithError(error, isSoftLogout: softLogout, isRefreshTokenAuth: refreshTokenAuth, andCompletion: completion)
})
NotificationService.backgroundSyncService = MXBackgroundSyncService(
withCredentials: userAccount.mxCredentials,
isCryptoSDKEnabled: isCryptoSDKEnabled,
persistTokenDataHandler: { persistTokenDataHandler in
MXKAccountManager.shared().readAndWriteCredentials(persistTokenDataHandler)
}, unauthenticatedHandler: { error, softLogout, refreshTokenAuth, completion in
userAccount.handleUnauthenticatedWithError(error, isSoftLogout: softLogout, isRefreshTokenAuth: refreshTokenAuth, andCompletion: completion)
})
MXLog.debug("[NotificationService] setup: MXBackgroundSyncService init: AFTER")
self.logMemory()
}
@@ -219,10 +222,10 @@ class NotificationService: UNNotificationServiceExtension {
/// Determine whether we have switched from using crypto v1 to v2 or vice versa which will require
/// rebuilding `MXBackgroundSyncService`
private func hasChangedCryptoSDK() -> Bool {
guard isCryptoSDKEnabled != RiotSettings.shared.enableCryptoSDK else {
guard isCryptoSDKEnabled != MXSDKOptions.sharedInstance().enableCryptoSDK else {
return false
}
isCryptoSDKEnabled = RiotSettings.shared.enableCryptoSDK
isCryptoSDKEnabled = MXSDKOptions.sharedInstance().enableCryptoSDK
return true
}

View File

@@ -45,6 +45,7 @@ targets:
- path: ../Config/BuildSettings.swift
- path: ../Riot/Utils/DataProtectionHelper.swift
- path: ../Config/CommonConfiguration.swift
- path: ../Riot/Experiments/
- path: ../Riot/Managers/PushNotification/PushNotificationStore.swift
- path: ../Riot/Modules/SetPinCode/PinCodePreferences.swift
- path: ../Riot/Managers/KeyValueStorage/Extensions/Keychain.swift