diff --git a/ios/build.sh b/ios/build.sh index 11aa500d0e..4f96ec5f83 100755 --- a/ios/build.sh +++ b/ios/build.sh @@ -12,6 +12,7 @@ display_usage ( ) { echo " -clean Removes all previously-existing build products for KMEI and the Keyman app before building." echo " -no-kmw Uses existing keyman.js, doesn't try to build" echo " -only-framework Builds only the KeymanEngine framework; does not attempt to build the app." + echo " -no-carthage Disables downloading and building for dependencies." echo " -no-codesign Disables code-signing for the Keyman application, allowing it to be performed separately later." echo " Will not construct the archive and .ipa. (includes -no-archive)" echo " -no-archive Bypasses the archive and .ipa preparation stage." diff --git a/ios/engine/KMEI/KeymanEngine/Classes/KeymanWebViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/KeymanWebViewController.swift index 5ebf8d786c..713f70c10d 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/KeymanWebViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/KeymanWebViewController.swift @@ -78,7 +78,21 @@ extension KeymanWebViewController { // FIXME: text is unused in the JS func executePopupKey(id: String, text: String) { - webView.evaluateJavaScript("executePopupKey('\(id)','\(text)');", completionHandler: nil) + //var escapedText: String; + // Text must be checked for ', ", and \ characters; they must be escaped properly! + do { + let encodingArray = [ text ]; + let jsonString = try String(data: JSONSerialization.data(withJSONObject: encodingArray), encoding: .utf8)! + let start = jsonString.index(jsonString.startIndex, offsetBy: 2) + let end = jsonString.index(jsonString.endIndex, offsetBy: -2) + let escapedText = jsonString[start..