mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-06 14:07:32 +00:00
iOS now uses package version for models
This commit is contained in:
parent
cb25aeba6a
commit
dcd7c1cb08
1 changed files with 14 additions and 1 deletions
|
|
@ -697,11 +697,24 @@ public class Manager: NSObject, UIGestureRecognizerDelegate {
|
|||
let data = try Data(contentsOf: path, options: .mappedIfSafe)
|
||||
let jsonResult = try JSONSerialization.jsonObject(with: data, options: .mutableLeaves)
|
||||
if let jsonResult = jsonResult as? [String:AnyObject] {
|
||||
var version: String = "error"
|
||||
|
||||
if let info = jsonResult["info"] as? [String:AnyObject] {
|
||||
if let versionEntry = info["version"] as? [String:AnyObject] {
|
||||
if let description = versionEntry["description"] as? String {
|
||||
version = description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if version == "error" {
|
||||
throw KMPError.invalidPackage
|
||||
}
|
||||
|
||||
if let lexicalModels = jsonResult["lexicalModels"] as? [[String:AnyObject]] {
|
||||
for k in lexicalModels {
|
||||
let name = k["name"] as! String
|
||||
let lexicalModelID = k["id"] as! String
|
||||
let version = k["version"] as! String
|
||||
|
||||
//TODO: handle errors if languages do not exist
|
||||
//var languageName = ""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue