@capgo/capacitor-inappbrowser 8.16.3 → 8.16.4

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.
@@ -41,14 +41,14 @@ final class SystemUiChromeSupport {
41
41
  WindowCompat.setDecorFitsSystemWindows(window, decorFitsSystemWindows);
42
42
  }
43
43
 
44
- static void prepareInitialDialogWindow(Window window) {
44
+ static void prepareInitialDialogWindow(Window window, View statusBarColorView) {
45
45
  if (window == null) {
46
46
  return;
47
47
  }
48
48
 
49
49
  window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
50
50
  if (shouldApplyLegacySystemBarColors(Build.VERSION.SDK_INT)) {
51
- applyLegacySystemBarColors(window, Color.TRANSPARENT, null);
51
+ applyLegacyStatusBarColorViaView(statusBarColorView, Color.TRANSPARENT);
52
52
  clearLegacyTranslucentStatusFlag(window);
53
53
  }
54
54
  }
@@ -56,9 +56,9 @@ final class SystemUiChromeSupport {
56
56
  static void applyDialogWindowChrome(
57
57
  Window window,
58
58
  View decorView,
59
+ View statusBarColorView,
59
60
  boolean edgeToEdge,
60
61
  Integer statusBarColor,
61
- Integer navigationBarColor,
62
62
  Boolean lightStatusBars
63
63
  ) {
64
64
  if (window == null || decorView == null) {
@@ -69,10 +69,10 @@ final class SystemUiChromeSupport {
69
69
  setDecorFitsSystemWindows(window, false);
70
70
  } else if (!shouldUsePreApi30LayoutFlags(Build.VERSION.SDK_INT)) {
71
71
  setDecorFitsSystemWindows(window, true);
72
- applyLegacySystemBarColors(window, statusBarColor, navigationBarColor);
72
+ applyLegacyStatusBarColorViaView(statusBarColorView, statusBarColor);
73
73
  } else {
74
- applyPreApi30LayoutBehindNavigationBar(decorView);
75
- applyLegacySystemBarColors(window, statusBarColor, navigationBarColor);
74
+ setDecorFitsSystemWindows(window, false);
75
+ applyLegacyStatusBarColorViaView(statusBarColorView, statusBarColor);
76
76
  }
77
77
 
78
78
  WindowInsetsControllerCompat controller = new WindowInsetsControllerCompat(window, decorView);
@@ -81,22 +81,13 @@ final class SystemUiChromeSupport {
81
81
  }
82
82
  }
83
83
 
84
- @SuppressWarnings("deprecation")
85
- private static void applyPreApi30LayoutBehindNavigationBar(View decorView) {
86
- decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
87
- }
88
-
89
- @SuppressWarnings("deprecation")
90
- static void applyLegacySystemBarColors(Window window, Integer statusBarColor, Integer navigationBarColor) {
91
- if (window == null || !shouldApplyLegacySystemBarColors(Build.VERSION.SDK_INT)) {
84
+ static void applyLegacyStatusBarColorViaView(View statusBarColorView, Integer statusBarColor) {
85
+ if (!shouldApplyLegacySystemBarColors(Build.VERSION.SDK_INT)) {
92
86
  return;
93
87
  }
94
88
 
95
- if (statusBarColor != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
96
- window.setStatusBarColor(statusBarColor);
97
- }
98
- if (navigationBarColor != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
99
- window.setNavigationBarColor(navigationBarColor);
89
+ if (statusBarColor != null && statusBarColorView != null) {
90
+ statusBarColorView.setBackgroundColor(statusBarColor);
100
91
  }
101
92
  }
102
93
 
@@ -1,6 +1,10 @@
1
1
  package ee.forgr.capacitor_inappbrowser;
2
2
 
3
3
  import android.view.View;
4
+ import android.view.Window;
5
+ import androidx.core.view.WindowCompat;
6
+ import androidx.core.view.WindowInsetsCompat;
7
+ import androidx.core.view.WindowInsetsControllerCompat;
4
8
 
5
9
  /**
6
10
  * Testable helpers for HTML5/iframe fullscreen routed through WebChromeClient custom views
@@ -22,16 +26,28 @@ final class WebViewCustomFullscreenSupport {
22
26
  return isActive;
23
27
  }
24
28
 
25
- @SuppressWarnings("deprecation")
26
- static int immersiveFullscreenSystemUiVisibility() {
27
- return (
28
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
29
- View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
30
- View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
31
- View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
32
- View.SYSTEM_UI_FLAG_FULLSCREEN |
33
- View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
34
- );
29
+ static int immersiveSystemBarsBehavior() {
30
+ return WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;
31
+ }
32
+
33
+ static void enterImmersiveFullscreen(Window window, View decorView) {
34
+ if (window == null || decorView == null) {
35
+ return;
36
+ }
37
+
38
+ WindowCompat.setDecorFitsSystemWindows(window, false);
39
+ WindowInsetsControllerCompat controller = new WindowInsetsControllerCompat(window, decorView);
40
+ controller.hide(WindowInsetsCompat.Type.systemBars());
41
+ controller.setSystemBarsBehavior(immersiveSystemBarsBehavior());
42
+ }
43
+
44
+ static void exitImmersiveFullscreen(Window window, View decorView) {
45
+ if (window == null || decorView == null) {
46
+ return;
47
+ }
48
+
49
+ WindowInsetsControllerCompat controller = new WindowInsetsControllerCompat(window, decorView);
50
+ controller.show(WindowInsetsCompat.Type.systemBars());
35
51
  }
36
52
 
37
53
  static boolean shouldUseHostActivityWindow(boolean backLayerActive) {
@@ -41,9 +57,4 @@ final class WebViewCustomFullscreenSupport {
41
57
  static boolean shouldRegisterHostBackHandler(boolean backLayerActive) {
42
58
  return backLayerActive;
43
59
  }
44
-
45
- @SuppressWarnings("deprecation")
46
- static int restoredSystemUiVisibility() {
47
- return View.SYSTEM_UI_FLAG_VISIBLE;
48
- }
49
60
  }
@@ -2172,7 +2172,7 @@ public class WebViewDialog extends ComponentDialog implements ProxyResponseRouti
2172
2172
  // Set dimensions if specified, otherwise fullscreen
2173
2173
  applyDimensions();
2174
2174
 
2175
- SystemUiChromeSupport.prepareInitialDialogWindow(getWindow());
2175
+ SystemUiChromeSupport.prepareInitialDialogWindow(getWindow(), findViewById(R.id.status_bar_color_view));
2176
2176
 
2177
2177
  WindowInsetsControllerCompat insetsController = new WindowInsetsControllerCompat(
2178
2178
  getWindow(),
@@ -3020,7 +3020,7 @@ public class WebViewDialog extends ComponentDialog implements ProxyResponseRouti
3020
3020
  }
3021
3021
 
3022
3022
  window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
3023
- decorView.setSystemUiVisibility(WebViewCustomFullscreenSupport.immersiveFullscreenSystemUiVisibility());
3023
+ WebViewCustomFullscreenSupport.enterImmersiveFullscreen(window, decorView);
3024
3024
 
3025
3025
  if (WebViewCustomFullscreenSupport.shouldRegisterHostBackHandler(backLayerActive)) {
3026
3026
  registerCustomFullscreenBackHandler();
@@ -3078,7 +3078,7 @@ public class WebViewDialog extends ComponentDialog implements ProxyResponseRouti
3078
3078
  Window window = customFullscreenWindow != null ? customFullscreenWindow : getWindow();
3079
3079
  if (window != null) {
3080
3080
  window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
3081
- window.getDecorView().setSystemUiVisibility(WebViewCustomFullscreenSupport.restoredSystemUiVisibility());
3081
+ WebViewCustomFullscreenSupport.exitImmersiveFullscreen(window, window.getDecorView());
3082
3082
  reapplyInsetsFromWindowRoot();
3083
3083
  if (SystemUiChromeSupport.requiresEdgeToEdgeChrome(Build.VERSION.SDK_INT)) {
3084
3084
  refreshEdgeToEdgeChrome();
@@ -3275,7 +3275,6 @@ public class WebViewDialog extends ComponentDialog implements ProxyResponseRouti
3275
3275
  if (getWindow() != null) {
3276
3276
  View decorView = getWindow().getDecorView();
3277
3277
  Integer statusBarColor = null;
3278
- Integer navigationBarColor = Color.TRANSPARENT;
3279
3278
  Boolean lightStatusBars = null;
3280
3279
 
3281
3280
  if (isAndroid15Plus) {
@@ -3316,9 +3315,9 @@ public class WebViewDialog extends ComponentDialog implements ProxyResponseRouti
3316
3315
  SystemUiChromeSupport.applyDialogWindowChrome(
3317
3316
  getWindow(),
3318
3317
  decorView,
3318
+ findViewById(R.id.status_bar_color_view),
3319
3319
  isAndroid15Plus,
3320
3320
  statusBarColor,
3321
- navigationBarColor,
3322
3321
  lightStatusBars
3323
3322
  );
3324
3323
  }
@@ -4913,7 +4912,7 @@ public class WebViewDialog extends ComponentDialog implements ProxyResponseRouti
4913
4912
 
4914
4913
  // Also ensure status bar gets the color
4915
4914
  if (getWindow() != null) {
4916
- SystemUiChromeSupport.applyLegacySystemBarColors(getWindow(), toolbarColor, null);
4915
+ SystemUiChromeSupport.applyLegacyStatusBarColorViaView(findViewById(R.id.status_bar_color_view), toolbarColor);
4917
4916
 
4918
4917
  // Determine proper status bar text color (light or dark icons)
4919
4918
  boolean isDarkBackground = isDarkColor(toolbarColor);
@@ -446,7 +446,7 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
446
446
  case aware = "AWARE"
447
447
  case fakeVisible = "FAKE_VISIBLE"
448
448
  }
449
- private let pluginVersion: String = "8.16.3"
449
+ private let pluginVersion: String = "8.16.4"
450
450
  public let identifier = "CapgoInAppBrowserPlugin"
451
451
  public let jsName = "CapgoInAppBrowser"
452
452
  public let pluginMethods: [CAPPluginMethod] = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-inappbrowser",
3
- "version": "8.16.3",
3
+ "version": "8.16.4",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",