Fix lockOrientation setting and add Realm db migration;

This commit is contained in:
advplyr
2022-12-07 16:12:09 -06:00
parent 371fcacc87
commit a262efe9da
5 changed files with 10 additions and 18 deletions
+7 -1
View File
@@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Override point for customization after application launch.
let configuration = Realm.Configuration(
schemaVersion: 4,
schemaVersion: 5,
migrationBlock: { [weak self] migration, oldSchemaVersion in
if (oldSchemaVersion < 1) {
self?.logger.log("Realm schema version was \(oldSchemaVersion)")
@@ -30,6 +30,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
indexCounter += 1
}
}
if (oldSchemaVersion < 5) {
self?.logger.log("Realm schema version was \(oldSchemaVersion)... Adding lockOrientation setting")
migration.enumerateObjects(ofType: DeviceSettings.className()) { oldObject, newObject in
newObject?["lockOrientation"] = "NONE"
}
}
}
)
Realm.Configuration.defaultConfiguration = configuration