diff --git a/android/app/src/main/res/xml/config.xml b/android/app/src/main/res/xml/config.xml index 0886a477..1b1b0e0d 100644 --- a/android/app/src/main/res/xml/config.xml +++ b/android/app/src/main/res/xml/config.xml @@ -2,9 +2,5 @@ - - - - \ No newline at end of file diff --git a/ios/App/App/AppDelegate.swift b/ios/App/App/AppDelegate.swift index 887477bf..6a7d2fe5 100644 --- a/ios/App/App/AppDelegate.swift +++ b/ios/App/App/AppDelegate.swift @@ -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 diff --git a/ios/App/App/config.xml b/ios/App/App/config.xml index b43c248f..1b1b0e0d 100644 --- a/ios/App/App/config.xml +++ b/ios/App/App/config.xml @@ -2,9 +2,5 @@ - - - - \ No newline at end of file diff --git a/ios/App/App/plugins/AbsDatabase.swift b/ios/App/App/plugins/AbsDatabase.swift index 17a3d964..02a935c3 100644 --- a/ios/App/App/plugins/AbsDatabase.swift +++ b/ios/App/App/plugins/AbsDatabase.swift @@ -236,13 +236,13 @@ public class AbsDatabase: CAPPlugin { let enableAltView = call.getBool("enableAltView") ?? false let jumpBackwardsTime = call.getInt("jumpBackwardsTime") ?? 10 let jumpForwardTime = call.getInt("jumpForwardTime") ?? 10 - let lockOrientation call.getString("lockOrientation") ?? "NONE" + let lockOrientation = call.getString("lockOrientation") ?? "NONE" let settings = DeviceSettings() settings.disableAutoRewind = disableAutoRewind settings.enableAltView = enableAltView settings.jumpBackwardsTime = jumpBackwardsTime settings.jumpForwardTime = jumpForwardTime - settings.lockOrientation = LockOrientationSetting(rawValue: lockOrientation) + settings.lockOrientation = lockOrientation Database.shared.setDeviceSettings(deviceSettings: settings) diff --git a/ios/App/Shared/models/DeviceSettings.swift b/ios/App/Shared/models/DeviceSettings.swift index cb6b4d2e..dc687cd2 100644 --- a/ios/App/Shared/models/DeviceSettings.swift +++ b/ios/App/Shared/models/DeviceSettings.swift @@ -8,18 +8,12 @@ import Foundation import RealmSwift -enum LockOrientationSetting: Codable { - case NONE - case PORTRAIT - case LANDSCAPE -} - class DeviceSettings: Object { @Persisted var disableAutoRewind: Bool = false @Persisted var enableAltView: Bool = false @Persisted var jumpBackwardsTime: Int = 10 @Persisted var jumpForwardTime: Int = 10 - @Persisted var lockOrientation: LockOrientationSetting = LockOrientationSetting.NONE + @Persisted var lockOrientation: String = "NONE" } func getDefaultDeviceSettings() -> DeviceSettings {