diff --git a/ios/keyman/Keyman/Keyman/Classes/InfoViewController/InfoViewController.swift b/ios/keyman/Keyman/Keyman/Classes/InfoViewController/InfoViewController.swift index 38d59ed778..5ce4a5345f 100644 --- a/ios/keyman/Keyman/Keyman/Classes/InfoViewController/InfoViewController.swift +++ b/ios/keyman/Keyman/Keyman/Classes/InfoViewController/InfoViewController.swift @@ -7,18 +7,18 @@ // import KeymanEngine -import UIKit +import WebKit import Reachability -class InfoViewController: UIViewController, UIWebViewDelegate { - @IBOutlet var webView: UIWebView! +class InfoViewController: UIViewController, WKNavigationDelegate { + @IBOutlet var webView: WKWebView! @IBOutlet var backButton: UIBarButtonItem! @IBOutlet var forwardButton: UIBarButtonItem! private var networkReachable: Reachability? - private var exitClosure: (() -> Void)? = nil; + private var exitClosure: (() -> Void)? convenience init(exitClosure: @escaping () -> Void) { if UIDevice.current.userInterfaceIdiom == .phone { @@ -33,7 +33,7 @@ class InfoViewController: UIViewController, UIWebViewDelegate { override func viewDidLoad() { super.viewDidLoad() extendedLayoutIncludesOpaqueBars = true - webView?.delegate = self + webView?.navigationDelegate = self NotificationCenter.default.addObserver(self, selector: #selector(self.networkStatusChanged), name: NSNotification.Name.reachabilityChanged, object: nil) @@ -54,17 +54,17 @@ class InfoViewController: UIViewController, UIWebViewDelegate { forwardButton.isEnabled = webView.canGoForward } - func webViewDidStartLoad(_ webView: UIWebView) { + func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { UIApplication.shared.isNetworkActivityIndicatorVisible = true updateButtons() } - func webViewDidFinishLoad(_ webView: UIWebView) { + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { UIApplication.shared.isNetworkActivityIndicatorVisible = false updateButtons() } - func webView(_ webView: UIWebView, didFailLoadWithError error: Error) { + func webView(_ webView: WKWebView, didFailNavigation error: Error) { UIApplication.shared.isNetworkActivityIndicatorVisible = false updateButtons() log.debug(error) @@ -91,7 +91,7 @@ class InfoViewController: UIViewController, UIWebViewDelegate { // Safari won't recognize the contents without the .html ending. let filePath = offlineHelpBundle.path(forResource: "index", ofType: "html", inDirectory: nil) - webView.loadRequest(URLRequest(url: URL.init(fileURLWithPath: filePath!))) + webView.load(URLRequest(url: URL.init(fileURLWithPath: filePath!))) } // Currently unused, as we haven't yet added a toggle to allow users to choose online @@ -99,7 +99,7 @@ class InfoViewController: UIViewController, UIWebViewDelegate { private func loadFromServer() { let appVersion = Version.current.majorMinor let url = "\(KeymanHosts.HELP_KEYMAN_COM)/products/iphone-and-ipad/\(appVersion.plainString)/" - webView.loadRequest(URLRequest(url: URL(string: url)!)) + webView.load(URLRequest(url: URL(string: url)!)) log.debug("Info page URL: \(url)") } } diff --git a/ios/keyman/Keyman/Keyman/Classes/InfoViewController/InfoViewController_iPad.xib b/ios/keyman/Keyman/Keyman/Classes/InfoViewController/InfoViewController_iPad.xib index d20993ca3d..44da493966 100644 --- a/ios/keyman/Keyman/Keyman/Classes/InfoViewController/InfoViewController_iPad.xib +++ b/ios/keyman/Keyman/Keyman/Classes/InfoViewController/InfoViewController_iPad.xib @@ -21,10 +21,14 @@ - + - + + + + + diff --git a/ios/keyman/Keyman/Keyman/Classes/InfoViewController/InfoViewController_iPhone.xib b/ios/keyman/Keyman/Keyman/Classes/InfoViewController/InfoViewController_iPhone.xib index d9f93d1102..7a51b762c0 100644 --- a/ios/keyman/Keyman/Keyman/Classes/InfoViewController/InfoViewController_iPhone.xib +++ b/ios/keyman/Keyman/Keyman/Classes/InfoViewController/InfoViewController_iPhone.xib @@ -26,10 +26,14 @@ - + - + + + + + diff --git a/ios/keyman/Keyman/Keyman/Classes/SetUpViewController/SetUpViewController.swift b/ios/keyman/Keyman/Keyman/Classes/SetUpViewController/SetUpViewController.swift index 74dcc55c76..cd124eba79 100644 --- a/ios/keyman/Keyman/Keyman/Classes/SetUpViewController/SetUpViewController.swift +++ b/ios/keyman/Keyman/Keyman/Classes/SetUpViewController/SetUpViewController.swift @@ -7,12 +7,12 @@ // import KeymanEngine -import UIKit +import WebKit import Reachability // TODO: Refactor common functionality from InfoViewController -class SetUpViewController: UIViewController, UIWebViewDelegate { - @IBOutlet var webView: UIWebView! +class SetUpViewController: UIViewController, WKNavigationDelegate { + @IBOutlet var webView: WKWebView! private var networkReachable: Reachability? @@ -27,7 +27,7 @@ class SetUpViewController: UIViewController, UIWebViewDelegate { let doneButton = navBar?.topItem?.rightBarButtonItem doneButton?.target = self doneButton?.action = #selector(self.dismissView) - webView?.delegate = self + webView?.navigationDelegate = self NotificationCenter.default.addObserver(self, selector: #selector(self.networkStatusChanged), name: NSNotification.Name.reachabilityChanged, object: nil) @@ -66,14 +66,14 @@ class SetUpViewController: UIViewController, UIWebViewDelegate { let filePath = offlineHelpBundle.path(forResource: "installing-system-keyboard", ofType: "html", inDirectory: "start") - webView.loadRequest(URLRequest(url: URL.init(fileURLWithPath: filePath!))) + webView.load(URLRequest(url: URL.init(fileURLWithPath: filePath!))) } private func loadFromServer() { let appVersion = Version.current.majorMinor let url = "\(KeymanHosts.HELP_KEYMAN_COM)/products/iphone-and-ipad/\(appVersion.plainString)" + "/start/installing-system-keyboard?embed=ios" - webView.loadRequest(URLRequest(url: URL(string: url)!)) + webView.load(URLRequest(url: URL(string: url)!)) log.debug("Set up page URL: \(url)") } } diff --git a/ios/keyman/Keyman/Keyman/Classes/SetUpViewController/SetUpViewController.xib b/ios/keyman/Keyman/Keyman/Classes/SetUpViewController/SetUpViewController.xib index a53d2a7972..5c7bf9bf52 100644 --- a/ios/keyman/Keyman/Keyman/Classes/SetUpViewController/SetUpViewController.xib +++ b/ios/keyman/Keyman/Keyman/Classes/SetUpViewController/SetUpViewController.xib @@ -28,10 +28,14 @@ - + - + + + + +