From 93ff4e0886d4f5a64f6927fdf6d672140bea6fcd Mon Sep 17 00:00:00 2001 From: jahorton Date: Wed, 24 Mar 2021 14:02:42 +0700 Subject: [PATCH] fix(ios): fixes sys-kbd setup help link for iOS 9 and 10 --- .../SetUpViewController.swift | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ios/keyman/Keyman/Keyman/SetUpViewController/SetUpViewController.swift b/ios/keyman/Keyman/Keyman/SetUpViewController/SetUpViewController.swift index 3520c88ba3..e36f9203e9 100644 --- a/ios/keyman/Keyman/Keyman/SetUpViewController/SetUpViewController.swift +++ b/ios/keyman/Keyman/Keyman/SetUpViewController/SetUpViewController.swift @@ -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)") }