fix(ios): fixes sys-kbd setup help link for iOS 9 and 10

This commit is contained in:
jahorton 2021-03-24 14:02:42 +07:00
parent 785cf0448d
commit 93ff4e0886

View file

@ -44,12 +44,15 @@ class SetUpViewController: UIViewController, UIWebViewDelegate {
}
func reloadKeymanHelp() {
let networkStatus = networkReachable?.connection
switch networkStatus {
case Reachability.Connection.none?:
if let networkStatus = networkReachable?.connection {
switch networkStatus {
case Reachability.Connection.none, Reachability.Connection.unavailable:
loadFromLocal()
default:
loadFromServer()
}
} else {
loadFromLocal()
default:
loadFromServer()
}
}
@ -62,16 +65,16 @@ class SetUpViewController: UIViewController, UIWebViewDelegate {
// Yes, .php.html. That's how `wget` is set to retrieve it, since Safari won't recognize the contents
// without the .html ending, it seems.
let filePath = offlineHelpBundle.path(forResource: "installing-system-keyboard.php",
let filePath = offlineHelpBundle.path(forResource: "installing-system-keyboard",
ofType: "html",
inDirectory: nil)
inDirectory: "start")
webView.loadRequest(URLRequest(url: URL.init(fileURLWithPath: filePath!)))
}
private func loadFromServer() {
let appVersion = Version.current.majorMinor
let url = "https://help.keyman.com/products/iphone-and-ipad/\(appVersion.plainString)"
+ "/installing-system-keyboard.php?embed=ios"
+ "/start/installing-system-keyboard"
webView.loadRequest(URLRequest(url: URL(string: url)!))
log.debug("Set up page URL: \(url)")
}