diff --git a/ios/keyman/Keyman/Keyman/ActivityItemProvider.swift b/ios/keyman/Keyman/Keyman/ActivityItemProvider.swift
index 85af252448..a6a757a49c 100644
--- a/ios/keyman/Keyman/Keyman/ActivityItemProvider.swift
+++ b/ios/keyman/Keyman/Keyman/ActivityItemProvider.swift
@@ -11,9 +11,9 @@ import UIKit
let htmlMailFormat =
"
" +
"%@
%@"
-let mailFooterTextForPad = "
Sent from Keyman for iPad"
-let mailFooterTextForPhone = "
Sent from Keyman for iPhone"
-let fbText = "Can't read this? Help at http://keyman.com/fonts"
+let mailFooterTextForPad = "
Sent from Keyman for iPad"
+let mailFooterTextForPhone = "
Sent from Keyman for iPhone"
+let fbText = "Can't read this? Help at https://keyman.com/fonts"
// Prepares the share text
class ActivityItemProvider: UIActivityItemProvider {
@@ -43,7 +43,9 @@ class ActivityItemProvider: UIActivityItemProvider {
}
func htmlMail(withText text: String, font: UIFont) -> String {
- let mailText = text.replacingOccurrences(of: "<", with: "<").replacingOccurrences(of: ">", with: ">")
+ let mailText = text.replacingOccurrences(of: "&", with: "&")
+ .replacingOccurrences(of: "<", with: "<")
+ .replacingOccurrences(of: ">", with: ">")
let familyName = font.familyName
let fontSize = String(Int(font.pointSize))
let footerText: String
diff --git a/ios/keyman/Keyman/Keyman/AppDelegate.swift b/ios/keyman/Keyman/Keyman/AppDelegate.swift
index 88289d80a9..a5288e73bb 100644
--- a/ios/keyman/Keyman/Keyman/AppDelegate.swift
+++ b/ios/keyman/Keyman/Keyman/AppDelegate.swift
@@ -19,9 +19,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
- Thread.sleep(forTimeInterval: 1.0)
-
window = UIWindow(frame: UIScreen.main.bounds)
+
+ // Initialize overlayWindow
_ = overlayWindow
// Override point for customization after application launch.
diff --git a/ios/keyman/Keyman/Keyman/InfoViewController/InfoViewController.swift b/ios/keyman/Keyman/Keyman/InfoViewController/InfoViewController.swift
index ec1715ce86..1006a234fa 100644
--- a/ios/keyman/Keyman/Keyman/InfoViewController/InfoViewController.swift
+++ b/ios/keyman/Keyman/Keyman/InfoViewController/InfoViewController.swift
@@ -56,6 +56,8 @@ class InfoViewController: UIViewController, UIWebViewDelegate {
}
let url = "http://keyman.com/iphone-and-ipad/app/?active=\(currentKeyboardId)&installed=\(installedKeyboards)"
webView.loadRequest(URLRequest(url: URL(string: url)!))
- NSLog("Info page URL: %@", url)
+ #if DEBUG
+ NSLog("Info page URL: %@", url)
+ #endif
}
}
diff --git a/ios/keyman/Keyman/Keyman/KMWebBrowser/WebBrowserViewController.swift b/ios/keyman/Keyman/Keyman/KMWebBrowser/WebBrowserViewController.swift
index 41c3b836d7..0f491cd14b 100644
--- a/ios/keyman/Keyman/Keyman/KMWebBrowser/WebBrowserViewController.swift
+++ b/ios/keyman/Keyman/Keyman/KMWebBrowser/WebBrowserViewController.swift
@@ -23,8 +23,8 @@ class WebBrowserViewController: UIViewController, UIWebViewDelegate, UIAlertView
@IBOutlet var globeButton: UIBarButtonItem!
@IBOutlet var closeButton: UIBarButtonItem!
- var fontFamily: String = UIFont.systemFont(ofSize: UIFont.systemFontSize).fontName
- var newFontFamily: String = ""
+ var fontFamily = UIFont.systemFont(ofSize: UIFont.systemFontSize).fontName
+ var newFontFamily = ""
let webBrowserLastURLKey = "KMWebBrowserLastURL"
@@ -170,7 +170,9 @@ class WebBrowserViewController: UIViewController, UIWebViewDelegate, UIAlertView
func loadAddress(_ sender: Any, event: UIEvent) {
guard let urlString = addressField?.text, var url = URL(string: urlString) else {
- NSLog("Attempting to load invalid URL: %@", addressField?.text ?? "nil")
+ #if DEBUG
+ NSLog("Attempting to load invalid URL: %@", addressField?.text ?? "nil")
+ #endif
return
}
if url.scheme == nil {
@@ -273,7 +275,7 @@ class WebBrowserViewController: UIViewController, UIWebViewDelegate, UIAlertView
}
func keyboardPickerDismissed(_ notification: Notification) {
- if !(newFontFamily == fontFamily) {
+ if newFontFamily != fontFamily {
fontFamily = newFontFamily
webView?.reload()
}
diff --git a/ios/keyman/Keyman/Keyman/MainViewController.swift b/ios/keyman/Keyman/Keyman/MainViewController.swift
index 08e561922c..cb359a277e 100644
--- a/ios/keyman/Keyman/Keyman/MainViewController.swift
+++ b/ios/keyman/Keyman/Keyman/MainViewController.swift
@@ -59,6 +59,10 @@ class MainViewController: UIViewController, KMTextViewDelegate, UIActionSheetDel
return UIApplication.shared.delegate as? AppDelegate
}
+ var overlayWindow: UIWindow! {
+ return appDelegate?.overlayWindow
+ }
+
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
@@ -539,7 +543,7 @@ class MainViewController: UIViewController, KMTextViewDelegate, UIActionSheetDel
func keyboardPickerDismissed(_ notification: Notification) {
textView.becomeFirstResponder()
- if UIDevice.current.userInterfaceIdiom == .pad {
+ if UIDevice.current.userInterfaceIdiom == .pad && shouldShowGetStarted() {
perform(#selector(self.showGetStartedView), with: nil, afterDelay: 1.0)
}
}
@@ -772,10 +776,6 @@ class MainViewController: UIViewController, KMTextViewDelegate, UIActionSheetDel
present(alert, animated: true, completion: nil)
}
- var overlayWindow: UIWindow! {
- return appDelegate?.overlayWindow
- }
-
func showActivityIndicator() {
if !overlayWindow.isHidden && overlayWindow.viewWithTag(activityIndicatorViewTag) != nil {
return
diff --git a/ios/keyman/Keyman/Keyman/SetUpViewController/SetUpViewController.swift b/ios/keyman/Keyman/Keyman/SetUpViewController/SetUpViewController.swift
index 9406ada445..853b1930ba 100644
--- a/ios/keyman/Keyman/Keyman/SetUpViewController/SetUpViewController.swift
+++ b/ios/keyman/Keyman/Keyman/SetUpViewController/SetUpViewController.swift
@@ -66,6 +66,20 @@ class SetUpViewController: UIViewController, UIWebViewDelegate {
let url = "http://keyman.com/iphone-and-ipad/app/systemkeyboard/index.php" +
"?active=\(currentKeyboardId)&installed=\(installedKeyboards)"
webView.loadRequest(URLRequest(url: URL(string: url)!))
- NSLog("Set up page URL: %@", url)
+ #if DEBUG
+ NSLog("Set up page URL: %@", url)
+ #endif
+ }
+
+ func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest,
+ navigationType: UIWebViewNavigationType) -> Bool {
+ if navigationType == UIWebViewNavigationType.linkClicked {
+ if let url = request.url {
+ UIApplication.shared.openURL(url)
+ }
+ return false
+ }
+
+ return true
}
}