PR comments

This commit is contained in:
Gabriel Wong 2017-09-14 12:24:00 +07:00
parent 136e08b2f1
commit 962de68cb0
6 changed files with 37 additions and 17 deletions

View file

@ -11,9 +11,9 @@ import UIKit
let htmlMailFormat =
"<html><head><style type=\"text/css\">pre {font-family:\"%@\";font-size:%@;}</style>" +
"</head><body><pre>%@</pre>%@</body></html>"
let mailFooterTextForPad = "<br><br>Sent from&nbsp<a href=\"http://keyman.com/ipad\">Keyman for iPad</a>"
let mailFooterTextForPhone = "<br><br>Sent from&nbsp<a href=\"http://keyman.com/iphone\">Keyman for iPhone</a>"
let fbText = "Can't read this? Help at http://keyman.com/fonts"
let mailFooterTextForPad = "<br><br>Sent from&nbsp;<a href=\"https://keyman.com/ipad\">Keyman for iPad</a>"
let mailFooterTextForPhone = "<br><br>Sent from&nbsp;<a href=\"https://keyman.com/iphone\">Keyman for iPhone</a>"
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: "&lt;").replacingOccurrences(of: ">", with: "&gt;")
let mailText = text.replacingOccurrences(of: "&", with: "&amp;")
.replacingOccurrences(of: "<", with: "&lt;")
.replacingOccurrences(of: ">", with: "&gt;")
let familyName = font.familyName
let fontSize = String(Int(font.pointSize))
let footerText: String

View file

@ -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.

View file

@ -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
}
}

View file

@ -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()
}

View file

@ -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

View file

@ -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
}
}