@capgo/inappbrowser 6.8.9 → 6.8.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -272,16 +272,16 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
272
272
|
|
|
273
273
|
func injectJavaScriptInterface() {
|
|
274
274
|
let script = """
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
275
|
+
if (!window.mobileApp) {
|
|
276
|
+
window.mobileApp = {
|
|
277
|
+
postMessage: function(message) {
|
|
278
|
+
if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.messageHandler) {
|
|
279
|
+
window.webkit.messageHandlers.messageHandler.postMessage(message);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
};
|
|
281
283
|
}
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
"""
|
|
284
|
+
"""
|
|
285
285
|
DispatchQueue.main.async {
|
|
286
286
|
self.webView?.evaluateJavaScript(script, completionHandler: nil)
|
|
287
287
|
}
|
|
@@ -850,18 +850,18 @@ extension WKWebViewController: WKNavigationDelegate {
|
|
|
850
850
|
|
|
851
851
|
// TODO: implement interface
|
|
852
852
|
let script = """
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
853
|
+
async function preShowFunction() {
|
|
854
|
+
\(self.preShowScript ?? "")
|
|
855
|
+
};
|
|
856
|
+
preShowFunction().then(
|
|
857
|
+
() => window.webkit.messageHandlers.preShowScriptSuccess.postMessage({})
|
|
858
|
+
).catch(
|
|
859
|
+
err => {
|
|
860
|
+
console.error('Preshow error', err);
|
|
861
|
+
window.webkit.messageHandlers.preShowScriptError.postMessage(JSON.stringify(err, Object.getOwnPropertyNames(err)));
|
|
862
|
+
}
|
|
863
|
+
)
|
|
864
|
+
"""
|
|
865
865
|
print("[InAppBrowser - InjectPreShowScript] PreShowScript script: \(script)")
|
|
866
866
|
|
|
867
867
|
self.preShowSemaphore = DispatchSemaphore(value: 0)
|
|
@@ -975,11 +975,16 @@ extension WKWebViewController: WKNavigationDelegate {
|
|
|
975
975
|
actionPolicy = .preventDeeplinkActionPolicy
|
|
976
976
|
}
|
|
977
977
|
|
|
978
|
-
|
|
978
|
+
guard let u = navigationAction.request.url else {
|
|
979
979
|
decisionHandler(actionPolicy)
|
|
980
|
+
return
|
|
980
981
|
}
|
|
981
|
-
|
|
982
|
-
|
|
982
|
+
|
|
983
|
+
// Check if the URL is an App Store URL
|
|
984
|
+
if u.absoluteString.contains("apps.apple.com") {
|
|
985
|
+
UIApplication.shared.open(u, options: [:], completionHandler: nil)
|
|
986
|
+
// Cancel the navigation in the web view
|
|
987
|
+
decisionHandler(.cancel)
|
|
983
988
|
return
|
|
984
989
|
}
|
|
985
990
|
|
|
@@ -1003,6 +1008,7 @@ extension WKWebViewController: WKNavigationDelegate {
|
|
|
1003
1008
|
actionPolicy = result ? .allow : .cancel
|
|
1004
1009
|
}
|
|
1005
1010
|
self.injectJavaScriptInterface()
|
|
1011
|
+
decisionHandler(actionPolicy)
|
|
1006
1012
|
}
|
|
1007
1013
|
}
|
|
1008
1014
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/inappbrowser",
|
|
3
|
-
"version": "6.8.
|
|
3
|
+
"version": "6.8.12",
|
|
4
4
|
"description": "Capacitor plugin in app browser",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"src": "android"
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
|
-
"packageManager": "pnpm@9.
|
|
82
|
+
"packageManager": "pnpm@9.12.2+sha512.22721b3a11f81661ae1ec68ce1a7b879425a1ca5b991c975b074ac220b187ce56c708fe5db69f4c962c989452eee76c82877f4ee80f474cebd61ee13461b6228"
|
|
83
83
|
}
|