mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-06 14:07:32 +00:00
fix(ios): kbd search now caches publishing data for result
This commit is contained in:
parent
6c0bf45350
commit
c5ee153c79
2 changed files with 19 additions and 0 deletions
|
|
@ -190,6 +190,16 @@ public class KeymanPackage {
|
|||
distributionMethod = downloadURL != nil ? .cloud : .unknown
|
||||
self.downloadURL = downloadURL
|
||||
}
|
||||
|
||||
// Used to store metadata for newly-downloaded results from the keyboard search.
|
||||
// To save a version, we require also having a known URL.
|
||||
internal init(downloadURL: URL, version: Version) {
|
||||
self.timestampForLastQuery = NSDate().timeIntervalSince1970
|
||||
self.latestVersion = version.fullString
|
||||
self.downloadURL = downloadURL
|
||||
|
||||
distributionMethod = .cloud
|
||||
}
|
||||
}
|
||||
|
||||
static private let kmpFile = "kmp.json"
|
||||
|
|
|
|||
|
|
@ -254,6 +254,15 @@ public class KeyboardSearchViewController: UIViewController, WKNavigationDelegat
|
|||
// Illegal state - we already checked this.
|
||||
fatalError()
|
||||
}
|
||||
|
||||
// We've likely installed the package, and we already know
|
||||
// the package's current publishing state - we literally just
|
||||
// downloaded it from the cloud as part of the keyboard search.
|
||||
//
|
||||
// Why query later when we know the query's answer NOW?
|
||||
let publishState = KeymanPackage.DistributionStateMetadata(downloadURL: packageURL, version: package.version)
|
||||
|
||||
Storage.active.userDefaults.cachedPackageQueryMetadata[package.key] = publishState
|
||||
}
|
||||
|
||||
downloadManager.downloadPackage(withKey: packageKey, from: packageURL, withNotifications: true, completionBlock: downloadClosure)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue