mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-19 14:17:40 +00:00
fix(ios): further adjust + fix language toggle logic
Some checks failed
Keyman Build Summary / Summarize build status checks (push) Has been cancelled
Some checks failed
Keyman Build Summary / Summarize build status checks (push) Has been cancelled
This commit is contained in:
parent
f1a6f6efdf
commit
ccb2e7057a
1 changed files with 10 additions and 15 deletions
|
|
@ -108,14 +108,15 @@ class LanguageSettingsViewController: UITableViewController {
|
|||
func refreshSwitchVisibility() {
|
||||
let userDefaults = Storage.active.userDefaults
|
||||
|
||||
let mayCorrect = userDefaults.correctSettingForLanguage(languageID: self.language.id)
|
||||
self.doCorrectionsSwitch?.isHidden = !mayCorrect
|
||||
self.doCorrectionsLabel?.isEnabled = mayCorrect
|
||||
let mayPredict = userDefaults.predictSettingForLanguage(languageID: self.language.id)
|
||||
self.doCorrectionsSwitch?.isHidden = !mayPredict
|
||||
self.doCorrectionsLabel?.isEnabled = mayPredict
|
||||
self.correctionsCell?.isUserInteractionEnabled = mayPredict
|
||||
|
||||
let mayAutoCorrect = userDefaults.autocorrectSettingForLanguage(languageID: self.language.id)
|
||||
self.doAutocorrectionsSwitch?.isHidden = !(mayCorrect && mayAutoCorrect)
|
||||
self.doAutocorrectionsLabel?.isEnabled = mayCorrect && mayAutoCorrect
|
||||
self.correctionsCell?.isUserInteractionEnabled = mayCorrect
|
||||
let mayCorrect = userDefaults.correctSettingForLanguage(languageID: self.language.id)
|
||||
self.doAutocorrectionsSwitch?.isHidden = !(mayPredict && mayCorrect)
|
||||
self.doAutocorrectionsLabel?.isEnabled = mayPredict && mayCorrect
|
||||
self.autocorrectionsCell?.isUserInteractionEnabled = mayPredict && mayCorrect
|
||||
}
|
||||
|
||||
@objc
|
||||
|
|
@ -195,9 +196,7 @@ class LanguageSettingsViewController: UITableViewController {
|
|||
selector: #selector(self.correctionSwitchValueChanged)
|
||||
)
|
||||
|
||||
// Disable interactivity if the prediction toggle is set to 'off'.
|
||||
doCorrectionsSwitch!.isHidden = !userDefaults.predictSettingForLanguage(languageID: self.language.id)
|
||||
cell.isUserInteractionEnabled = userDefaults.predictSettingForLanguage(languageID: self.language.id)
|
||||
refreshSwitchVisibility()
|
||||
} else if 2 == indexPath.row {
|
||||
autocorrectionsCell = cell
|
||||
doAutocorrectionsSwitch = UISwitch()
|
||||
|
|
@ -209,11 +208,7 @@ class LanguageSettingsViewController: UITableViewController {
|
|||
selector: #selector(self.autocorrectionSwitchValueChanged)
|
||||
)
|
||||
|
||||
// Disable interactivity if the prediction or correction toggle is set to 'off'.
|
||||
let mayPredict = userDefaults.predictSettingForLanguage(languageID: self.language.id)
|
||||
let mayCorrect = userDefaults.correctSettingForLanguage(languageID: self.language.id)
|
||||
doAutocorrectionsSwitch!.isHidden = !(mayPredict && mayCorrect)
|
||||
cell.isUserInteractionEnabled = mayPredict && mayCorrect
|
||||
refreshSwitchVisibility()
|
||||
} else { // rows 3 and 4
|
||||
cell.accessoryType = .disclosureIndicator
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue