@capgo/capacitor-inappbrowser 8.13.0 → 8.13.2

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.
@@ -94,4 +94,40 @@ final class SafeAreaInsetsSupport {
94
94
 
95
95
  return fallbackTopInset;
96
96
  }
97
+
98
+ /**
99
+ * Bottom padding to apply to the WebView container (a SwipeRefreshLayout, which honours its own
100
+ * padding but ignores child margins). Combines the resolved safe bottom inset with a compensation
101
+ * term: on Android 15+ the AppBarLayout is pushed down by the status-bar height, which shifts the
102
+ * container's bottom edge off-screen by that same amount, so it must be added back as padding
103
+ * regardless of the safe-margin option.
104
+ */
105
+ static int resolveContainerBottomPadding(
106
+ boolean enabledSafeBottomMargin,
107
+ int safeBottomInset,
108
+ boolean appBarHandlesTopInset,
109
+ int statusBarTop
110
+ ) {
111
+ int base = enabledSafeBottomMargin ? Math.max(0, safeBottomInset) : 0;
112
+ int appBarCompensation = appBarHandlesTopInset ? Math.max(0, statusBarTop) : 0;
113
+ return base + appBarCompensation;
114
+ }
115
+
116
+ /**
117
+ * Top padding for the WebView container. When the AppBarLayout handles the top inset it already
118
+ * sits below the status bar, so no additional padding is needed; otherwise the status-bar height
119
+ * is applied when the safe-top options request it.
120
+ */
121
+ static int resolveContainerTopPadding(
122
+ boolean enabledSafeTopMargin,
123
+ boolean useTopInset,
124
+ int statusBarTop,
125
+ boolean appBarHandlesTopInset
126
+ ) {
127
+ if (appBarHandlesTopInset || !enabledSafeTopMargin || !useTopInset) {
128
+ return 0;
129
+ }
130
+
131
+ return Math.max(0, statusBarTop);
132
+ }
97
133
  }
@@ -3147,6 +3147,9 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
3147
3147
  }
3148
3148
 
3149
3149
  requestSafeAreaInsets();
3150
+
3151
+ mainHandler.postDelayed(this::applyContainerInsetsSnapshot, 300);
3152
+ mainHandler.postDelayed(this::applyContainerInsetsSnapshot, 1200);
3150
3153
  }
3151
3154
 
