@capgo/inappbrowser 8.1.4 → 8.1.5
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.
|
@@ -50,7 +50,7 @@ import org.json.JSONObject;
|
|
|
50
50
|
)
|
|
51
51
|
public class InAppBrowserPlugin extends Plugin implements WebViewDialog.PermissionHandler {
|
|
52
52
|
|
|
53
|
-
private final String pluginVersion = "8.1.
|
|
53
|
+
private final String pluginVersion = "8.1.5";
|
|
54
54
|
|
|
55
55
|
public static final String CUSTOM_TAB_PACKAGE_NAME = "com.android.chrome"; // Change when in stable
|
|
56
56
|
private CustomTabsClient customTabsClient;
|
|
@@ -404,6 +404,8 @@ public class WebViewDialog extends Dialog {
|
|
|
404
404
|
applyInsets();
|
|
405
405
|
|
|
406
406
|
_webView.addJavascriptInterface(new JavaScriptInterface(), "AndroidInterface");
|
|
407
|
+
// Provide window.mobileApp at document start via native interface
|
|
408
|
+
_webView.addJavascriptInterface(new JavaScriptInterface(), "mobileApp");
|
|
407
409
|
_webView.addJavascriptInterface(new PreShowScriptInterface(), "PreShowScriptInterface");
|
|
408
410
|
_webView.addJavascriptInterface(new PrintInterface(this._context, _webView), "PrintInterface");
|
|
409
411
|
_webView.getSettings().setJavaScriptEnabled(true);
|
|
@@ -1286,27 +1288,27 @@ public class WebViewDialog extends Dialog {
|
|
|
1286
1288
|
String script = String.format(
|
|
1287
1289
|
"""
|
|
1288
1290
|
(function() {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1291
|
+
// Prefer AndroidInterface when available, otherwise fall back to native window.mobileApp
|
|
1292
|
+
var nativeBridge = window.AndroidInterface || window.mobileApp;
|
|
1293
|
+
if (nativeBridge) {
|
|
1294
|
+
// Wrap native bridge to normalize behavior (stringify objects, expose close/hide/show)
|
|
1295
|
+
window.mobileApp = {
|
|
1296
|
+
postMessage: function(message) {
|
|
1297
|
+
try {
|
|
1298
|
+
var msg = typeof message === 'string' ? message : JSON.stringify(message);
|
|
1299
|
+
nativeBridge.postMessage(msg);
|
|
1300
|
+
} catch(e) {
|
|
1301
|
+
console.error('Error in mobileApp.postMessage:', e);
|
|
1302
|
+
}
|
|
1303
|
+
},
|
|
1304
|
+
close: function() {
|
|
1305
|
+
try {
|
|
1306
|
+
nativeBridge.close();
|
|
1307
|
+
} catch(e) {
|
|
1308
|
+
console.error('Error in mobileApp.close:', e);
|
|
1309
|
+
}
|
|
1310
|
+
}%s
|
|
1311
|
+
};
|
|
1310
1312
|
}
|
|
1311
1313
|
// Override window.print function to use our PrintInterface
|
|
1312
1314
|
if (window.PrintInterface) {
|
|
@@ -28,7 +28,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
28
28
|
case aware = "AWARE"
|
|
29
29
|
case fakeVisible = "FAKE_VISIBLE"
|
|
30
30
|
}
|
|
31
|
-
private let pluginVersion: String = "8.1.
|
|
31
|
+
private let pluginVersion: String = "8.1.5"
|
|
32
32
|
public let identifier = "InAppBrowserPlugin"
|
|
33
33
|
public let jsName = "InAppBrowser"
|
|
34
34
|
public let pluginMethods: [CAPPluginMethod] = [
|