From 6b729f9c957f6d8cc1f6f249c0da3ce15d55cb42 Mon Sep 17 00:00:00 2001 From: jahorton Date: Thu, 8 Aug 2019 10:00:45 +0700 Subject: [PATCH 1/4] Fixes main Settings menu toggles. --- .../Classes/Settings/Settings.storyboard | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Settings/Settings.storyboard b/ios/engine/KMEI/KeymanEngine/Classes/Settings/Settings.storyboard index c5b79081f8..f6328c5ada 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Settings/Settings.storyboard +++ b/ios/engine/KMEI/KeymanEngine/Classes/Settings/Settings.storyboard @@ -1,10 +1,9 @@ - + - @@ -14,19 +13,19 @@ - + - + - + - + - + - - - + + + + + - + - + - - - + + + + + @@ -94,7 +97,7 @@ - + From 2a6d5788a9582ea1a48dda03ec3f5e27dd4eb49e Mon Sep 17 00:00:00 2001 From: jahorton Date: Thu, 8 Aug 2019 11:39:15 +0700 Subject: [PATCH 2/4] Fixes toggles on language screen. --- .../Settings/LanguageSettingsViewController.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift index 8b7f2d9e91..83a6756dc8 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift @@ -122,19 +122,33 @@ class LanguageSettingsViewController: UITableViewController { if 0 == indexPath.row { cell.accessoryType = .none let doPredictionsSwitch = UISwitch() + doPredictionsSwitch.translatesAutoresizingMaskIntoConstraints = false + let switchFrame = frameAtRightOfCell(cell: cell.frame, controlSize: doPredictionsSwitch.frame.size) doPredictionsSwitch.frame = switchFrame + doPredictionsSwitch.isOn = userDefaults.predictSettingForLanguage(languageID: self.language.id) doPredictionsSwitch.addTarget(self, action: #selector(self.predictionSwitchValueChanged), for: .valueChanged) cell.addSubview(doPredictionsSwitch) + if #available(iOSApplicationExtension 11.0, *) { + doPredictionsSwitch.rightAnchor.constraint(equalTo: cell.layoutMarginsGuide.rightAnchor).isActive = true + doPredictionsSwitch.centerYAnchor.constraint(equalTo: cell.layoutMarginsGuide.centerYAnchor).isActive = true + } } else if 1 == indexPath.row { cell.accessoryType = .none let doCorrectionsSwitch = UISwitch() + doCorrectionsSwitch.translatesAutoresizingMaskIntoConstraints = false + let switchFrame = frameAtRightOfCell(cell: cell.frame, controlSize: doCorrectionsSwitch.frame.size) doCorrectionsSwitch.frame = switchFrame + doCorrectionsSwitch.isOn = userDefaults.correctSettingForLanguage(languageID: self.language.id) doCorrectionsSwitch.addTarget(self, action: #selector(self.correctionSwitchValueChanged), for: .valueChanged) cell.addSubview(doCorrectionsSwitch) + if #available(iOSApplicationExtension 11.0, *) { + doCorrectionsSwitch.rightAnchor.constraint(equalTo: cell.layoutMarginsGuide.rightAnchor).isActive = true + doCorrectionsSwitch.centerYAnchor.constraint(equalTo: cell.layoutMarginsGuide.centerYAnchor).isActive = true + } } else { // rows 3 and 4 cell.accessoryType = .disclosureIndicator } From 59a26cd1a2eb6230e9f4e860b15f8807460065d7 Mon Sep 17 00:00:00 2001 From: jahorton Date: Thu, 8 Aug 2019 11:51:18 +0700 Subject: [PATCH 3/4] More Settings menu adjustments. --- .../LanguageSettingsViewController.swift | 4 +-- .../Settings/SettingsViewController.swift | 29 ++++++++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift index 83a6756dc8..3eb8f77a62 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift @@ -130,7 +130,7 @@ class LanguageSettingsViewController: UITableViewController { doPredictionsSwitch.isOn = userDefaults.predictSettingForLanguage(languageID: self.language.id) doPredictionsSwitch.addTarget(self, action: #selector(self.predictionSwitchValueChanged), for: .valueChanged) cell.addSubview(doPredictionsSwitch) - if #available(iOSApplicationExtension 11.0, *) { + if #available(iOSApplicationExtension 9.0, *) { doPredictionsSwitch.rightAnchor.constraint(equalTo: cell.layoutMarginsGuide.rightAnchor).isActive = true doPredictionsSwitch.centerYAnchor.constraint(equalTo: cell.layoutMarginsGuide.centerYAnchor).isActive = true } @@ -145,7 +145,7 @@ class LanguageSettingsViewController: UITableViewController { doCorrectionsSwitch.isOn = userDefaults.correctSettingForLanguage(languageID: self.language.id) doCorrectionsSwitch.addTarget(self, action: #selector(self.correctionSwitchValueChanged), for: .valueChanged) cell.addSubview(doCorrectionsSwitch) - if #available(iOSApplicationExtension 11.0, *) { + if #available(iOSApplicationExtension 9.0, *) { doCorrectionsSwitch.rightAnchor.constraint(equalTo: cell.layoutMarginsGuide.rightAnchor).isActive = true doCorrectionsSwitch.centerYAnchor.constraint(equalTo: cell.layoutMarginsGuide.centerYAnchor).isActive = true } diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Settings/SettingsViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/Settings/SettingsViewController.swift index 4377a8bedc..d13d3c6200 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Settings/SettingsViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/Settings/SettingsViewController.swift @@ -118,34 +118,37 @@ open class SettingsViewController: UITableViewController { case "showbanner": cell.accessoryType = .none let showBannerSwitch = UISwitch() + showBannerSwitch.translatesAutoresizingMaskIntoConstraints = false + let switchFrame = frameAtRightOfCell(cell: cell.frame, controlSize: showBannerSwitch.frame.size) showBannerSwitch.frame = switchFrame + showBannerSwitch.isOn = false //TODO: find the setting this is to show! showBannerSwitch.addTarget(self, action: #selector(self.bannerSwitchValueChanged), for: .valueChanged) cell.addSubview(showBannerSwitch) + + if #available(iOSApplicationExtension 9.0, *) { + showBannerSwitch.rightAnchor.constraint(equalTo: cell.layoutMarginsGuide.rightAnchor).isActive = true + showBannerSwitch.centerYAnchor.constraint(equalTo: cell.layoutMarginsGuide.centerYAnchor).isActive = true + } case "showgetstarted": cell.accessoryType = .none let dontShowAgainSwitch = UISwitch() -// let rightOffset = cell.frame.size.width -// let switchWidth: CGFloat = 20 -// let switchX = rightOffset - switchWidth -// let dontShowAgainSwitch = UISwitch() -// let switchHeight = dontShowAgainSwitch.frame.size.height -// let cellSwitchHeightDiff = cell.frame.size.height - switchHeight -// let switchY = cell.frame.origin.y + 0.5 * cellSwitchHeightDiff - -// let switchFrame = CGRect(x: switchX, -// y: switchY, -// width: switchWidth, -// height: cell.frame.size.height) + dontShowAgainSwitch.translatesAutoresizingMaskIntoConstraints = false + let switchFrame = frameAtRightOfCell(cell: cell.frame, controlSize: dontShowAgainSwitch.frame.size) dontShowAgainSwitch.frame = switchFrame + dontShowAgainSwitch.isOn = dontShowGetStarted dontShowAgainSwitch.addTarget(self, action: #selector(self.showGetStartedSwitchValueChanged), for: .valueChanged) cell.addSubview(dontShowAgainSwitch) - + + if #available(iOSApplicationExtension 9.0, *) { + dontShowAgainSwitch.rightAnchor.constraint(equalTo: cell.layoutMarginsGuide.rightAnchor).isActive = true + dontShowAgainSwitch.centerYAnchor.constraint(equalTo: cell.layoutMarginsGuide.centerYAnchor).isActive = true + } default: log.error("unknown cellIdentifier(\"\(cellIdentifier ?? "EMPTY")\")") cell.accessoryType = .none From 9db04d22c8f52c61e7487f912f3c0d1c9cb97fdc Mon Sep 17 00:00:00 2001 From: jahorton Date: Thu, 8 Aug 2019 11:53:55 +0700 Subject: [PATCH 4/4] history.md --- ios/history.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ios/history.md b/ios/history.md index 7d4a43b7a7..391265438c 100644 --- a/ios/history.md +++ b/ios/history.md @@ -3,6 +3,9 @@ ## 13.0 alpha * Start version 13.0 +## 2019-08-08 12.0.12 beta +* Fixes toggle alignment issues in the Settings UI (#1947) + ## 2019-07-29 12.0.11 beta * Initial beta release of Keyman for iPhone and iPad 12 * [Pull Requests](https://github.com/keymanapp/keyman/pulls?utf8=%E2%9C%93&q=is%3Apr+merged%3A2019-02-25..2019-08-04+label%3Aios+base%3Amaster)