diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/KeymanWebViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/KeymanWebViewController.swift index 57697c2cb4..d00214df4a 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/KeymanWebViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/KeymanWebViewController.swift @@ -710,8 +710,8 @@ extension KeymanWebViewController { var defaultHeight = KeyboardScaleMap.getDeviceDefaultKeyboardScale(forPortrait: isPortrait)?.keyboardHeight ?? 216 // default for ancient devices if (isPortrait) { - if let portraitHeight = Storage.active.userDefaults.portraitKeyboardHeight as Double? { - keyboardHeight = portraitHeight + if (Storage.active.userDefaults.object(forKey: Key.portraitKeyboardHeight) != nil) { + let portraitHeight = Storage.active.userDefaults.portraitKeyboardHeight let message = "constraintTargetHeight, from UserDefaults loaded portrait value \(portraitHeight)" os_log("%{public}s", log:KeymanEngineLogger.migration, type: .info, message) } else { @@ -720,8 +720,8 @@ extension KeymanWebViewController { keyboardHeight = defaultHeight } } else { - if let landscapeHeight = Storage.active.userDefaults.landscapeKeyboardHeight as Double? { - keyboardHeight = landscapeHeight + if (Storage.active.userDefaults.object(forKey: Key.portraitKeyboardHeight) != nil) { + let landscapeHeight = Storage.active.userDefaults.landscapeKeyboardHeight let message = "constraintTargetHeight, from UserDefaults loaded landscape value \(landscapeHeight)" os_log("%{public}s", log:KeymanEngineLogger.migration, type: .info, message) } else { diff --git a/ios/engine/KMEI/KeymanEngine/Classes/KeyboardHeightViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/KeyboardHeightViewController.swift index 3202c2ec77..21ae1bc72a 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/KeyboardHeightViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/KeyboardHeightViewController.swift @@ -78,9 +78,9 @@ class KeyboardHeightViewController: UIViewController { private func applyKeyboardHeight() { if (self.isPortrait) { - if let portraitHeight = Storage.active.userDefaults.portraitKeyboardHeight as Double? { - self.keyboardHeight = portraitHeight - let message = "applyKeyboardHeight, from UserDefaults loaded portrait value \(portraitHeight)" + if (Storage.active.userDefaults.object(forKey: Key.portraitKeyboardHeight) != nil) { + self.keyboardHeight = Storage.active.userDefaults.portraitKeyboardHeight + let message = "applyKeyboardHeight, from UserDefaults loaded portrait value \(self.keyboardHeight)" os_log("%{public}s", log:KeymanEngineLogger.migration, type: .info, message) } else { self.keyboardHeight = self.defaultPortraitHeight @@ -88,9 +88,9 @@ class KeyboardHeightViewController: UIViewController { os_log("%{public}s", log:KeymanEngineLogger.migration, type: .info, message) } } else { - if let landscapeHeight = Storage.active.userDefaults.landscapeKeyboardHeight as Double? { - self.keyboardHeight = landscapeHeight - let message = "applyKeyboardHeight, from UserDefaults loaded landscape value \(landscapeHeight)" + if (Storage.active.userDefaults.object(forKey: Key.portraitKeyboardHeight) != nil) { + self.keyboardHeight = Storage.active.userDefaults.landscapeKeyboardHeight + let message = "applyKeyboardHeight, from UserDefaults loaded landscape value \(self.keyboardHeight)" os_log("%{public}s", log:KeymanEngineLogger.migration, type: .info, message) } else { self.keyboardHeight = self.defaultLandscapeHeight