mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Add a migration to expire sync sessions so that m.space.* state is up to date. (#4482)
This commit is contained in:
@@ -29,6 +29,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
/// Common background task to continue long-running tasks in the background.
|
||||
private var backgroundTask: UIBackgroundTaskIdentifier?
|
||||
|
||||
private var userSessionMigrationsOldVersion: Version?
|
||||
private var userSession: UserSessionProtocol? {
|
||||
didSet {
|
||||
userSessionObserver?.cancel()
|
||||
@@ -37,7 +38,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
configureNotificationManager()
|
||||
observeUserSessionChanges()
|
||||
startSync()
|
||||
performSettingsToAccountDataMigration(userSession: userSession)
|
||||
Task { await performUserSessionMigrations(userSession) }
|
||||
Task { await appHooks.configure(with: userSession) }
|
||||
}
|
||||
}
|
||||
@@ -410,6 +411,27 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
Tracing.migrateLogFiles()
|
||||
MXLog.info("Migrating to version 25.07.4, log files have been moved.")
|
||||
}
|
||||
|
||||
// Store the old version to run additional migrations on the user session once it has been set up.
|
||||
userSessionMigrationsOldVersion = oldVersion
|
||||
}
|
||||
|
||||
private func performUserSessionMigrations(_ userSession: UserSessionProtocol) async {
|
||||
guard let oldVersion = userSessionMigrationsOldVersion else { return }
|
||||
|
||||
MXLog.info("Migrating user session from \(oldVersion)")
|
||||
|
||||
if oldVersion < Version(25, 6, 0) {
|
||||
MXLog.info("Migrating to version 25.06.0, migrating timeline media settings to account data.")
|
||||
performSettingsToAccountDataMigration(userSession: userSession)
|
||||
}
|
||||
|
||||
if oldVersion < Version(25, 9, 2) {
|
||||
MXLog.info("Migrating to version 25.09.2, triggering sync to ensure m.space state is up to date.")
|
||||
await userSession.clientProxy.expireSyncSessions()
|
||||
}
|
||||
|
||||
userSessionMigrationsOldVersion = nil
|
||||
}
|
||||
|
||||
// This could be removed once the adoption of 25.06.x is widespread.
|
||||
|
||||
Reference in New Issue
Block a user