@capgo/capacitor-inappbrowser 8.14.1 → 8.14.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.
|
@@ -3013,30 +3013,7 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
3013
3013
|
final View insetsSourceView = resolveSafeAreaInsetsSourceView();
|
|
3014
3014
|
|
|
3015
3015
|
ViewCompat.setOnApplyWindowInsetsListener(insetsSourceView, (v, windowInsets) -> {
|
|
3016
|
-
|
|
3017
|
-
Insets navigationBars = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars());
|
|
3018
|
-
Insets systemGestures = windowInsets.getInsets(WindowInsetsCompat.Type.systemGestures());
|
|
3019
|
-
Insets mandatoryGestures = windowInsets.getInsets(WindowInsetsCompat.Type.mandatorySystemGestures());
|
|
3020
|
-
Insets ime = windowInsets.getInsets(WindowInsetsCompat.Type.ime());
|
|
3021
|
-
boolean keyboardVisible = windowInsets.isVisible(WindowInsetsCompat.Type.ime());
|
|
3022
|
-
|
|
3023
|
-
boolean appBarHandlesTopInset =
|
|
3024
|
-
isAndroid15Plus &&
|
|
3025
|
-
!TextUtils.equals(_options.getToolbarType(), "blank") &&
|
|
3026
|
-
toolbarView != null &&
|
|
3027
|
-
toolbarView.getVisibility() == View.VISIBLE &&
|
|
3028
|
-
toolbarView.getParent() instanceof com.google.android.material.appbar.AppBarLayout;
|
|
3029
|
-
applySafeAreaMargins(
|
|
3030
|
-
bars,
|
|
3031
|
-
navigationBars,
|
|
3032
|
-
systemGestures,
|
|
3033
|
-
mandatoryGestures,
|
|
3034
|
-
ime,
|
|
3035
|
-
keyboardVisible,
|
|
3036
|
-
appBarHandlesTopInset,
|
|
3037
|
-
isAndroid15Plus
|
|
3038
|
-
);
|
|
3039
|
-
|
|
3016
|
+
applyWindowInsetsToWebView(windowInsets, isAndroid15Plus, toolbarView);
|
|
3040
3017
|
return windowInsets;
|
|
3041
3018
|
});
|
|
3042
3019
|
requestSafeAreaInsets();
|
|
@@ -3209,6 +3186,7 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
3209
3186
|
|
|
3210
3187
|
if (isHiddenModeActive) {
|
|
3211
3188
|
requestSafeAreaInsets();
|
|
3189
|
+
reapplyInsetsFromWindowRoot();
|
|
3212
3190
|
return;
|
|
3213
3191
|
}
|
|
3214
3192
|
|
|
@@ -3235,21 +3213,24 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
3235
3213
|
}
|
|
3236
3214
|
|
|
3237
3215
|
if (swipeRefreshLayout != null) {
|
|
3216
|
+
swipeRefreshLayout.setRefreshing(false);
|
|
3238
3217
|
swipeRefreshLayout.requestLayout();
|
|
3239
3218
|
}
|
|
3240
3219
|
|
|
3241
3220
|
_webView.requestLayout();
|
|
3242
3221
|
_webView.invalidate();
|
|
3243
3222
|
requestSafeAreaInsets();
|
|
3223
|
+
reapplyInsetsFromWindowRoot();
|
|
3244
3224
|
|
|
3245
|
-
mainHandler.post(this::
|
|
3246
|
-
mainHandler.postDelayed(this::
|
|
3247
|
-
mainHandler.postDelayed(this::
|
|
3225
|
+
mainHandler.post(this::reapplyInsetsFromWindowRoot);
|
|
3226
|
+
mainHandler.postDelayed(this::reapplyInsetsFromWindowRoot, 100);
|
|
3227
|
+
mainHandler.postDelayed(this::reapplyInsetsFromWindowRoot, 300);
|
|
3248
3228
|
|
|
3249
3229
|
_webView.post(() -> {
|
|
3250
3230
|
if (_webView == null) {
|
|
3251
3231
|
return;
|
|
3252
3232
|
}
|
|
3233
|
+
requestWebViewContentRelayout();
|
|
3253
3234
|
_webView.evaluateJavascript("(function(){window.dispatchEvent(new Event('resize'));})();", null);
|
|
3254
3235
|
});
|
|
3255
3236
|
}
|
|
@@ -3340,6 +3321,80 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
3340
3321
|
});
|
|
3341
3322
|
}
|
|
3342
3323
|
|
|
3324
|
+
private void applyWindowInsetsToWebView(WindowInsetsCompat windowInsets, boolean isAndroid15Plus, View toolbarView) {
|
|
3325
|
+
if (windowInsets == null || _options == null) {
|
|
3326
|
+
return;
|
|
3327
|
+
}
|
|
3328
|
+
|
|
3329
|
+
Insets bars = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
|
|
3330
|
+
Insets navigationBars = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars());
|
|
3331
|
+
Insets systemGestures = windowInsets.getInsets(WindowInsetsCompat.Type.systemGestures());
|
|
3332
|
+
Insets mandatoryGestures = windowInsets.getInsets(WindowInsetsCompat.Type.mandatorySystemGestures());
|
|
3333
|
+
Insets ime = windowInsets.getInsets(WindowInsetsCompat.Type.ime());
|
|
3334
|
+
boolean keyboardVisible = windowInsets.isVisible(WindowInsetsCompat.Type.ime());
|
|
3335
|
+
|
|
3336
|
+
boolean appBarHandlesTopInset =
|
|
3337
|
+
isAndroid15Plus &&
|
|
3338
|
+
!TextUtils.equals(_options.getToolbarType(), "blank") &&
|
|
3339
|
+
toolbarView != null &&
|
|
3340
|
+
toolbarView.getVisibility() == View.VISIBLE &&
|
|
3341
|
+
toolbarView.getParent() instanceof com.google.android.material.appbar.AppBarLayout;
|
|
3342
|
+
|
|
3343
|
+
applySafeAreaMargins(
|
|
3344
|
+
bars,
|
|
3345
|
+
navigationBars,
|
|
3346
|
+
systemGestures,
|
|
3347
|
+
mandatoryGestures,
|
|
3348
|
+
ime,
|
|
3349
|
+
keyboardVisible,
|
|
3350
|
+
appBarHandlesTopInset,
|
|
3351
|
+
isAndroid15Plus
|
|
3352
|
+
);
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
/**
|
|
3356
|
+
* Re-read root window insets and apply WebView margins plus container padding.
|
|
3357
|
+
* Dialog windows may not re-dispatch inset listeners after rotation, leaving stale
|
|
3358
|
+
* portrait margins that break vertical scrolling in landscape.
|
|
3359
|
+
*/
|
|
3360
|
+
private void reapplyInsetsFromWindowRoot() {
|
|
3361
|
+
if (_webView == null || _options == null) {
|
|
3362
|
+
return;
|
|
3363
|
+
}
|
|
3364
|
+
|
|
3365
|
+
Window window = getWindow();
|
|
3366
|
+
View decorView = window != null ? window.getDecorView() : null;
|
|
3367
|
+
if (decorView == null) {
|
|
3368
|
+
return;
|
|
3369
|
+
}
|
|
3370
|
+
|
|
3371
|
+
WindowInsetsCompat windowInsets = ViewCompat.getRootWindowInsets(decorView);
|
|
3372
|
+
if (windowInsets == null) {
|
|
3373
|
+
// Root insets not ready yet; do not mutate margins/padding (would desync WebView
|
|
3374
|
+
// margins from container padding). Delayed retries and requestApplyInsets will retry.
|
|
3375
|
+
return;
|
|
3376
|
+
}
|
|
3377
|
+
|
|
3378
|
+
boolean isAndroid15Plus = Build.VERSION.SDK_INT >= 35;
|
|
3379
|
+
View toolbarView = findViewById(R.id.tool_bar);
|
|
3380
|
+
applyWindowInsetsToWebView(windowInsets, isAndroid15Plus, toolbarView);
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
private void requestWebViewContentRelayout() {
|
|
3384
|
+
View container = findViewById(R.id.content_browser_layout);
|
|
3385
|
+
if (container != null) {
|
|
3386
|
+
container.requestLayout();
|
|
3387
|
+
container.invalidate();
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
if (_webView == null) {
|
|
3391
|
+
return;
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
_webView.requestLayout();
|
|
3395
|
+
_webView.invalidate();
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3343
3398
|
private void applySafeAreaMargins(
|
|
3344
3399
|
Insets bars,
|
|
3345
3400
|
Insets navigationBars,
|
|
@@ -3554,7 +3609,7 @@ public class WebViewDialog extends Dialog implements ProxyResponseRouting.ProxyR
|
|
|
3554
3609
|
ViewCompat.requestApplyInsets(insetsSourceView);
|
|
3555
3610
|
insetsSourceView.post(() -> {
|
|
3556
3611
|
ViewCompat.requestApplyInsets(insetsSourceView);
|
|
3557
|
-
|
|
3612
|
+
reapplyInsetsFromWindowRoot();
|
|
3558
3613
|
});
|
|
3559
3614
|
}
|
|
3560
3615
|
|
|
@@ -415,7 +415,7 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
415
415
|
case aware = "AWARE"
|
|
416
416
|
case fakeVisible = "FAKE_VISIBLE"
|
|
417
417
|
}
|
|
418
|
-
private let pluginVersion: String = "8.14.
|
|
418
|
+
private let pluginVersion: String = "8.14.2"
|
|
419
419
|
public let identifier = "CapgoInAppBrowserPlugin"
|
|
420
420
|
public let jsName = "CapgoInAppBrowser"
|
|
421
421
|
public let pluginMethods: [CAPPluginMethod] = [
|