bump to 25.04.2 and improved migration code

This commit is contained in:
Mauro Romito
2025-04-09 18:29:20 +02:00
committed by Mauro
parent e5e7fc6c55
commit 58a0709a1b
3 changed files with 12 additions and 10 deletions
@@ -371,13 +371,6 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
/// Perform any required migrations for the app to function correctly.
private func performMigrationsIfNecessary(from oldVersion: Version, to newVersion: Version) {
// Migration for the old `hideTimelineMedia` flag.
if let userDefaults = UserDefaults(suiteName: InfoPlistReader.main.appGroupIdentifier),
let hideTimelineMedia = userDefaults.value(forKey: "hideTimelineMedia") as? Bool {
appSettings.timelineMediaVisibility = hideTimelineMedia ? .never : .always
userDefaults.removeObject(forKey: "hideTimelineMedia")
}
guard oldVersion != newVersion else { return }
MXLog.info("The app was upgraded from \(oldVersion) to \(newVersion)")
@@ -394,6 +387,15 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
Tracing.deleteLogFiles()
MXLog.info("Migrating to v1.6.7, log files have been wiped")
}
if oldVersion < Version(25, 4, 2) {
MXLog.info("Migrating to v25.04.2, checking if hideTimelineMedia flag can be migrated to timelineMediaVisibility")
// Migration for the old `hideTimelineMedia` flag.
if let userDefaults = UserDefaults(suiteName: InfoPlistReader.main.appGroupIdentifier),
let hideTimelineMedia = userDefaults.value(forKey: "hideTimelineMedia") as? Bool {
appSettings.timelineMediaVisibility = hideTimelineMedia ? .never : .always
}
}
}
/// Clears the keychain, app support directory etc ready for a fresh use.