capacitor-plugin-status-bar 2.0.3 → 2.0.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.
- package/Package.swift +6 -6
- package/android/src/main/java/com/cap/plugins/statusbar/{StatusBar.java → CapacitorStatusBar.java} +82 -54
- package/android/src/main/java/com/cap/plugins/statusbar/{StatusBarPlugin.java → CapacitorStatusBarPlugin.java} +3 -3
- package/dist/docs.json +2 -2
- package/dist/esm/definitions.d.ts +1 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +1 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +5 -5
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +5 -5
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/{StatusBarPlugin/StatusBar.swift → CapacitorStatusBarPlugin/CapacitorStatusBar.swift} +24 -24
- package/ios/Sources/{StatusBarPlugin/StatusBarPlugin.swift → CapacitorStatusBarPlugin/CapacitorStatusBarPlugin.swift} +5 -5
- package/ios/Tests/{StatusBarPluginTests/StatusBarPluginTests.swift → CapacitorStatusBarPluginTests/CapacitorStatusBarPluginTests.swift} +3 -3
- package/package.json +2 -2
package/Package.swift
CHANGED
|
@@ -7,22 +7,22 @@ let package = Package(
|
|
|
7
7
|
products: [
|
|
8
8
|
.library(
|
|
9
9
|
name: "CapacitorPluginStatusBar",
|
|
10
|
-
targets: ["
|
|
10
|
+
targets: ["CapacitorStatusBarPlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
13
|
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
|
|
14
14
|
],
|
|
15
15
|
targets: [
|
|
16
16
|
.target(
|
|
17
|
-
name: "
|
|
17
|
+
name: "CapacitorStatusBarPlugin",
|
|
18
18
|
dependencies: [
|
|
19
19
|
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
20
|
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
21
|
],
|
|
22
|
-
path: "ios/Sources/
|
|
22
|
+
path: "ios/Sources/CapacitorStatusBarPlugin"),
|
|
23
23
|
.testTarget(
|
|
24
|
-
name: "
|
|
25
|
-
dependencies: ["
|
|
26
|
-
path: "ios/Tests/
|
|
24
|
+
name: "CapacitorStatusBarPluginTests",
|
|
25
|
+
dependencies: ["CapacitorStatusBarPlugin"],
|
|
26
|
+
path: "ios/Tests/CapacitorStatusBarPluginTests")
|
|
27
27
|
]
|
|
28
28
|
)
|
package/android/src/main/java/com/cap/plugins/statusbar/{StatusBar.java → CapacitorStatusBar.java}
RENAMED
|
@@ -31,8 +31,8 @@ import com.getcapacitor.Plugin;
|
|
|
31
31
|
* - API 35+ (Android 15+): Fully compatible with edge-to-edge display
|
|
32
32
|
* enforcement
|
|
33
33
|
*/
|
|
34
|
-
public class
|
|
35
|
-
private static final String TAG = "
|
|
34
|
+
public class CapacitorStatusBar extends Plugin {
|
|
35
|
+
private static final String TAG = "CapacitorStatusBar";
|
|
36
36
|
private static final String STATUS_BAR_OVERLAY_TAG = "capacitor_status_bar_overlay";
|
|
37
37
|
private static final String NAV_BAR_OVERLAY_TAG = "capacitor_navigation_bar_overlay";
|
|
38
38
|
|
|
@@ -42,9 +42,9 @@ public class StatusBar extends Plugin {
|
|
|
42
42
|
private int currentStatusBarColor = Color.BLACK;
|
|
43
43
|
private int currentNavBarColor = Color.BLACK;
|
|
44
44
|
|
|
45
|
-
// Note: load() is not called since
|
|
46
|
-
// from
|
|
47
|
-
// All initialization happens via ensureEdgeToEdgeConfigured() called from
|
|
45
|
+
// Note: load() is not called since CapacitorStatusBar is instantiated via new CapacitorStatusBar()
|
|
46
|
+
// from CapacitorStatusBarPlugin, not registered as a Capacitor plugin itself.
|
|
47
|
+
// All initialization happens via ensureEdgeToEdgeConfigured() called from CapacitorStatusBarPlugin.load().
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Ensures edge-to-edge is properly configured for Android 15+.
|
|
@@ -57,50 +57,58 @@ public class StatusBar extends Plugin {
|
|
|
57
57
|
Window window = activity.getWindow();
|
|
58
58
|
View decorView = window.getDecorView();
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
WindowCompat.setDecorFitsSystemWindows(window, false);
|
|
60
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
|
61
|
+
// Android 15+ (API 35+): Full edge-to-edge with overlay views
|
|
62
|
+
WindowCompat.setDecorFitsSystemWindows(window, false);
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
64
|
+
// Make native bar colors transparent so our overlays are the sole color source
|
|
65
|
+
window.setStatusBarColor(Color.TRANSPARENT);
|
|
66
|
+
window.setNavigationBarColor(Color.TRANSPARENT);
|
|
69
67
|
window.setStatusBarContrastEnforced(false);
|
|
70
68
|
window.setNavigationBarContrastEnforced(false);
|
|
71
|
-
}
|
|
72
69
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
// Single unified insets listener on decorView for overlay sizing
|
|
71
|
+
ViewCompat.setOnApplyWindowInsetsListener(decorView, (v, insets) -> {
|
|
72
|
+
// Size status bar overlay
|
|
73
|
+
int top = insets.getInsets(WindowInsetsCompat.Type.statusBars()).top;
|
|
74
|
+
View statusOverlay = ((ViewGroup) v).findViewWithTag(STATUS_BAR_OVERLAY_TAG);
|
|
75
|
+
if (statusOverlay != null) {
|
|
76
|
+
ViewGroup.LayoutParams params = statusOverlay.getLayoutParams();
|
|
77
|
+
if (params.height != top) {
|
|
78
|
+
params.height = top;
|
|
79
|
+
statusOverlay.setLayoutParams(params);
|
|
80
|
+
Log.d(TAG, "insetsListener: status bar overlay height=" + top);
|
|
81
|
+
}
|
|
84
82
|
}
|
|
85
|
-
}
|
|
86
83
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
// Size navigation bar overlay
|
|
85
|
+
int bottom = insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom;
|
|
86
|
+
View navOverlay = ((ViewGroup) v).findViewWithTag(NAV_BAR_OVERLAY_TAG);
|
|
87
|
+
if (navOverlay != null) {
|
|
88
|
+
ViewGroup.LayoutParams params = navOverlay.getLayoutParams();
|
|
89
|
+
if (params.height != bottom) {
|
|
90
|
+
params.height = bottom;
|
|
91
|
+
navOverlay.setLayoutParams(params);
|
|
92
|
+
Log.d(TAG, "insetsListener: nav bar overlay height=" + bottom);
|
|
93
|
+
}
|
|
96
94
|
}
|
|
97
|
-
}
|
|
98
95
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
ViewCompat.onApplyWindowInsets(v, insets);
|
|
97
|
+
return insets;
|
|
98
|
+
});
|
|
102
99
|
|
|
103
|
-
|
|
100
|
+
Log.d(TAG, "ensureEdgeToEdgeConfigured: edge-to-edge with overlay views, API=" + Build.VERSION.SDK_INT);
|
|
101
|
+
} else {
|
|
102
|
+
// Android < 15: Only disable contrast enforcement.
|
|
103
|
+
// Do NOT call setDecorFitsSystemWindows(false), create overlay views, or set insets listener.
|
|
104
|
+
// This avoids conflicts with plugins like @capawesome/capacitor-android-edge-to-edge-support.
|
|
105
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
106
|
+
window.setStatusBarContrastEnforced(false);
|
|
107
|
+
window.setNavigationBarContrastEnforced(false);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
Log.d(TAG, "ensureEdgeToEdgeConfigured: contrast enforcement disabled only, API=" + Build.VERSION.SDK_INT);
|
|
111
|
+
}
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
public void setOverlaysWebView(Activity activity, boolean overlay) {
|
|
@@ -382,15 +390,25 @@ public class StatusBar extends Plugin {
|
|
|
382
390
|
|
|
383
391
|
private void applyStatusBarBackground(Activity activity, @ColorInt int color) {
|
|
384
392
|
Log.d(TAG, "applyStatusBarBackground: color=#" + Integer.toHexString(color) + ", API=" + Build.VERSION.SDK_INT);
|
|
385
|
-
|
|
386
|
-
|
|
393
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
|
394
|
+
// Android 15+: Use overlay views
|
|
395
|
+
ensureStatusBarOverlay(activity, color);
|
|
396
|
+
} else {
|
|
397
|
+
// Android < 15: Use native window API directly
|
|
398
|
+
activity.getWindow().setStatusBarColor(color);
|
|
399
|
+
}
|
|
387
400
|
}
|
|
388
401
|
|
|
389
402
|
private void applyNavigationBarBackground(Activity activity, @ColorInt int color) {
|
|
390
403
|
Log.d(TAG, "applyNavigationBarBackground: color=#" + Integer.toHexString(color) + ", API="
|
|
391
404
|
+ Build.VERSION.SDK_INT);
|
|
392
|
-
|
|
393
|
-
|
|
405
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
|
406
|
+
// Android 15+: Use overlay views
|
|
407
|
+
ensureNavBarOverlay(activity, color);
|
|
408
|
+
} else {
|
|
409
|
+
// Android < 15: Use native window API directly
|
|
410
|
+
activity.getWindow().setNavigationBarColor(color);
|
|
411
|
+
}
|
|
394
412
|
}
|
|
395
413
|
|
|
396
414
|
private void ensureStatusBarOverlay(Activity activity, @ColorInt int color) {
|
|
@@ -504,18 +522,28 @@ public class StatusBar extends Plugin {
|
|
|
504
522
|
*/
|
|
505
523
|
private void makeStatusBarBackgroundTransparent(Activity activity) {
|
|
506
524
|
Log.d(TAG, "makeStatusBarBackgroundTransparent: API=" + Build.VERSION.SDK_INT);
|
|
507
|
-
ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
|
|
508
525
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
Log.d(TAG, "makeStatusBarBackgroundTransparent: status bar overlay made transparent");
|
|
513
|
-
}
|
|
526
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
|
527
|
+
// Android 15+: Set overlay backgrounds to transparent
|
|
528
|
+
ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
|
|
514
529
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
530
|
+
View statusBarOverlay = decorView.findViewWithTag(STATUS_BAR_OVERLAY_TAG);
|
|
531
|
+
if (statusBarOverlay != null) {
|
|
532
|
+
statusBarOverlay.setBackgroundColor(Color.TRANSPARENT);
|
|
533
|
+
Log.d(TAG, "makeStatusBarBackgroundTransparent: status bar overlay made transparent");
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
View navBarOverlay = decorView.findViewWithTag(NAV_BAR_OVERLAY_TAG);
|
|
537
|
+
if (navBarOverlay != null) {
|
|
538
|
+
navBarOverlay.setBackgroundColor(Color.TRANSPARENT);
|
|
539
|
+
Log.d(TAG, "makeStatusBarBackgroundTransparent: navigation bar overlay made transparent");
|
|
540
|
+
}
|
|
541
|
+
} else {
|
|
542
|
+
// Android < 15: Use native window API directly
|
|
543
|
+
Window window = activity.getWindow();
|
|
544
|
+
window.setStatusBarColor(Color.TRANSPARENT);
|
|
545
|
+
window.setNavigationBarColor(Color.TRANSPARENT);
|
|
546
|
+
Log.d(TAG, "makeStatusBarBackgroundTransparent: set native bar colors to transparent");
|
|
519
547
|
}
|
|
520
548
|
}
|
|
521
549
|
|
|
@@ -5,9 +5,9 @@ import com.getcapacitor.PluginCall;
|
|
|
5
5
|
import com.getcapacitor.PluginMethod;
|
|
6
6
|
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
7
7
|
|
|
8
|
-
@CapacitorPlugin(name = "
|
|
9
|
-
public class
|
|
10
|
-
private final
|
|
8
|
+
@CapacitorPlugin(name = "CapacitorStatusBar")
|
|
9
|
+
public class CapacitorStatusBarPlugin extends Plugin {
|
|
10
|
+
private final CapacitorStatusBar implementation = new CapacitorStatusBar();
|
|
11
11
|
|
|
12
12
|
@Override
|
|
13
13
|
public void load() {
|
package/dist/docs.json
CHANGED
|
@@ -47,7 +47,7 @@ export declare type SafeAreaInsets = {
|
|
|
47
47
|
left: number;
|
|
48
48
|
right: number;
|
|
49
49
|
};
|
|
50
|
-
export interface
|
|
50
|
+
export interface CapacitorStatusBarPlugin {
|
|
51
51
|
/**
|
|
52
52
|
* Set the status bar and navigation bar style and color.
|
|
53
53
|
* @param options - The options to set the status bar style and color.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,KAIX;AAJD,WAAY,KAAK;IACf,wBAAe,CAAA;IACf,sBAAa,CAAA;IACb,0BAAiB,CAAA;AACnB,CAAC,EAJW,KAAK,KAAL,KAAK,QAIhB;AAWD,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,mCAAa,CAAA;IACb,qCAAe,CAAA;AACjB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B","sourcesContent":["export enum Style {\n LIGHT = 'LIGHT',\n DARK = 'DARK',\n CUSTOM = 'CUSTOM',\n}\n\n/**\n * Full HEX color format only (6 or 8 digits).\n * - 6 digits: #RRGGBB (e.g., #FFFFFF, #000000, #FF5733)\n * - 8 digits: #RRGGBBAA with alpha channel (e.g., #FFFFFF00, #FF5733CC)\n *\n * Note: Short 3-digit format (#FFF) is NOT supported.\n */\nexport type StatusBarColor = `#${string}`;\n\nexport enum StatusBarAnimation {\n NONE = 'none',\n FADE = 'fade',\n SLIDE = 'slide',\n}\n\ntype StatusBarStyleNoDefaultOptions = {\n style: Style;\n};\n\ntype StatusBarStyleOptions =\n | StatusBarStyleNoDefaultOptions\n | {\n style: Style.CUSTOM;\n color: StatusBarColor;\n };\n\nexport type StatusBarOptions = StatusBarStyleOptions;\n\nexport type StatusBarShowOptions = {\n animated: boolean;\n};\n\nexport type StatusBarHideOptions = {\n /**\n * The animation type for hiding the status bar.\n * - 'fade': Makes the background transparent without removing the status bar and navigation bar.\n * - 'slide': Hides the status bar and navigation bar completely (default behavior).\n */\n animation: StatusBarAnimation;\n};\n\nexport type StatusBarSetOverlaysWebViewOptions = {\n value: boolean;\n};\n\nexport type StatusBarSetBackgroundOptions = {\n color: StatusBarColor;\n};\n\nexport type SafeAreaInsets = {\n top: number;\n bottom: number;\n left: number;\n right: number;\n};\n\nexport interface
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,KAIX;AAJD,WAAY,KAAK;IACf,wBAAe,CAAA;IACf,sBAAa,CAAA;IACb,0BAAiB,CAAA;AACnB,CAAC,EAJW,KAAK,KAAL,KAAK,QAIhB;AAWD,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,mCAAa,CAAA;IACb,qCAAe,CAAA;AACjB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B","sourcesContent":["export enum Style {\n LIGHT = 'LIGHT',\n DARK = 'DARK',\n CUSTOM = 'CUSTOM',\n}\n\n/**\n * Full HEX color format only (6 or 8 digits).\n * - 6 digits: #RRGGBB (e.g., #FFFFFF, #000000, #FF5733)\n * - 8 digits: #RRGGBBAA with alpha channel (e.g., #FFFFFF00, #FF5733CC)\n *\n * Note: Short 3-digit format (#FFF) is NOT supported.\n */\nexport type StatusBarColor = `#${string}`;\n\nexport enum StatusBarAnimation {\n NONE = 'none',\n FADE = 'fade',\n SLIDE = 'slide',\n}\n\ntype StatusBarStyleNoDefaultOptions = {\n style: Style;\n};\n\ntype StatusBarStyleOptions =\n | StatusBarStyleNoDefaultOptions\n | {\n style: Style.CUSTOM;\n color: StatusBarColor;\n };\n\nexport type StatusBarOptions = StatusBarStyleOptions;\n\nexport type StatusBarShowOptions = {\n animated: boolean;\n};\n\nexport type StatusBarHideOptions = {\n /**\n * The animation type for hiding the status bar.\n * - 'fade': Makes the background transparent without removing the status bar and navigation bar.\n * - 'slide': Hides the status bar and navigation bar completely (default behavior).\n */\n animation: StatusBarAnimation;\n};\n\nexport type StatusBarSetOverlaysWebViewOptions = {\n value: boolean;\n};\n\nexport type StatusBarSetBackgroundOptions = {\n color: StatusBarColor;\n};\n\nexport type SafeAreaInsets = {\n top: number;\n bottom: number;\n left: number;\n right: number;\n};\n\nexport interface CapacitorStatusBarPlugin {\n /**\n * Set the status bar and navigation bar style and color.\n * @param options - The options to set the status bar style and color.\n * @param options.style - The style of the status bar.\n * @param options.color - The color of the status bar.\n */\n setStyle(options: StatusBarOptions): Promise<void>;\n /**\n * Show the status bar.\n * @param options - The options to show the status bar.\n * @param options.animated - Whether to animate the status bar.\n */\n show(options: StatusBarShowOptions): Promise<void>;\n /**\n * Hide the status bar.\n * @param options - The options to hide the status bar.\n * @param options.animation - The animation type: 'fade' makes background transparent, 'slide' hides bars completely.\n */\n hide(options: StatusBarHideOptions): Promise<void>;\n /**\n * Set whether the status bar overlays the web view.\n *\n * **iOS only** - On Android this is a no-op (resolves without error).\n *\n * - `true`: Web content extends behind the status bar (transparent background),\n * allowing content to be visible through the status bar area on scroll.\n * - `false`: Restores the status bar background to the color set by `setStyle`\n * or falls back to the default style from Capacitor config.\n *\n * @param options - The options to set the status bar overlays web view.\n * @param options.value - Whether the status bar overlays the web view (required).\n */\n setOverlaysWebView(options: StatusBarSetOverlaysWebViewOptions): Promise<void>;\n /**\n * Set the window background color.\n * @param options - The options to set the window background color.\n * @param options.color - The background color in HEX format.\n */\n setBackground(options: StatusBarSetBackgroundOptions): Promise<void>;\n /**\n * Get the safe area insets.\n * Returns the insets for status bar, navigation bar, and notch areas.\n * Values are in CSS pixels (dp) on all platforms.\n */\n getSafeAreaInsets(): Promise<SafeAreaInsets>;\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const
|
|
1
|
+
import type { CapacitorStatusBarPlugin } from './definitions';
|
|
2
|
+
declare const CapacitorStatusBar: CapacitorStatusBarPlugin;
|
|
3
3
|
export * from './definitions';
|
|
4
|
-
export {
|
|
4
|
+
export { CapacitorStatusBar };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { registerPlugin } from '@capacitor/core';
|
|
2
|
-
const
|
|
3
|
-
web: () => import('./web').then((m) => new m.
|
|
2
|
+
const CapacitorStatusBar = registerPlugin('CapacitorStatusBar', {
|
|
3
|
+
web: () => import('./web').then((m) => new m.CapacitorStatusBarWeb()),
|
|
4
4
|
});
|
|
5
5
|
export * from './definitions';
|
|
6
|
-
export {
|
|
6
|
+
export { CapacitorStatusBar };
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,kBAAkB,GAAG,cAAc,CAA2B,oBAAoB,EAAE;IACxF,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;CACtE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { CapacitorStatusBarPlugin } from './definitions';\n\nconst CapacitorStatusBar = registerPlugin<CapacitorStatusBarPlugin>('CapacitorStatusBar', {\n web: () => import('./web').then((m) => new m.CapacitorStatusBarWeb()),\n});\n\nexport * from './definitions';\nexport { CapacitorStatusBar };\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type { StatusBarOptions,
|
|
3
|
-
export declare class
|
|
2
|
+
import type { StatusBarOptions, CapacitorStatusBarPlugin, StatusBarSetOverlaysWebViewOptions, StatusBarShowOptions, StatusBarHideOptions, StatusBarSetBackgroundOptions, SafeAreaInsets } from './definitions';
|
|
3
|
+
export declare class CapacitorStatusBarWeb extends WebPlugin implements CapacitorStatusBarPlugin {
|
|
4
4
|
setStyle(options: StatusBarOptions): Promise<void>;
|
|
5
5
|
show(options: StatusBarShowOptions): Promise<void>;
|
|
6
6
|
hide(options: StatusBarHideOptions): Promise<void>;
|
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAY5C,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAY5C,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAClD,KAAK,CAAC,QAAQ,CAAC,OAAyB;QACtC,OAAO,CAAC,GA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,CAAC;QAEF,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;QACzC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n StatusBarOptions,\n CapacitorStatusBarPlugin,\n StatusBarSetOverlaysWebViewOptions,\n StatusBarShowOptions,\n StatusBarHideOptions,\n StatusBarSetBackgroundOptions,\n SafeAreaInsets,\n} from './definitions';\n\nexport class CapacitorStatusBarWeb extends WebPlugin implements CapacitorStatusBarPlugin {\n async setStyle(options: StatusBarOptions): Promise<void> {\n console.log('setStyle', options);\n }\n\n async show(options: StatusBarShowOptions): Promise<void> {\n console.log('show', options);\n }\n\n async hide(options: StatusBarHideOptions): Promise<void> {\n console.log('hide', options);\n }\n\n async setOverlaysWebView(options: StatusBarSetOverlaysWebViewOptions): Promise<void> {\n console.log('setOverlaysWebView', options);\n }\n\n async setBackground(options: StatusBarSetBackgroundOptions): Promise<void> {\n console.log('setBackground', options);\n }\n\n async getSafeAreaInsets(): Promise<SafeAreaInsets> {\n // On web, we can use CSS environment variables to get safe area insets\n // These are set by the browser on devices with notches, etc.\n const getInsetValue = (variable: string): number => {\n const value = getComputedStyle(document.documentElement).getPropertyValue(variable).trim();\n return value ? parseInt(value, 10) : 0;\n };\n\n const insets: SafeAreaInsets = {\n top: getInsetValue('env(safe-area-inset-top)') || getInsetValue('constant(safe-area-inset-top)') || 0,\n bottom: getInsetValue('env(safe-area-inset-bottom)') || getInsetValue('constant(safe-area-inset-bottom)') || 0,\n left: getInsetValue('env(safe-area-inset-left)') || getInsetValue('constant(safe-area-inset-left)') || 0,\n right: getInsetValue('env(safe-area-inset-right)') || getInsetValue('constant(safe-area-inset-right)') || 0,\n };\n\n console.log('getSafeAreaInsets', insets);\n return insets;\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -15,11 +15,11 @@ exports.StatusBarAnimation = void 0;
|
|
|
15
15
|
StatusBarAnimation["SLIDE"] = "slide";
|
|
16
16
|
})(exports.StatusBarAnimation || (exports.StatusBarAnimation = {}));
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.
|
|
18
|
+
const CapacitorStatusBar = core.registerPlugin('CapacitorStatusBar', {
|
|
19
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorStatusBarWeb()),
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
class
|
|
22
|
+
class CapacitorStatusBarWeb extends core.WebPlugin {
|
|
23
23
|
async setStyle(options) {
|
|
24
24
|
console.log('setStyle', options);
|
|
25
25
|
}
|
|
@@ -55,8 +55,8 @@ class StatusBarWeb extends core.WebPlugin {
|
|
|
55
55
|
|
|
56
56
|
var web = /*#__PURE__*/Object.freeze({
|
|
57
57
|
__proto__: null,
|
|
58
|
-
|
|
58
|
+
CapacitorStatusBarWeb: CapacitorStatusBarWeb
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
exports.
|
|
61
|
+
exports.CapacitorStatusBar = CapacitorStatusBar;
|
|
62
62
|
//# sourceMappingURL=plugin.cjs.js.map
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var Style;\n(function (Style) {\n Style[\"LIGHT\"] = \"LIGHT\";\n Style[\"DARK\"] = \"DARK\";\n Style[\"CUSTOM\"] = \"CUSTOM\";\n})(Style || (Style = {}));\nexport var StatusBarAnimation;\n(function (StatusBarAnimation) {\n StatusBarAnimation[\"NONE\"] = \"none\";\n StatusBarAnimation[\"FADE\"] = \"fade\";\n StatusBarAnimation[\"SLIDE\"] = \"slide\";\n})(StatusBarAnimation || (StatusBarAnimation = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var Style;\n(function (Style) {\n Style[\"LIGHT\"] = \"LIGHT\";\n Style[\"DARK\"] = \"DARK\";\n Style[\"CUSTOM\"] = \"CUSTOM\";\n})(Style || (Style = {}));\nexport var StatusBarAnimation;\n(function (StatusBarAnimation) {\n StatusBarAnimation[\"NONE\"] = \"none\";\n StatusBarAnimation[\"FADE\"] = \"fade\";\n StatusBarAnimation[\"SLIDE\"] = \"slide\";\n})(StatusBarAnimation || (StatusBarAnimation = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst CapacitorStatusBar = registerPlugin('CapacitorStatusBar', {\n web: () => import('./web').then((m) => new m.CapacitorStatusBarWeb()),\n});\nexport * from './definitions';\nexport { CapacitorStatusBar };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorStatusBarWeb extends WebPlugin {\n async setStyle(options) {\n console.log('setStyle', options);\n }\n async show(options) {\n console.log('show', options);\n }\n async hide(options) {\n console.log('hide', options);\n }\n async setOverlaysWebView(options) {\n console.log('setOverlaysWebView', options);\n }\n async setBackground(options) {\n console.log('setBackground', options);\n }\n async getSafeAreaInsets() {\n // On web, we can use CSS environment variables to get safe area insets\n // These are set by the browser on devices with notches, etc.\n const getInsetValue = (variable) => {\n const value = getComputedStyle(document.documentElement).getPropertyValue(variable).trim();\n return value ? parseInt(value, 10) : 0;\n };\n const insets = {\n top: getInsetValue('env(safe-area-inset-top)') || getInsetValue('constant(safe-area-inset-top)') || 0,\n bottom: getInsetValue('env(safe-area-inset-bottom)') || getInsetValue('constant(safe-area-inset-bottom)') || 0,\n left: getInsetValue('env(safe-area-inset-left)') || getInsetValue('constant(safe-area-inset-left)') || 0,\n right: getInsetValue('env(safe-area-inset-right)') || getInsetValue('constant(safe-area-inset-right)') || 0,\n };\n console.log('getSafeAreaInsets', insets);\n return insets;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["Style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,IAAI;AACJ,IAAI,MAAM,aAAa,CAAC,OAAO,EAAE;AACjC,QAAQ,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC;AAC7C,IAAI;AACJ,IAAI,MAAM,iBAAiB,GAAG;AAC9B;AACA;AACA,QAAQ,MAAM,aAAa,GAAG,CAAC,QAAQ,KAAK;AAC5C,YAAY,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE;AACtG,YAAY,OAAO,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC;AAClD,QAAQ,CAAC;AACT,QAAQ,MAAM,MAAM,GAAG;AACvB,YAAY,GAAG,EAAE,aAAa,CAAC,0BAA0B,CAAC,IAAI,aAAa,CAAC,+BAA+B,CAAC,IAAI,CAAC;AACjH,YAAY,MAAM,EAAE,aAAa,CAAC,6BAA6B,CAAC,IAAI,aAAa,CAAC,kCAAkC,CAAC,IAAI,CAAC;AAC1H,YAAY,IAAI,EAAE,aAAa,CAAC,2BAA2B,CAAC,IAAI,aAAa,CAAC,gCAAgC,CAAC,IAAI,CAAC;AACpH,YAAY,KAAK,EAAE,aAAa,CAAC,4BAA4B,CAAC,IAAI,aAAa,CAAC,iCAAiC,CAAC,IAAI,CAAC;AACvH,SAAS;AACT,QAAQ,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC;AAChD,QAAQ,OAAO,MAAM;AACrB,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -14,11 +14,11 @@ var capStatusBar = (function (exports, core) {
|
|
|
14
14
|
StatusBarAnimation["SLIDE"] = "slide";
|
|
15
15
|
})(exports.StatusBarAnimation || (exports.StatusBarAnimation = {}));
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.
|
|
17
|
+
const CapacitorStatusBar = core.registerPlugin('CapacitorStatusBar', {
|
|
18
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorStatusBarWeb()),
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
class
|
|
21
|
+
class CapacitorStatusBarWeb extends core.WebPlugin {
|
|
22
22
|
async setStyle(options) {
|
|
23
23
|
console.log('setStyle', options);
|
|
24
24
|
}
|
|
@@ -54,10 +54,10 @@ var capStatusBar = (function (exports, core) {
|
|
|
54
54
|
|
|
55
55
|
var web = /*#__PURE__*/Object.freeze({
|
|
56
56
|
__proto__: null,
|
|
57
|
-
|
|
57
|
+
CapacitorStatusBarWeb: CapacitorStatusBarWeb
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
exports.
|
|
60
|
+
exports.CapacitorStatusBar = CapacitorStatusBar;
|
|
61
61
|
|
|
62
62
|
return exports;
|
|
63
63
|
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var Style;\n(function (Style) {\n Style[\"LIGHT\"] = \"LIGHT\";\n Style[\"DARK\"] = \"DARK\";\n Style[\"CUSTOM\"] = \"CUSTOM\";\n})(Style || (Style = {}));\nexport var StatusBarAnimation;\n(function (StatusBarAnimation) {\n StatusBarAnimation[\"NONE\"] = \"none\";\n StatusBarAnimation[\"FADE\"] = \"fade\";\n StatusBarAnimation[\"SLIDE\"] = \"slide\";\n})(StatusBarAnimation || (StatusBarAnimation = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var Style;\n(function (Style) {\n Style[\"LIGHT\"] = \"LIGHT\";\n Style[\"DARK\"] = \"DARK\";\n Style[\"CUSTOM\"] = \"CUSTOM\";\n})(Style || (Style = {}));\nexport var StatusBarAnimation;\n(function (StatusBarAnimation) {\n StatusBarAnimation[\"NONE\"] = \"none\";\n StatusBarAnimation[\"FADE\"] = \"fade\";\n StatusBarAnimation[\"SLIDE\"] = \"slide\";\n})(StatusBarAnimation || (StatusBarAnimation = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst CapacitorStatusBar = registerPlugin('CapacitorStatusBar', {\n web: () => import('./web').then((m) => new m.CapacitorStatusBarWeb()),\n});\nexport * from './definitions';\nexport { CapacitorStatusBar };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorStatusBarWeb extends WebPlugin {\n async setStyle(options) {\n console.log('setStyle', options);\n }\n async show(options) {\n console.log('show', options);\n }\n async hide(options) {\n console.log('hide', options);\n }\n async setOverlaysWebView(options) {\n console.log('setOverlaysWebView', options);\n }\n async setBackground(options) {\n console.log('setBackground', options);\n }\n async getSafeAreaInsets() {\n // On web, we can use CSS environment variables to get safe area insets\n // These are set by the browser on devices with notches, etc.\n const getInsetValue = (variable) => {\n const value = getComputedStyle(document.documentElement).getPropertyValue(variable).trim();\n return value ? parseInt(value, 10) : 0;\n };\n const insets = {\n top: getInsetValue('env(safe-area-inset-top)') || getInsetValue('constant(safe-area-inset-top)') || 0,\n bottom: getInsetValue('env(safe-area-inset-bottom)') || getInsetValue('constant(safe-area-inset-bottom)') || 0,\n left: getInsetValue('env(safe-area-inset-left)') || getInsetValue('constant(safe-area-inset-left)') || 0,\n right: getInsetValue('env(safe-area-inset-right)') || getInsetValue('constant(safe-area-inset-right)') || 0,\n };\n console.log('getSafeAreaInsets', insets);\n return insets;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["Style","StatusBarAnimation","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,KAAK,EAAE;IAClB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO;IAC5B,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IA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,MAAM,aAAa,GAAG,CAAC,QAAQ,KAAK;IAC5C,YAAY,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE;IACtG,YAAY,OAAO,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC;IAClD,QAAQ,CAAC;IACT,QAAQ,MAAM,MAAM,GAAG;IACvB,YAAY,GAAG,EAAE,aAAa,CAAC,0BAA0B,CAAC,IAAI,aAAa,CAAC,+BAA+B,CAAC,IAAI,CAAC;IACjH,YAAY,MAAM,EAAE,aAAa,CAAC,6BAA6B,CAAC,IAAI,aAAa,CAAC,kCAAkC,CAAC,IAAI,CAAC;IAC1H,YAAY,IAAI,EAAE,aAAa,CAAC,2BAA2B,CAAC,IAAI,aAAa,CAAC,gCAAgC,CAAC,IAAI,CAAC;IACpH,YAAY,KAAK,EAAE,aAAa,CAAC,4BAA4B,CAAC,IAAI,aAAa,CAAC,iCAAiC,CAAC,IAAI,CAAC;IACvH,SAAS;IACT,QAAQ,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC;IAChD,QAAQ,OAAO,MAAM;IACrB,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import Foundation
|
|
|
2
2
|
import UIKit
|
|
3
3
|
import Capacitor
|
|
4
4
|
|
|
5
|
-
@objc public class
|
|
5
|
+
@objc public class CapacitorStatusBar: NSObject {
|
|
6
6
|
// Tag to identify the status bar background view
|
|
7
7
|
private static let statusBarViewTag = 38482458
|
|
8
8
|
// Store the current background color to restore when showing
|
|
@@ -14,7 +14,7 @@ import Capacitor
|
|
|
14
14
|
DispatchQueue.main.async {
|
|
15
15
|
let isDarkMode = self.isSystemInDarkMode()
|
|
16
16
|
let style = isDarkMode ? "DARK" : "LIGHT"
|
|
17
|
-
print("
|
|
17
|
+
print("CapacitorStatusBar: Applying default style based on system theme - isDarkMode=\(isDarkMode), style=\(style)")
|
|
18
18
|
self.setStyle(style: style, colorHex: nil)
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -64,7 +64,7 @@ import Capacitor
|
|
|
64
64
|
|
|
65
65
|
// Skip background color update when overlays web view is active
|
|
66
66
|
if self.isOverlayMode {
|
|
67
|
-
print("
|
|
67
|
+
print("CapacitorStatusBar: setStyle - overlay mode active, skipping background color")
|
|
68
68
|
} else {
|
|
69
69
|
// Create or update the status bar background view
|
|
70
70
|
self.updateStatusBarBackgroundView(in: window,
|
|
@@ -72,7 +72,7 @@ import Capacitor
|
|
|
72
72
|
color: backgroundColor)
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
print("
|
|
75
|
+
print("CapacitorStatusBar: setStyle - style=\(upperStyle), backgroundColor=\(String(describing: backgroundColor)), statusBarStyle=\(statusBarStyle)")
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -85,7 +85,7 @@ import Capacitor
|
|
|
85
85
|
// Log current status bar state via status bar manager
|
|
86
86
|
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
|
87
87
|
let statusBarManager = windowScene.statusBarManager {
|
|
88
|
-
print("
|
|
88
|
+
print("CapacitorStatusBar: show() - Current hidden state: \(statusBarManager.isStatusBarHidden)")
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// Set visibility using the application-level API
|
|
@@ -104,16 +104,16 @@ import Capacitor
|
|
|
104
104
|
// Log current status bar state via status bar manager
|
|
105
105
|
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
|
106
106
|
let statusBarManager = windowScene.statusBarManager {
|
|
107
|
-
print("
|
|
107
|
+
print("CapacitorStatusBar: hide() - animation=\(animationType), Current hidden state: \(statusBarManager.isStatusBarHidden)")
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
if animationType == "fade" {
|
|
111
111
|
// Fade mode: Make background transparent without removing status bar
|
|
112
|
-
print("
|
|
112
|
+
print("CapacitorStatusBar: hide() - fade mode: making background transparent")
|
|
113
113
|
self.makeStatusBarBackgroundTransparent()
|
|
114
114
|
} else if animationType == "slide" {
|
|
115
115
|
// Slide mode: Hide the status bar completely (current behavior)
|
|
116
|
-
print("
|
|
116
|
+
print("CapacitorStatusBar: hide() - slide mode: hiding bars completely")
|
|
117
117
|
// Note: Status bar visibility is controlled through view controllers in modern iOS.
|
|
118
118
|
// This plugin requires UIViewControllerBasedStatusBarAppearance to be set to NO
|
|
119
119
|
// in the app's Info.plist for programmatic show/hide to work.
|
|
@@ -121,7 +121,7 @@ import Capacitor
|
|
|
121
121
|
// Also make the background view transparent when hiding
|
|
122
122
|
self.makeStatusBarBackgroundTransparent()
|
|
123
123
|
} else {
|
|
124
|
-
print("
|
|
124
|
+
print("CapacitorStatusBar: hide() - unknown animation type '\(animationType)', defaulting to slide")
|
|
125
125
|
self.setStatusBarVisibility(hidden: true, animated: true)
|
|
126
126
|
self.makeStatusBarBackgroundTransparent()
|
|
127
127
|
}
|
|
@@ -147,7 +147,7 @@ import Capacitor
|
|
|
147
147
|
/// - color: The background color (nil to remove the view)
|
|
148
148
|
private func updateStatusBarBackgroundView(in window: UIWindow, height: CGFloat, color: UIColor?) {
|
|
149
149
|
// Find existing status bar view
|
|
150
|
-
let existingView = window.viewWithTag(
|
|
150
|
+
let existingView = window.viewWithTag(CapacitorStatusBar.statusBarViewTag)
|
|
151
151
|
|
|
152
152
|
if let color = color {
|
|
153
153
|
// Create or update the status bar background view
|
|
@@ -157,7 +157,7 @@ import Capacitor
|
|
|
157
157
|
statusBarView = existing
|
|
158
158
|
} else {
|
|
159
159
|
statusBarView = UIView(frame: CGRect(x: 0, y: 0, width: window.bounds.width, height: height))
|
|
160
|
-
statusBarView.tag =
|
|
160
|
+
statusBarView.tag = CapacitorStatusBar.statusBarViewTag
|
|
161
161
|
statusBarView.autoresizingMask = [.flexibleWidth]
|
|
162
162
|
window.addSubview(statusBarView)
|
|
163
163
|
}
|
|
@@ -179,7 +179,7 @@ import Capacitor
|
|
|
179
179
|
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
|
180
180
|
let window = windowScene.windows.first,
|
|
181
181
|
let statusBarManager = windowScene.statusBarManager else {
|
|
182
|
-
print("
|
|
182
|
+
print("CapacitorStatusBar: setOverlaysWebView - Unable to get window or status bar manager")
|
|
183
183
|
return
|
|
184
184
|
}
|
|
185
185
|
|
|
@@ -187,20 +187,20 @@ import Capacitor
|
|
|
187
187
|
|
|
188
188
|
if value {
|
|
189
189
|
// Overlay mode: make the status bar background transparent so web content shows through
|
|
190
|
-
let statusBarView = window.viewWithTag(
|
|
190
|
+
let statusBarView = window.viewWithTag(CapacitorStatusBar.statusBarViewTag)
|
|
191
191
|
statusBarView?.backgroundColor = .clear
|
|
192
|
-
print("
|
|
192
|
+
print("CapacitorStatusBar: setOverlaysWebView(true) - content extends behind status bar")
|
|
193
193
|
} else {
|
|
194
194
|
// Non-overlay mode: restore the status bar background from the current style
|
|
195
195
|
if let color = self.currentBackgroundColor {
|
|
196
196
|
self.updateStatusBarBackgroundView(in: window,
|
|
197
197
|
height: statusBarManager.statusBarFrame.height,
|
|
198
198
|
color: color)
|
|
199
|
-
print("
|
|
199
|
+
print("CapacitorStatusBar: setOverlaysWebView(false) - restored background color")
|
|
200
200
|
} else {
|
|
201
201
|
// No style was set; apply default style based on system theme
|
|
202
202
|
self.applyDefaultStyle()
|
|
203
|
-
print("
|
|
203
|
+
print("CapacitorStatusBar: setOverlaysWebView(false) - applied default style from config")
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
}
|
|
@@ -209,18 +209,18 @@ import Capacitor
|
|
|
209
209
|
@objc public func setBackground(colorHex: String?) {
|
|
210
210
|
DispatchQueue.main.async {
|
|
211
211
|
guard let colorHex = colorHex, let color = self.colorFromHex(colorHex) else {
|
|
212
|
-
print("
|
|
212
|
+
print("CapacitorStatusBar: setBackground - Invalid color or nil")
|
|
213
213
|
return
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
|
217
217
|
let window = windowScene.windows.first else {
|
|
218
|
-
print("
|
|
218
|
+
print("CapacitorStatusBar: setBackground - Unable to get window")
|
|
219
219
|
return
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
window.backgroundColor = color
|
|
223
|
-
print("
|
|
223
|
+
print("CapacitorStatusBar: setBackground - Set window background to \(colorHex)")
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
|
|
@@ -242,9 +242,9 @@ import Capacitor
|
|
|
242
242
|
insets["left"] = safeAreaInsets.left
|
|
243
243
|
insets["right"] = safeAreaInsets.right
|
|
244
244
|
|
|
245
|
-
print("
|
|
245
|
+
print("CapacitorStatusBar: getSafeAreaInsets - top=\(statusBarHeight), bottom=\(safeAreaInsets.bottom), left=\(safeAreaInsets.left), right=\(safeAreaInsets.right)")
|
|
246
246
|
} else {
|
|
247
|
-
print("
|
|
247
|
+
print("CapacitorStatusBar: getSafeAreaInsets - Unable to get window, returning zero insets")
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
completion(insets)
|
|
@@ -255,12 +255,12 @@ import Capacitor
|
|
|
255
255
|
private func makeStatusBarBackgroundTransparent() {
|
|
256
256
|
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
|
257
257
|
let window = windowScene.windows.first,
|
|
258
|
-
let statusBarView = window.viewWithTag(
|
|
258
|
+
let statusBarView = window.viewWithTag(CapacitorStatusBar.statusBarViewTag) else {
|
|
259
259
|
return
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
statusBarView.backgroundColor = .clear
|
|
263
|
-
print("
|
|
263
|
+
print("CapacitorStatusBar: Made background transparent")
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
/// Restores the status bar background view to its original color
|
|
@@ -276,7 +276,7 @@ import Capacitor
|
|
|
276
276
|
self.updateStatusBarBackgroundView(in: window,
|
|
277
277
|
height: statusBarManager.statusBarFrame.height,
|
|
278
278
|
color: color)
|
|
279
|
-
print("
|
|
279
|
+
print("CapacitorStatusBar: Restored background color: \(color)")
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
|
|
@@ -5,10 +5,10 @@ import Capacitor
|
|
|
5
5
|
* Please read the Capacitor iOS Plugin Development Guide
|
|
6
6
|
* here: https://capacitorjs.com/docs/plugins/ios
|
|
7
7
|
*/
|
|
8
|
-
@objc(
|
|
9
|
-
public class
|
|
10
|
-
public let identifier = "
|
|
11
|
-
public let jsName = "
|
|
8
|
+
@objc(CapacitorStatusBarPlugin)
|
|
9
|
+
public class CapacitorStatusBarPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
10
|
+
public let identifier = "CapacitorStatusBarPlugin"
|
|
11
|
+
public let jsName = "CapacitorStatusBar"
|
|
12
12
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
13
13
|
CAPPluginMethod(name: "setStyle", returnType: CAPPluginReturnPromise),
|
|
14
14
|
CAPPluginMethod(name: "show", returnType: CAPPluginReturnPromise),
|
|
@@ -17,7 +17,7 @@ public class StatusBarPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
17
17
|
CAPPluginMethod(name: "setBackground", returnType: CAPPluginReturnPromise),
|
|
18
18
|
CAPPluginMethod(name: "getSafeAreaInsets", returnType: CAPPluginReturnPromise)
|
|
19
19
|
]
|
|
20
|
-
private let implementation =
|
|
20
|
+
private let implementation = CapacitorStatusBar()
|
|
21
21
|
|
|
22
22
|
override public func load() {
|
|
23
23
|
super.load()
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import XCTest
|
|
2
|
-
@testable import
|
|
2
|
+
@testable import CapacitorStatusBarPlugin
|
|
3
3
|
|
|
4
|
-
class
|
|
4
|
+
class CapacitorStatusBarTests: XCTestCase {
|
|
5
5
|
func testEcho() {
|
|
6
6
|
// This is an example of a functional test case for a plugin.
|
|
7
7
|
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
|
8
8
|
|
|
9
|
-
let implementation =
|
|
9
|
+
let implementation = CapacitorStatusBar()
|
|
10
10
|
let value = "Hello, World!"
|
|
11
11
|
let result = implementation.echo(value)
|
|
12
12
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-plugin-status-bar",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
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",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"eslint": "eslint . --ext ts",
|
|
58
58
|
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
|
|
59
59
|
"swiftlint": "node-swiftlint",
|
|
60
|
-
"docgen": "docgen --api
|
|
60
|
+
"docgen": "docgen --api CapacitorStatusBarPlugin --output-readme README.md --output-json dist/docs.json",
|
|
61
61
|
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
62
62
|
"clean": "rimraf ./dist",
|
|
63
63
|
"watch": "tsc --watch",
|