3152
3155
  private void applySafeAreaMargins(
@@ -3202,6 +3205,76 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
3202
3205
  mlp.rightMargin = bars.right;
3203
3206
  _webView.setLayoutParams(mlp);
3204
3207
  injectSafeAreaCssVariables(navTop, bottomMargin, bars.left, bars.right);
3208
+ applyContainerInsetsSnapshot();
3209
+ }
3210
+
3211
+ private void applyContainerInsetsSnapshot() {
3212
+ if (_options == null || _webView == null) {
3213
+ return;
3214
+ }
3215
+
3216
+ View container = findViewById(R.id.content_browser_layout);
3217
+ if (container == null) {
3218
+ return;
3219
+ }
3220
+
3221
+ Window window = getWindow();
3222
+ View decorView = window != null ? window.getDecorView() : null;
3223
+ WindowInsetsCompat windowInsets = decorView != null ? ViewCompat.getRootWindowInsets(decorView) : null;
3224
+
3225
+ Insets bars = windowInsets != null ? windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) : Insets.NONE;
3226
+ Insets navigationBars = windowInsets != null ? windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars()) : Insets.NONE;
3227
+ Insets systemGestures = windowInsets != null ? windowInsets.getInsets(WindowInsetsCompat.Type.systemGestures()) : Insets.NONE;
3228
+ Insets mandatoryGestures =
3229
+ windowInsets != null ? windowInsets.getInsets(WindowInsetsCompat.Type.mandatorySystemGestures()) : Insets.NONE;
3230
+
3231
+ boolean isAndroid15Plus = Build.VERSION.SDK_INT >= 35;
3232
+ View toolbarView = findViewById(R.id.tool_bar);
3233
+ boolean appBarHandlesTopInset =
3234
+ isAndroid15Plus &&
3235
+ !TextUtils.equals(_options.getToolbarType(), "blank") &&
3236
+ toolbarView != null &&
3237
+ toolbarView.getVisibility() == View.VISIBLE &&
3238
+ toolbarView.getParent() instanceof com.google.android.material.appbar.AppBarLayout;
3239
+
3240
+ int statusBarTop = bars.top > 0 ? bars.top : getSystemStatusBarHeight();
3241
+ int fallbackBottomInset = _options.getEnabledSafeMargin() ? getSystemNavigationBarHeight() : 0;
3242
+ int safeBottomInset = SafeAreaInsetsSupport.resolveSafeBottomInsetWithFallback(
3243
+ bars.bottom,
3244
+ navigationBars.bottom,
3245
+ systemGestures.bottom,
3246
+ mandatoryGestures.bottom,
3247
+ bars.left,
3248
+ bars.right,
3249
+ navigationBars.left,
3250
+ navigationBars.right,
3251
+ fallbackBottomInset,
3252
+ _options.getEnabledSafeMargin()
3253
+ );
3254
+
3255
+ int padTop = SafeAreaInsetsSupport.resolveContainerTopPadding(
3256
+ _options.getEnabledSafeTopMargin(),
3257
+ _options.getUseTopInset(),
3258
+ statusBarTop,
3259
+ appBarHandlesTopInset
3260
+ );
3261
+ int padBottom = SafeAreaInsetsSupport.resolveContainerBottomPadding(
3262
+ _options.getEnabledSafeMargin(),
3263
+ safeBottomInset,
3264
+ appBarHandlesTopInset,
3265
+ statusBarTop
3266
+ );
3267
+
3268
+ if (
3269
+ container.getPaddingLeft() == bars.left &&
3270
+ container.getPaddingTop() == padTop &&
3271
+ container.getPaddingRight() == bars.right &&
3272
+ container.getPaddingBottom() == padBottom
3273
+ ) {
3274
+ return;
3275
+ }
3276
+
3277
+ container.setPadding(bars.left, padTop, bars.right, padBottom);
3205
3278
  }
3206
3279
 
3207
3280
  private void configureBlankToolbarLayout() {
@@ -3285,7 +3358,10 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
3285
3358
  }
3286
3359
 
3287
3360
  ViewCompat.requestApplyInsets(insetsSourceView);
3288
- insetsSourceView.post(() -> ViewCompat.requestApplyInsets(insetsSourceView));
3361
+ insetsSourceView.post(() -> {
3362
+ ViewCompat.requestApplyInsets(insetsSourceView);
3363
+ applyContainerInsetsSnapshot();
3364
+ });
3289
3365
  }
3290
3366
 
3291
3367
  public void postMessageToJS(Object detail) {
@@ -320,7 +320,7 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
320
320
  case aware = "AWARE"
321
321
  case fakeVisible = "FAKE_VISIBLE"
322
322
  }
323
- private let pluginVersion: String = "8.13.0"
323
+ private let pluginVersion: String = "8.13.2"
324
324
  public let identifier = "CapgoInAppBrowserPlugin"
325
325
  public let jsName = "CapgoInAppBrowser"
326
326
  public let pluginMethods: [CAPPluginMethod] = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-inappbrowser",
3
- "version": "8.13.0",
3
+ "version": "8.13.2",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -68,7 +68,7 @@
68
68
  "@ionic/prettier-config": "^4.0.0",
69
69
  "@ionic/swiftlint-config": "^2.0.0",
70
70
  "@types/node": "^24.10.1",
71
- "esbuild": "^0.27.3",
71
+ "esbuild": "^0.28.0",
72
72
  "eslint": "^8.57.1",
73
73
  "eslint-plugin-import": "^2.31.0",
74
74
  "husky": "^9.1.7",