mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-09 09:07:44 +00:00
Merge pull request #2475 from keymanapp/feat/ios/2357-no-dictionary-notification
feat(ios): clean message + auto-return when no dictionaries available
This commit is contained in:
commit
08178c2de5
1 changed files with 18 additions and 2 deletions
|
|
@ -308,9 +308,9 @@ class LexicalModelPickerViewController: UITableViewController, UIAlertViewDelega
|
|||
self.lexicalModelDownloadFailed(LexicalModelDownloadFailedNotification(lmOrLanguageID: self.language.id, error: error))
|
||||
}
|
||||
} else if nil == lexicalModels {
|
||||
log.info("No lexical models available for language \(language.id) (nil)")
|
||||
noModelsAvailable(cause: "nil")
|
||||
} else if 0 == lexicalModels?.count {
|
||||
log.info("No lexical models available for language \(language.id) (empty)")
|
||||
noModelsAvailable(cause: "empty")
|
||||
} else {
|
||||
log.info("Fetched lexical model list for "+language.id+".")
|
||||
// show the list of lexical models (on the main thread)
|
||||
|
|
@ -326,6 +326,22 @@ class LexicalModelPickerViewController: UITableViewController, UIAlertViewDelega
|
|||
|
||||
Manager.shared.apiLexicalModelRepository.fetchList(languageID: language.id, completionHandler: listCompletionHandler)
|
||||
}
|
||||
|
||||
func noModelsAvailable(cause: String = "nil") {
|
||||
let msg = "No dictionaries available"
|
||||
let logMsg = "No lexical models available for language \(language.id) (\(cause))"
|
||||
log.info(logMsg)
|
||||
|
||||
let alertController = UIAlertController(title: title, message: msg,
|
||||
preferredStyle: UIAlertController.Style.alert)
|
||||
alertController.addAction(UIAlertAction(title: "OK",
|
||||
style: UIAlertAction.Style.default,
|
||||
handler: { _ in
|
||||
self.navigationController?.popViewController(animated: true)
|
||||
}))
|
||||
|
||||
self.present(alertController, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue