define and use the constant InstallableConstants.defaultVersion instead of a magic string

This commit is contained in:
Randy Boring 2019-06-05 17:41:31 -05:00
parent 7e3e6adfb8
commit 27f3736bee
2 changed files with 6 additions and 2 deletions

View file

@ -1221,7 +1221,7 @@ public class Manager: NSObject, HTTPDownloadDelegate, UIGestureRecognizerDelegat
downloadQueue!.userInfo = commonUserData
let request = HTTPDownloadRequest(url: lexicalModelURL, userInfo: commonUserData)
request.destinationFile = Storage.active.lexicalModelURL(forID: lexicalModel.id, version: lexicalModel.version ?? "0.1.0").path
request.destinationFile = Storage.active.lexicalModelURL(forID: lexicalModel.id, version: lexicalModel.version ?? InstallableConstants.defaultVersion).path
request.tag = 0
downloadQueue!.addRequest(request)

View file

@ -8,6 +8,10 @@
import Foundation
struct InstallableConstants {
static let defaultVersion = "0.1.0"
}
/// Mainly differs from the API `LexicalModel` by having an associated language.
public struct InstallableLexicalModel: Codable {
public var id: String
@ -38,7 +42,7 @@ public struct InstallableLexicalModel: Codable {
self.name = lexicalModel.name
self.languageID = languageID
// self.languageName = language.name
self.version = lexicalModel.version ?? "0.1.0"
self.version = lexicalModel.version ?? InstallableConstants.defaultVersion
self.isCustom = isCustom
}
}