capacitor-plugin-status-bar 2.0.7 → 2.0.8

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.
@@ -216,30 +216,23 @@ public class CapacitorStatusBar extends Plugin {
216
216
  currentStyle = style;
217
217
  currentColorHex = colorHex;
218
218
 
219
- // Set icon appearance (light/dark) regardless of background approach
219
+ // Determine icon appearance based on style
220
220
  boolean lightBackground;
221
221
  if ("LIGHT".equalsIgnoreCase(style)) {
222
- // Light background -> dark icons
223
- setLightStatusBarIcons(window, true);
224
222
  lightBackground = true;
225
223
  } else if ("DARK".equalsIgnoreCase(style)) {
226
- // Dark background -> light icons
227
- setLightStatusBarIcons(window, false);
228
224
  lightBackground = false;
229
225
  } else if ("CUSTOM".equalsIgnoreCase(style)) {
230
226
  // CUSTOM: Derive icon color from provided custom color
231
227
  int parsed = parseColorOrDefault(colorHex, Color.BLACK);
232
- boolean isLight = isEffectiveLightColor(parsed);
233
- // If background is light, request dark icons
234
- setLightStatusBarIcons(window, isLight);
235
- lightBackground = isLight;
228
+ lightBackground = isEffectiveLightColor(parsed);
236
229
  } else {
237
230
  // Default: Auto-detect based on system theme (follow device theme)
238
231
  boolean isSystemDarkMode = isSystemInDarkMode(activity);
239
- setLightStatusBarIcons(window, !isSystemDarkMode);
240
232
  lightBackground = !isSystemDarkMode;
241
233
  }
242
234
 
235
+ // Apply background colors first
243
236
  if ("CUSTOM".equalsIgnoreCase(style) && colorHex != null) {
244
237
  int color = parseColorOrDefault(colorHex, lightBackground ? Color.WHITE : Color.BLACK);
245
238
  currentStatusBarColor = color;
@@ -265,6 +258,12 @@ public class CapacitorStatusBar extends Plugin {
265
258
  applyStatusBarBackground(activity, themeColor);
266
259
  applyNavigationBarBackground(activity, themeColor);
267
260
  }
261
+
262
+ // Set icon appearance AFTER background operations.
263
+ // On Android 13 (API 33), applyStatusBarBackground triggers requestApplyInsets()
264
+ // which causes the WindowInsetsController to reset setSystemBarsAppearance.
265
+ // Calling setLightStatusBarIcons last ensures the icon style is not overridden.
266
+ setLightStatusBarIcons(window, lightBackground);
268
267
  }
269
268
 
270
269
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-plugin-status-bar",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "Capacitor plugin for managing the status bar style, visibility, and color on iOS and Android. Control overlay modes, background colors, and appearance for native mobile applications.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",