@capgo/capacitor-inappbrowser 8.16.5 → 8.16.6
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.
package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewBackNavigationSupport.java
CHANGED
|
@@ -25,7 +25,9 @@ final class WebViewBackNavigationSupport {
|
|
|
25
25
|
/**
|
|
26
26
|
* When {@code disableGoBackOnNativeApplication} is true, the dialog must not be cancelable on
|
|
27
27
|
* back/gesture. Otherwise {@link androidx.activity.ComponentDialog}'s built-in back callback
|
|
28
|
-
* dismisses the dialog before our handler can return {@link Action#IGNORE}.
|
|
28
|
+
* dismisses the dialog before our handler can return {@link Action#IGNORE}. While cancelable is
|
|
29
|
+
* false that built-in callback still consumes back without dismissing, so {@link WebViewDialog}
|
|
30
|
+
* must keep its own callback registered last on the dispatcher.
|
|
29
31
|
*/
|
|
30
32
|
static boolean isCancelableOnBack(boolean disableGoBackOnNativeApplication) {
|
|
31
33
|
return !disableGoBackOnNativeApplication;
|
|
@@ -469,7 +469,9 @@ public class WebViewDialog extends ComponentDialog implements ProxyResponseRouti
|
|
|
469
469
|
@Override
|
|
470
470
|
protected void onStart() {
|
|
471
471
|
super.onStart();
|
|
472
|
-
|
|
472
|
+
// ComponentDialog registers its own back callback in onCreate; re-add ours last so
|
|
473
|
+
// handleBrowserBackNavigation runs before the built-in cancel callback (LIFO order).
|
|
474
|
+
ensureDialogBackHandlerOnTop();
|
|
473
475
|
}
|
|
474
476
|
|
|
475
477
|
@Override
|
|
@@ -2921,6 +2923,19 @@ public class WebViewDialog extends ComponentDialog implements ProxyResponseRouti
|
|
|
2921
2923
|
if (dialogBackCallback != null) {
|
|
2922
2924
|
return;
|
|
2923
2925
|
}
|
|
2926
|
+
ensureDialogBackHandlerOnTop();
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
/**
|
|
2930
|
+
* Re-register the dialog back callback so it sits above {@link ComponentDialog}'s built-in
|
|
2931
|
+
* callback. That callback is always enabled and consumes back without dismissing when
|
|
2932
|
+
* {@link #setCancelable(boolean)} is false, which would block webview history navigation.
|
|
2933
|
+
*/
|
|
2934
|
+
private void ensureDialogBackHandlerOnTop() {
|
|
2935
|
+
if (dialogBackCallback != null) {
|
|
2936
|
+
dialogBackCallback.remove();
|
|
2937
|
+
dialogBackCallback = null;
|
|
2938
|
+
}
|
|
2924
2939
|
// Predictive back (API 33+) never delivers KEYCODE_BACK to Dialog OnKeyListener.
|
|
2925
2940
|
dialogBackCallback = new OnBackPressedCallback(false) {
|
|
2926
2941
|
@Override
|
|
@@ -2949,7 +2964,11 @@ public class WebViewDialog extends ComponentDialog implements ProxyResponseRouti
|
|
|
2949
2964
|
void applyBackNavigationPolicy() {
|
|
2950
2965
|
boolean disableGoBack = _options != null && _options.getDisableGoBackOnNativeApplication();
|
|
2951
2966
|
setCancelable(WebViewBackNavigationSupport.isCancelableOnBack(disableGoBack));
|
|
2952
|
-
|
|
2967
|
+
if (isShowing()) {
|
|
2968
|
+
ensureDialogBackHandlerOnTop();
|
|
2969
|
+
} else {
|
|
2970
|
+
syncBackNavigationHandlers();
|
|
2971
|
+
}
|
|
2953
2972
|
}
|
|
2954
2973
|
|
|
2955
2974
|
private void syncBackNavigationHandlers() {
|
|
@@ -446,7 +446,7 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
446
446
|
case aware = "AWARE"
|
|
447
447
|
case fakeVisible = "FAKE_VISIBLE"
|
|
448
448
|
}
|
|
449
|
-
private let pluginVersion: String = "8.16.
|
|
449
|
+
private let pluginVersion: String = "8.16.6"
|
|
450
450
|
public let identifier = "CapgoInAppBrowserPlugin"
|
|
451
451
|
public let jsName = "CapgoInAppBrowser"
|
|
452
452
|
public let pluginMethods: [CAPPluginMethod] = [
|