@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.
@@ -55,77 +55,63 @@ final class SafeAreaInsetsSupport {
55
55
  }
56
56
 
57
57
  /**
58
- * Absolute IME insets from the window decor must only be applied as layout margins when the
59
- * dialog is edge-to-edge. Pre-Android 15 windows still fit system windows and are resized for
60
- * the soft keyboard; applying decor IME height again leaves a black gap above the keyboard.
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 applyImeAsLayoutMargin) {
63
- if (!keyboardVisible || !applyImeAsLayoutMargin || imeBottom <= 0) {
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
- static int resolveBottomMargin(boolean enabledSafeBottomMargin, int safeBottomInset, int imeBottom) {
71
- int bottomInset = enabledSafeBottomMargin ? safeBottomInset : 0;
72
- return Math.max(bottomInset, imeBottom);
73
- }
74
-
75
- static int resolveTopMargin(boolean enabledSafeTopMargin, boolean useTopInset, int systemBarsTop, boolean appBarHandlesTopInset) {
76
- return resolveTopMarginWithFallback(enabledSafeTopMargin, useTopInset, systemBarsTop, appBarHandlesTopInset, 0, false);
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
- static int resolveTopMarginWithFallback(
80
- boolean enabledSafeTopMargin,
81
- boolean useTopInset,
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
- boolean appBarHandlesTopInset,
84
- int fallbackTopInset,
85
- boolean applyFallbackWhenZero
87
+ int systemBarsBottom,
88
+ int systemBarsLeft,
89
+ int systemBarsRight,
90
+ int fallbackStatusBarTop
86
91
  ) {
87
- if (!enabledSafeTopMargin || !useTopInset || appBarHandlesTopInset) {
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
- return fallbackTopInset;
96
+ boolean insetsPopulated = systemBarsBottom > 0 || systemBarsLeft > 0 || systemBarsRight > 0;
97
+ return insetsPopulated ? 0 : Math.max(0, fallbackStatusBarTop);
96
98
  }
97
99
 
98
100
  /**
99
- * Bottom padding to apply to the WebView container (a SwipeRefreshLayout, which honours its own
100
- * padding but ignores child margins). Takes the larger of the safe bottom inset and the keyboard
101
- * (IME) inset via {@link #resolveBottomMargin}, then adds a compensation term: on Android 15+ the
102
- * AppBarLayout is pushed down by the status-bar height, which shifts the container's bottom edge
103
- * off-screen by that same amount, so it must be added back as padding regardless of the options.
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