@capgo/capacitor-inappbrowser 8.6.26 → 8.6.28

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.
@@ -13,6 +13,34 @@ final class SafeAreaInsetsSupport {
13
13
  return Math.max(systemBarsBottom, Math.max(navigationBarsBottom, Math.max(systemGesturesBottom, mandatoryGesturesBottom)));
14
14
  }
15
15
 
16
+ static int resolveSafeBottomInsetWithFallback(
17
+ int systemBarsBottom,
18
+ int navigationBarsBottom,
19
+ int systemGesturesBottom,
20
+ int mandatoryGesturesBottom,
21
+ int systemBarsLeft,
22
+ int systemBarsRight,
23
+ int navigationBarsLeft,
24
+ int navigationBarsRight,
25
+ int fallbackBottomInset,
26
+ boolean applyFallbackWhenZero
27
+ ) {
28
+ int inset = resolveSafeBottomInset(systemBarsBottom, navigationBarsBottom, systemGesturesBottom, mandatoryGesturesBottom);
29
+ if (inset > 0 || !applyFallbackWhenZero || fallbackBottomInset <= 0) {
30
+ return inset;
31
+ }
32
+
33
+ if (hasSideNavigationBarInsets(systemBarsLeft, systemBarsRight, navigationBarsLeft, navigationBarsRight)) {
34
+ return 0;
35
+ }
36
+
37
+ return fallbackBottomInset;
38
+ }
39
+
40
+ static boolean hasSideNavigationBarInsets(int systemBarsLeft, int systemBarsRight, int navigationBarsLeft, int navigationBarsRight) {
41
+ return systemBarsLeft > 0 || systemBarsRight > 0 || navigationBarsLeft > 0 || navigationBarsRight > 0;
42
+ }
43
+
16
44
  static int resolveBottomMargin(boolean enabledSafeBottomMargin, int safeBottomInset, int imeBottom) {
17
45
  int bottomInset = enabledSafeBottomMargin ? safeBottomInset : 0;
18
46
  return Math.max(bottomInset, imeBottom);
@@ -2626,10 +2626,9 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
2626
2626
  }
2627
2627
  }
2628
2628
 
2629
- View coordinatorView = findViewById(R.id.coordinator_layout);
2630
- final View insetsSourceView = coordinatorView != null ? coordinatorView : _webView;
2629
+ // Resolve insets from the dialog window root; layout children can receive already-fitted zero insets.
2630
+ final View insetsSourceView = resolveSafeAreaInsetsSourceView();
2631
2631
 
2632
- // Resolve insets from the dialog root; child WebViews can receive already-fitted zero insets.
2633
2632
  ViewCompat.setOnApplyWindowInsetsListener(insetsSourceView, (v, windowInsets) -> {
2634
2633
  Insets bars = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
2635
2634
  Insets navigationBars = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars());
@@ -2738,11 +2737,18 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
2738
2737
  return;
2739
2738
  }
2740
2739
 
2741
- int safeBottomInset = SafeAreaInsetsSupport.resolveSafeBottomInset(
2740
+ int fallbackBottomInset = _options.getEnabledSafeMargin() ? getSystemNavigationBarHeight() : 0;
2741
+ int safeBottomInset = SafeAreaInsetsSupport.resolveSafeBottomInsetWithFallback(
2742
2742
  bars.bottom,
2743
2743
  navigationBars.bottom,
2744
2744
  systemGestures.bottom,
2745
- mandatoryGestures.bottom
2745
+ mandatoryGestures.bottom,
2746
+ bars.left,
2747
+ bars.right,
2748
+ navigationBars.left,
2749
+ navigationBars.right,
2750
+ fallbackBottomInset,
2751
+ _options.getEnabledSafeMargin()
2746
2752
  );
2747
2753
  int imeBottom = keyboardVisible ? ime.bottom : 0;
2748
2754
  int navTop = SafeAreaInsetsSupport.resolveTopMargin(
@@ -2759,9 +2765,30 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
2759
2765
  _webView.setLayoutParams(mlp);
2760
2766
  }
2761
2767
 
2762
- private void requestSafeAreaInsets() {
2768
+ private View resolveSafeAreaInsetsSourceView() {
2769
+ Window window = getWindow();
2770
+ if (window != null) {
2771
+ View decorView = window.getDecorView();
2772
+ if (decorView != null) {
2773
+ return decorView;
2774
+ }
2775
+ }
2776
+
2763
2777
  View coordinatorView = findViewById(R.id.coordinator_layout);
2764
- View insetsSourceView = coordinatorView != null ? coordinatorView : _webView;
2778
+ return coordinatorView != null ? coordinatorView : _webView;
2779
+ }
2780
+
2781
+ private int getSystemNavigationBarHeight() {
2782
+ int resourceId = getContext().getResources().getIdentifier("navigation_bar_height", "dimen", "android");
2783
+ if (resourceId <= 0) {
2784
+ return 0;
2785
+ }
2786
+
2787
+ return getContext().getResources().getDimensionPixelSize(resourceId);
2788
+ }
2789
+
2790
+ private void requestSafeAreaInsets() {
2791
+ View insetsSourceView = resolveSafeAreaInsetsSourceView();
2765
2792
  if (insetsSourceView == null) {
2766
2793
  return;
2767
2794
  }
@@ -98,7 +98,7 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
98
98
  case aware = "AWARE"
99
99
  case fakeVisible = "FAKE_VISIBLE"
100
100
  }
101
- private let pluginVersion: String = "8.6.26"
101
+ private let pluginVersion: String = "8.6.28"
102
102
  public let identifier = "CapgoInAppBrowserPlugin"
103
103
  public let jsName = "CapgoInAppBrowser"
104
104
  public let pluginMethods: [CAPPluginMethod] = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-inappbrowser",
3
- "version": "8.6.26",
3
+ "version": "8.6.28",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -55,8 +55,7 @@
55
55
  "maestro:test:android:keyboard": "export MAESTRO_DRIVER_STARTUP_TIMEOUT=300000 MAESTRO_CLI_NO_ANALYTICS=1 && sh ./scripts/prepare-android-maestro-device.sh && sh ./scripts/install-android-apk-with-retry.sh example-app/android/app/build/outputs/apk/debug/app-debug.apk && sh ./scripts/start-android-maestro-app.sh app.capgo.inappbrowser app.capgo.inappbrowser/.MainActivity && $HOME/.maestro/bin/maestro test -e APP_ID=app.capgo.inappbrowser example-app/.maestro/keyboard-regression-android.yaml",
56
56
  "check:wiring": "node scripts/check-capacitor-plugin-wiring.mjs",
57
57
  "example:install": "cd example-app && bun install --frozen-lockfile",
58
- "example:build": "bun run build && cd example-app && bun install --frozen-lockfile && bun run build",
59
- "example:capgo:deploy": "bun run example:build && bun scripts/deploy-example-capgo.mjs"
58
+ "example:build": "bun run build && cd example-app && bun install --frozen-lockfile && bun run build"
60
59
  },
61
60
  "devDependencies": {
62
61
  "@capacitor/android": "^8.0.0",