@capgo/capacitor-inappbrowser 8.14.2 → 8.15.0
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/README.md +23 -5
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/BundledAssetSupport.java +397 -0
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/CapgoInAppBrowserPlugin.java +42 -4
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java +39 -1
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/SafeAreaInsetsSupport.java +34 -48
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +462 -335
- package/dist/docs.json +17 -5
- package/dist/esm/bundled-asset-support.d.ts +40 -0
- package/dist/esm/bundled-asset-support.js +157 -0
- package/dist/esm/bundled-asset-support.js.map +1 -0
- package/dist/esm/definitions.d.ts +26 -4
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.js +43 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/plugin.cjs.js +199 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +199 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/InAppBrowserPlugin/BundledAssetSchemeHandler.swift +188 -0
- package/ios/Sources/InAppBrowserPlugin/BundledAssetSupport.swift +221 -0
- package/ios/Sources/InAppBrowserPlugin/InAppBrowserPlugin.swift +26 -4
- package/ios/Sources/InAppBrowserPlugin/WKWebViewController.swift +21 -0
- package/package.json +2 -2
|
@@ -55,77 +55,63 @@ final class SafeAreaInsetsSupport {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* Absolute IME insets from the window decor must only be
|
|
59
|
-
*
|
|
60
|
-
*
|
|
58
|
+
* Absolute IME insets from the window decor must only be inset when the dialog is edge-to-edge.
|
|
59
|
+
* Pre-Android 15 windows still fit system windows and are resized for the soft keyboard;
|
|
60
|
+
* applying decor IME height again leaves a black gap above the keyboard.
|
|
61
61
|
*/
|
|
62
|
-
static int resolveImeBottomInset(boolean keyboardVisible, int imeBottom, boolean
|
|
63
|
-
if (!keyboardVisible || !
|
|
62
|
+
static int resolveImeBottomInset(boolean keyboardVisible, int imeBottom, boolean applyImeInset) {
|
|
63
|
+
if (!keyboardVisible || !applyImeInset || imeBottom <= 0) {
|
|
64
64
|
return 0;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
return imeBottom;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return
|
|
70
|
+
/**
|
|
71
|
+
* Bottom padding for the WebView container (a SwipeRefreshLayout, which honours its own padding
|
|
72
|
+
* but ignores child margins): the larger of the safe bottom inset and the keyboard (IME) inset.
|
|
73
|
+
*/
|
|
74
|
+
static int resolveContainerBottomPadding(boolean applyBottomInset, int safeBottomInset, int imeBottom) {
|
|
75
|
+
int bottomInset = applyBottomInset ? safeBottomInset : 0;
|
|
76
|
+
return Math.max(0, Math.max(bottomInset, imeBottom));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
/**
|
|
80
|
+
* The status-bar height resource stands in for the reported top inset only when the whole inset
|
|
81
|
+
* set looks unpopulated, which happens on devices that hand out zeroed insets. A window that
|
|
82
|
+
* reports other insets but no top one has no status bar to avoid — a secondary multi-window
|
|
83
|
+
* window, or one whose status bar is hidden — and padding it would open a phantom gap.
|
|
84
|
+
*/
|
|
85
|
+
static int resolveStatusBarTop(
|
|
82
86
|
int systemBarsTop,
|
|
83
|
-
|
|
84
|
-
int
|
|
85
|
-
|
|
87
|
+
int systemBarsBottom,
|
|
88
|
+
int systemBarsLeft,
|
|
89
|
+
int systemBarsRight,
|
|
90
|
+
int fallbackStatusBarTop
|
|
86
91
|
) {
|
|
87
|
-
if (
|
|
88
|
-
return 0;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (systemBarsTop > 0 || !applyFallbackWhenZero || fallbackTopInset <= 0) {
|
|
92
|
+
if (systemBarsTop > 0) {
|
|
92
93
|
return systemBarsTop;
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
|
|
96
|
+
boolean insetsPopulated = systemBarsBottom > 0 || systemBarsLeft > 0 || systemBarsRight > 0;
|
|
97
|
+
return insetsPopulated ? 0 : Math.max(0, fallbackStatusBarTop);
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*/
|
|
105
|
-
static int resolveContainerBottomPadding(
|
|
106
|
-
boolean enabledSafeBottomMargin,
|
|
107
|
-
int safeBottomInset,
|
|
108
|
-
int imeBottom,
|
|
109
|
-
boolean appBarHandlesTopInset,
|
|
110
|
-
int statusBarTop
|
|
111
|
-
) {
|
|
112
|
-
int base = resolveBottomMargin(enabledSafeBottomMargin, safeBottomInset, imeBottom);
|
|
113
|
-
int appBarCompensation = appBarHandlesTopInset ? Math.max(0, statusBarTop) : 0;
|
|
114
|
-
return base + appBarCompensation;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Top padding for the WebView container. When the AppBarLayout handles the top inset it already
|
|
119
|
-
* sits below the status bar, so no additional padding is needed; otherwise the status-bar height
|
|
120
|
-
* is applied when the safe-top options request it.
|
|
101
|
+
* Top padding for the WebView container. When a visible AppBarLayout handles the top inset it
|
|
102
|
+
* already sits below the status bar, so no additional padding is needed. Otherwise nothing
|
|
103
|
+
* consumes the status bar on edge-to-edge windows (Android 15+, blank or hidden toolbar), so the
|
|
104
|
+
* status-bar height is applied whenever enabledSafeTopMargin is on (#655). Windows that still fit
|
|
105
|
+
* system windows keep the legacy useTopInset opt-in to avoid padding twice.
|
|
121
106
|
*/
|
|
122
107
|
static int resolveContainerTopPadding(
|
|
123
108
|
boolean enabledSafeTopMargin,
|
|
124
109
|
boolean useTopInset,
|
|
125
110
|
int statusBarTop,
|
|
126
|
-
boolean appBarHandlesTopInset
|
|
111
|
+
boolean appBarHandlesTopInset,
|
|
112
|
+
boolean isEdgeToEdge
|
|
127
113
|
) {
|
|
128
|
-
if (appBarHandlesTopInset || !enabledSafeTopMargin || !useTopInset) {
|
|
114
|
+
if (appBarHandlesTopInset || !enabledSafeTopMargin || (!useTopInset && !isEdgeToEdge)) {
|
|
129
115
|
return 0;
|
|
130
116
|
}
|
|
131
117
|
|