capacitor-plugin-status-bar 2.0.3 → 2.0.5

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 CHANGED
@@ -7,22 +7,22 @@ let package = Package(
7
7
  products: [
8
8
  .library(
9
9
  name: "CapacitorPluginStatusBar",
10
- targets: ["StatusBarPlugin"])
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: "StatusBarPlugin",
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/StatusBarPlugin"),
22
+ path: "ios/Sources/CapacitorStatusBarPlugin"),
23
23
  .testTarget(
24
- name: "StatusBarPluginTests",
25
- dependencies: ["StatusBarPlugin"],
26
- path: "ios/Tests/StatusBarPluginTests")
24
+ name: "CapacitorStatusBarPluginTests",
25
+ dependencies: ["CapacitorStatusBarPlugin"],
26
+ path: "ios/Tests/CapacitorStatusBarPluginTests")
27
27
  ]
28
28
  )
package/README.md CHANGED
@@ -38,6 +38,8 @@ No additional configuration required. The plugin works out of the box on Android
38
38
  * [`hide(...)`](#hide)
39
39
  * [`setOverlaysWebView(...)`](#setoverlayswebview)
40
40
  * [`setBackground(...)`](#setbackground)
41
+ * [`showNavigationBar(...)`](#shownavigationbar)
42
+ * [`hideNavigationBar(...)`](#hidenavigationbar)
41
43
  * [`getSafeAreaInsets()`](#getsafeareainsets)
42
44
  * [Type Aliases](#type-aliases)
43
45
  * [Enums](#enums)
@@ -129,6 +131,36 @@ Set the window background color.
129
131
  --------------------
130
132
 
131
133
 
134
+ ### showNavigationBar(...)
135
+
136
+ ```typescript
137
+ showNavigationBar(options: NavigationBarShowOptions) => Promise<void>
138
+ ```
139
+
140
+ Show the navigation bar.
141
+
142
+ | Param | Type | Description |
143
+ | ------------- | ----------------------------------------------------------------------------- | ----------------------------------------- |
144
+ | **`options`** | <code><a href="#navigationbarshowoptions">NavigationBarShowOptions</a></code> | - The options to show the navigation bar. |
145
+
146
+ --------------------
147
+
148
+
149
+ ### hideNavigationBar(...)
150
+
151
+ ```typescript
152
+ hideNavigationBar(options: NavigationBarHideOptions) => Promise<void>
153
+ ```
154
+
155
+ Hide the navigation bar.
156
+
157
+ | Param | Type | Description |
158
+ | ------------- | ----------------------------------------------------------------------------- | ----------------------------------------- |
159
+ | **`options`** | <code><a href="#navigationbarhideoptions">NavigationBarHideOptions</a></code> | - The options to hide the navigation bar. |
160
+
161
+ --------------------
162
+
163
+
132
164
  ### getSafeAreaInsets()
133
165
 
134
166
  ```typescript
@@ -193,6 +225,16 @@ Note: Short 3-digit format (#FFF) is NOT supported.
193
225
  <code>{ color: <a href="#statusbarcolor">StatusBarColor</a>; }</code>
194
226
 
195
227
 
228
+ #### NavigationBarShowOptions
229
+
230
+ <code>{ animated: boolean; }</code>
231
+
232
+
233
+ #### NavigationBarHideOptions
234
+
235
+ <code>{ /** * The animation type for hiding the navigation bar. * - 'fade': Makes the background transparent without removing the navigation bar. * - 'slide': Hides the navigation bar completely (default behavior). */ animation: <a href="#statusbaranimation">StatusBarAnimation</a>; }</code>
236
+
237
+
196
238
  #### SafeAreaInsets
197
239
 
198
240
  <code>{ top: number; bottom: number; left: number; right: number; }</code>
@@ -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 StatusBar extends Plugin {
35
- private static final String TAG = "StatusBar";
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 StatusBar is instantiated via new StatusBar()
46
- // from StatusBarPlugin, not registered as a Capacitor plugin itself.
47
- // All initialization happens via ensureEdgeToEdgeConfigured() called from StatusBarPlugin.load().
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
- // Enable edge-to-edge for ALL API levels.
61
- // window.setStatusBarColor() is unreliable on many devices/OEMs,
62
- // so we use overlay views to control bar colors consistently.
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
- // Make native bar colors transparent so our overlays are the sole color source
66
- window.setStatusBarColor(Color.TRANSPARENT);
67
- window.setNavigationBarColor(Color.TRANSPARENT);
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
- // Single unified insets listener on decorView for overlay sizing
74
- ViewCompat.setOnApplyWindowInsetsListener(decorView, (v, insets) -> {
75
- // Size status bar overlay
76
- int top = insets.getInsets(WindowInsetsCompat.Type.statusBars()).top;
77
- View statusOverlay = ((ViewGroup) v).findViewWithTag(STATUS_BAR_OVERLAY_TAG);
78
- if (statusOverlay != null) {
79
- ViewGroup.LayoutParams params = statusOverlay.getLayoutParams();
80
- if (params.height != top) {
81
- params.height = top;
82
- statusOverlay.setLayoutParams(params);
83
- Log.d(TAG, "insetsListener: status bar overlay height=" + top);
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
- // Size navigation bar overlay
88
- int bottom = insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom;
89
- View navOverlay = ((ViewGroup) v).findViewWithTag(NAV_BAR_OVERLAY_TAG);
90
- if (navOverlay != null) {
91
- ViewGroup.LayoutParams params = navOverlay.getLayoutParams();
92
- if (params.height != bottom) {
93
- params.height = bottom;
94
- navOverlay.setLayoutParams(params);
95
- Log.d(TAG, "insetsListener: nav bar overlay height=" + bottom);
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
- ViewCompat.onApplyWindowInsets(v, insets);
100
- return insets;
101
- });
96
+ ViewCompat.onApplyWindowInsets(v, insets);
97
+ return insets;
98
+ });
99
+
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
+ }
102
109
 
103
- Log.d(TAG, "ensureEdgeToEdgeConfigured: edge-to-edge with overlay views, API=" + Build.VERSION.SDK_INT);
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) {
@@ -320,6 +328,108 @@ public class StatusBar extends Plugin {
320
328
  return insets;
321
329
  }
322
330
 
331
+ public void showNavigationBar(Activity activity, boolean animated) {
332
+ Log.d(TAG, "showNavigationBar: animated=" + animated + ", API=" + Build.VERSION.SDK_INT);
333
+ Window window = activity.getWindow();
334
+ View decorView = window.getDecorView();
335
+
336
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
337
+ WindowInsetsController controller = window.getInsetsController();
338
+ if (controller != null) {
339
+ Log.d(TAG, "showNavigationBar: showing navigation bar (API 30+)");
340
+ controller.show(WindowInsets.Type.navigationBars());
341
+ controller.setSystemBarsBehavior(
342
+ WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
343
+ } else {
344
+ Log.w(TAG, "showNavigationBar: WindowInsetsController is null");
345
+ }
346
+ } else {
347
+ Log.d(TAG, "showNavigationBar: showing using system UI flags (API 29)");
348
+ int flags = decorView.getSystemUiVisibility();
349
+ flags &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
350
+ flags &= ~View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
351
+ decorView.setSystemUiVisibility(flags);
352
+ }
353
+
354
+ // Restore navigation bar background color
355
+ applyNavigationBarBackground(activity, currentNavBarColor);
356
+ }
357
+
358
+ public void hideNavigationBar(Activity activity, String animation) {
359
+ Log.d(TAG, "hideNavigationBar: animation=" + animation + ", API=" + Build.VERSION.SDK_INT);
360
+ Window window = activity.getWindow();
361
+ View decorView = window.getDecorView();
362
+
363
+ String animationType = animation != null ? animation.toLowerCase() : "slide";
364
+
365
+ if ("fade".equals(animationType)) {
366
+ Log.d(TAG, "hideNavigationBar: fade mode - hiding navigation bar with transparent background");
367
+
368
+ // Hide the navigation bar icons
369
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
370
+ WindowInsetsController controller = window.getInsetsController();
371
+ if (controller != null) {
372
+ controller.hide(WindowInsets.Type.navigationBars());
373
+ controller.setSystemBarsBehavior(
374
+ WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
375
+ }
376
+ } else {
377
+ decorView.setSystemUiVisibility(
378
+ decorView.getSystemUiVisibility()
379
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
380
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
381
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
382
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
383
+ }
384
+
385
+ // Make background transparent
386
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
387
+ ViewGroup dv = (ViewGroup) decorView;
388
+ View navOverlay = dv.findViewWithTag(NAV_BAR_OVERLAY_TAG);
389
+ if (navOverlay != null) {
390
+ navOverlay.setBackgroundColor(Color.TRANSPARENT);
391
+ }
392
+ } else {
393
+ window.setNavigationBarColor(Color.TRANSPARENT);
394
+ }
395
+ } else if ("slide".equals(animationType)) {
396
+ Log.d(TAG, "hideNavigationBar: slide mode - hiding navigation bar completely");
397
+
398
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
399
+ WindowInsetsController controller = window.getInsetsController();
400
+ if (controller != null) {
401
+ controller.hide(WindowInsets.Type.navigationBars());
402
+ controller.setSystemBarsBehavior(
403
+ WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
404
+ } else {
405
+ Log.w(TAG, "hideNavigationBar: WindowInsetsController is null");
406
+ }
407
+ } else {
408
+ Log.d(TAG, "hideNavigationBar: hiding using system UI flags (API 29)");
409
+ decorView.setSystemUiVisibility(
410
+ decorView.getSystemUiVisibility()
411
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
412
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
413
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
414
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
415
+ }
416
+
417
+ // Make navigation bar overlay transparent
418
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
419
+ ViewGroup dv = (ViewGroup) decorView;
420
+ View navOverlay = dv.findViewWithTag(NAV_BAR_OVERLAY_TAG);
421
+ if (navOverlay != null) {
422
+ navOverlay.setBackgroundColor(Color.TRANSPARENT);
423
+ }
424
+ } else {
425
+ window.setNavigationBarColor(Color.TRANSPARENT);
426
+ }
427
+ } else {
428
+ Log.w(TAG, "hideNavigationBar: unknown animation type '" + animationType + "', defaulting to slide");
429
+ hideNavigationBar(activity, "slide");
430
+ }
431
+ }
432
+
323
433
  /**
324
434
  * Reapply the current style and colors after showing bars.
325
435
  * This ensures colors are preserved when hiding and then showing.
@@ -382,15 +492,25 @@ public class StatusBar extends Plugin {
382
492
 
383
493
  private void applyStatusBarBackground(Activity activity, @ColorInt int color) {
384
494
  Log.d(TAG, "applyStatusBarBackground: color=#" + Integer.toHexString(color) + ", API=" + Build.VERSION.SDK_INT);
385
- // Use overlay views for all API levels for consistent behavior
386
- ensureStatusBarOverlay(activity, color);
495
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
496
+ // Android 15+: Use overlay views
497
+ ensureStatusBarOverlay(activity, color);
498
+ } else {
499
+ // Android < 15: Use native window API directly
500
+ activity.getWindow().setStatusBarColor(color);
501
+ }
387
502
  }
388
503
 
389
504
  private void applyNavigationBarBackground(Activity activity, @ColorInt int color) {
390
505
  Log.d(TAG, "applyNavigationBarBackground: color=#" + Integer.toHexString(color) + ", API="
391
506
  + Build.VERSION.SDK_INT);
392
- // Use overlay views for all API levels for consistent behavior
393
- ensureNavBarOverlay(activity, color);
507
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
508
+ // Android 15+: Use overlay views
509
+ ensureNavBarOverlay(activity, color);
510
+ } else {
511
+ // Android < 15: Use native window API directly
512
+ activity.getWindow().setNavigationBarColor(color);
513
+ }
394
514
  }
395
515
 
396
516
  private void ensureStatusBarOverlay(Activity activity, @ColorInt int color) {
@@ -504,18 +624,28 @@ public class StatusBar extends Plugin {
504
624
  */
505
625
  private void makeStatusBarBackgroundTransparent(Activity activity) {
506
626
  Log.d(TAG, "makeStatusBarBackgroundTransparent: API=" + Build.VERSION.SDK_INT);
507
- ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
508
627
 
509
- View statusBarOverlay = decorView.findViewWithTag(STATUS_BAR_OVERLAY_TAG);
510
- if (statusBarOverlay != null) {
511
- statusBarOverlay.setBackgroundColor(Color.TRANSPARENT);
512
- Log.d(TAG, "makeStatusBarBackgroundTransparent: status bar overlay made transparent");
513
- }
628
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
629
+ // Android 15+: Set overlay backgrounds to transparent
630
+ ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
514
631
 
515
- View navBarOverlay = decorView.findViewWithTag(NAV_BAR_OVERLAY_TAG);
516
- if (navBarOverlay != null) {
517
- navBarOverlay.setBackgroundColor(Color.TRANSPARENT);
518
- Log.d(TAG, "makeStatusBarBackgroundTransparent: navigation bar overlay made transparent");
632
+ View statusBarOverlay = decorView.findViewWithTag(STATUS_BAR_OVERLAY_TAG);
633
+ if (statusBarOverlay != null) {
634
+ statusBarOverlay.setBackgroundColor(Color.TRANSPARENT);
635
+ Log.d(TAG, "makeStatusBarBackgroundTransparent: status bar overlay made transparent");
636
+ }
637
+
638
+ View navBarOverlay = decorView.findViewWithTag(NAV_BAR_OVERLAY_TAG);
639
+ if (navBarOverlay != null) {
640
+ navBarOverlay.setBackgroundColor(Color.TRANSPARENT);
641
+ Log.d(TAG, "makeStatusBarBackgroundTransparent: navigation bar overlay made transparent");
642
+ }
643
+ } else {
644
+ // Android < 15: Use native window API directly
645
+ Window window = activity.getWindow();
646
+ window.setStatusBarColor(Color.TRANSPARENT);
647
+ window.setNavigationBarColor(Color.TRANSPARENT);
648
+ Log.d(TAG, "makeStatusBarBackgroundTransparent: set native bar colors to transparent");
519
649
  }
520
650
  }
521
651
 
@@ -1,13 +1,20 @@
1
1
  package com.cap.plugins.statusbar;
2
2
 
3
+ import android.os.Build;
4
+ import android.view.View;
5
+
6
+ import androidx.core.graphics.Insets;
7
+ import androidx.core.view.ViewCompat;
8
+ import androidx.core.view.WindowInsetsCompat;
9
+
3
10
  import com.getcapacitor.Plugin;
4
11
  import com.getcapacitor.PluginCall;
5
12
  import com.getcapacitor.PluginMethod;
6
13
  import com.getcapacitor.annotation.CapacitorPlugin;
7
14
 
8
- @CapacitorPlugin(name = "StatusBar")
9
- public class StatusBarPlugin extends Plugin {
10
- private final StatusBar implementation = new StatusBar();
15
+ @CapacitorPlugin(name = "CapacitorStatusBar")
16
+ public class CapacitorStatusBarPlugin extends Plugin {
17
+ private final CapacitorStatusBar implementation = new CapacitorStatusBar();
11
18
 
12
19
  @Override
13
20
  public void load() {
@@ -16,6 +23,17 @@ public class StatusBarPlugin extends Plugin {
16
23
  getActivity().runOnUiThread(() -> {
17
24
  implementation.ensureEdgeToEdgeConfigured(getActivity());
18
25
  implementation.applyDefaultStyle(getActivity());
26
+
27
+ // On Android 15+ (API 35+), edge-to-edge is enforced and the WebView content
28
+ // extends under system bars. Apply padding so Ionic content stays in the safe area.
29
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
30
+ View webView = getBridge().getWebView();
31
+ ViewCompat.setOnApplyWindowInsetsListener(webView, (v, insets) -> {
32
+ Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
33
+ v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
34
+ return insets;
35
+ });
36
+ }
19
37
  });
20
38
  }
21
39
 
@@ -101,6 +119,36 @@ public class StatusBarPlugin extends Plugin {
101
119
  }
102
120
  }
103
121
 
122
+ @PluginMethod
123
+ public void showNavigationBar(PluginCall call) {
124
+ try {
125
+ boolean animated = Boolean.TRUE.equals(call.getBoolean("animated", true));
126
+ getActivity().runOnUiThread(() -> {
127
+ implementation.showNavigationBar(getActivity(), animated);
128
+ call.resolve();
129
+ });
130
+ } catch (Exception e) {
131
+ call.reject(e.getMessage());
132
+ }
133
+ }
134
+
135
+ @PluginMethod
136
+ public void hideNavigationBar(PluginCall call) {
137
+ try {
138
+ String animation = call.getString("animation");
139
+ if (animation == null) {
140
+ call.reject("animation is required");
141
+ return;
142
+ }
143
+ getActivity().runOnUiThread(() -> {
144
+ implementation.hideNavigationBar(getActivity(), animation);
145
+ call.resolve();
146
+ });
147
+ } catch (Exception e) {
148
+ call.reject(e.getMessage());
149
+ }
150
+ }
151
+
104
152
  @PluginMethod
105
153
  public void getSafeAreaInsets(PluginCall call) {
106
154
  try {
package/dist/docs.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "api": {
3
- "name": "StatusBarPlugin",
4
- "slug": "statusbarplugin",
3
+ "name": "CapacitorStatusBarPlugin",
4
+ "slug": "capacitorstatusbarplugin",
5
5
  "docs": "",
6
6
  "tags": [],
7
7
  "methods": [
@@ -144,6 +144,60 @@
144
144
  ],
145
145
  "slug": "setbackground"
146
146
  },
147
+ {
148
+ "name": "showNavigationBar",
149
+ "signature": "(options: NavigationBarShowOptions) => Promise<void>",
150
+ "parameters": [
151
+ {
152
+ "name": "options",
153
+ "docs": "- The options to show the navigation bar.",
154
+ "type": "NavigationBarShowOptions"
155
+ }
156
+ ],
157
+ "returns": "Promise<void>",
158
+ "tags": [
159
+ {
160
+ "name": "param",
161
+ "text": "options - The options to show the navigation bar."
162
+ },
163
+ {
164
+ "name": "param",
165
+ "text": "options.animated - Whether to animate the navigation bar."
166
+ }
167
+ ],
168
+ "docs": "Show the navigation bar.",
169
+ "complexTypes": [
170
+ "NavigationBarShowOptions"
171
+ ],
172
+ "slug": "shownavigationbar"
173
+ },
174
+ {
175
+ "name": "hideNavigationBar",
176
+ "signature": "(options: NavigationBarHideOptions) => Promise<void>",
177
+ "parameters": [
178
+ {
179
+ "name": "options",
180
+ "docs": "- The options to hide the navigation bar.",
181
+ "type": "NavigationBarHideOptions"
182
+ }
183
+ ],
184
+ "returns": "Promise<void>",
185
+ "tags": [
186
+ {
187
+ "name": "param",
188
+ "text": "options - The options to hide the navigation bar."
189
+ },
190
+ {
191
+ "name": "param",
192
+ "text": "options.animation - The animation type: 'fade' makes background transparent, 'slide' hides bar completely."
193
+ }
194
+ ],
195
+ "docs": "Hide the navigation bar.",
196
+ "complexTypes": [
197
+ "NavigationBarHideOptions"
198
+ ],
199
+ "slug": "hidenavigationbar"
200
+ },
147
201
  {
148
202
  "name": "getSafeAreaInsets",
149
203
  "signature": "() => Promise<SafeAreaInsets>",
@@ -316,6 +370,30 @@
316
370
  }
317
371
  ]
318
372
  },
373
+ {
374
+ "name": "NavigationBarShowOptions",
375
+ "slug": "navigationbarshowoptions",
376
+ "docs": "",
377
+ "types": [
378
+ {
379
+ "text": "{\n animated: boolean;\n}",
380
+ "complexTypes": []
381
+ }
382
+ ]
383
+ },
384
+ {
385
+ "name": "NavigationBarHideOptions",
386
+ "slug": "navigationbarhideoptions",
387
+ "docs": "",
388
+ "types": [
389
+ {
390
+ "text": "{\n /**\n * The animation type for hiding the navigation bar.\n * - 'fade': Makes the background transparent without removing the navigation bar.\n * - 'slide': Hides the navigation bar completely (default behavior).\n */\n animation: StatusBarAnimation;\n}",
391
+ "complexTypes": [
392
+ "StatusBarAnimation"
393
+ ]
394
+ }
395
+ ]
396
+ },
319
397
  {
320
398
  "name": "SafeAreaInsets",
321
399
  "slug": "safeareainsets",
@@ -41,13 +41,24 @@ export declare type StatusBarSetOverlaysWebViewOptions = {
41
41
  export declare type StatusBarSetBackgroundOptions = {
42
42
  color: StatusBarColor;
43
43
  };
44
+ export declare type NavigationBarShowOptions = {
45
+ animated: boolean;
46
+ };
47
+ export declare type NavigationBarHideOptions = {
48
+ /**
49
+ * The animation type for hiding the navigation bar.
50
+ * - 'fade': Makes the background transparent without removing the navigation bar.
51
+ * - 'slide': Hides the navigation bar completely (default behavior).
52
+ */
53
+ animation: StatusBarAnimation;
54
+ };
44
55
  export declare type SafeAreaInsets = {
45
56
  top: number;
46
57
  bottom: number;
47
58
  left: number;
48
59
  right: number;
49
60
  };
50
- export interface StatusBarPlugin {
61
+ export interface CapacitorStatusBarPlugin {
51
62
  /**
52
63
  * Set the status bar and navigation bar style and color.
53
64
  * @param options - The options to set the status bar style and color.
@@ -87,6 +98,18 @@ export interface StatusBarPlugin {
87
98
  * @param options.color - The background color in HEX format.
88
99
  */
89
100
  setBackground(options: StatusBarSetBackgroundOptions): Promise<void>;
101
+ /**
102
+ * Show the navigation bar.
103
+ * @param options - The options to show the navigation bar.
104
+ * @param options.animated - Whether to animate the navigation bar.
105
+ */
106
+ showNavigationBar(options: NavigationBarShowOptions): Promise<void>;
107
+ /**
108
+ * Hide the navigation bar.
109
+ * @param options - The options to hide the navigation bar.
110
+ * @param options.animation - The animation type: 'fade' makes background transparent, 'slide' hides bar completely.
111
+ */
112
+ hideNavigationBar(options: NavigationBarHideOptions): Promise<void>;
90
113
  /**
91
114
  * Get the safe area insets.
92
115
  * Returns the insets for status bar, navigation bar, and notch areas.
@@ -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 StatusBarPlugin {\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"]}
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 NavigationBarShowOptions = {\n animated: boolean;\n};\n\nexport type NavigationBarHideOptions = {\n /**\n * The animation type for hiding the navigation bar.\n * - 'fade': Makes the background transparent without removing the navigation bar.\n * - 'slide': Hides the navigation bar completely (default behavior).\n */\n animation: StatusBarAnimation;\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 * Show the navigation bar.\n * @param options - The options to show the navigation bar.\n * @param options.animated - Whether to animate the navigation bar.\n */\n showNavigationBar(options: NavigationBarShowOptions): Promise<void>;\n /**\n * Hide the navigation bar.\n * @param options - The options to hide the navigation bar.\n * @param options.animation - The animation type: 'fade' makes background transparent, 'slide' hides bar completely.\n */\n hideNavigationBar(options: NavigationBarHideOptions): 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"]}
@@ -1,4 +1,4 @@
1
- import type { StatusBarPlugin } from './definitions';
2
- declare const StatusBar: StatusBarPlugin;
1
+ import type { CapacitorStatusBarPlugin } from './definitions';
2
+ declare const CapacitorStatusBar: CapacitorStatusBarPlugin;
3
3
  export * from './definitions';
4
- export { StatusBar };
4
+ export { CapacitorStatusBar };
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { registerPlugin } from '@capacitor/core';
2
- const StatusBar = registerPlugin('StatusBar', {
3
- web: () => import('./web').then((m) => new m.StatusBarWeb()),
2
+ const CapacitorStatusBar = registerPlugin('CapacitorStatusBar', {
3
+ web: () => import('./web').then((m) => new m.CapacitorStatusBarWeb()),
4
4
  });
5
5
  export * from './definitions';
6
- export { StatusBar };
6
+ export { CapacitorStatusBar };
7
7
  //# sourceMappingURL=index.js.map
@@ -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,SAAS,GAAG,cAAc,CAAkB,WAAW,EAAE;IAC7D,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;CAC7D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { StatusBarPlugin } from './definitions';\n\nconst StatusBar = registerPlugin<StatusBarPlugin>('StatusBar', {\n web: () => import('./web').then((m) => new m.StatusBarWeb()),\n});\n\nexport * from './definitions';\nexport { StatusBar };\n"]}
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,10 +1,12 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { StatusBarOptions, StatusBarPlugin, StatusBarSetOverlaysWebViewOptions, StatusBarShowOptions, StatusBarHideOptions, StatusBarSetBackgroundOptions, SafeAreaInsets } from './definitions';
3
- export declare class StatusBarWeb extends WebPlugin implements StatusBarPlugin {
2
+ import type { StatusBarOptions, CapacitorStatusBarPlugin, StatusBarSetOverlaysWebViewOptions, StatusBarShowOptions, StatusBarHideOptions, StatusBarSetBackgroundOptions, SafeAreaInsets, NavigationBarShowOptions, NavigationBarHideOptions } 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>;
7
7
  setOverlaysWebView(options: StatusBarSetOverlaysWebViewOptions): Promise<void>;
8
8
  setBackground(options: StatusBarSetBackgroundOptions): Promise<void>;
9
+ showNavigationBar(options: NavigationBarShowOptions): Promise<void>;
10
+ hideNavigationBar(options: NavigationBarHideOptions): Promise<void>;
9
11
  getSafeAreaInsets(): Promise<SafeAreaInsets>;
10
12
  }
package/dist/esm/web.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- export class StatusBarWeb extends WebPlugin {
2
+ export class CapacitorStatusBarWeb extends WebPlugin {
3
3
  async setStyle(options) {
4
4
  console.log('setStyle', options);
5
5
  }
@@ -15,6 +15,12 @@ export class StatusBarWeb extends WebPlugin {
15
15
  async setBackground(options) {
16
16
  console.log('setBackground', options);
17
17
  }
18
+ async showNavigationBar(options) {
19
+ console.log('showNavigationBar', options);
20
+ }
21
+ async hideNavigationBar(options) {
22
+ console.log('hideNavigationBar', options);
23
+ }
18
24
  async getSafeAreaInsets() {
19
25
  // On web, we can use CSS environment variables to get safe area insets
20
26
  // These are set by the browser on devices with notches, etc.
@@ -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,YAAa,SAAQ,SAAS;IACzC,KAAK,CAAC,QAAQ,CAAC,OAAyB;QACtC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAA6B;QACtC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAA6B;QACtC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,OAA2C;QAClE,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAsC;QACxD,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,uEAAuE;QACvE,6DAA6D;QAC7D,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAU,EAAE;YACjD,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;YAC3F,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC;QAEF,MAAM,MAAM,GAAmB;YAC7B,GAAG,EAAE,aAAa,CAAC,0BAA0B,CAAC,IAAI,aAAa,CAAC,+BAA+B,CAAC,IAAI,CAAC;YACrG,MAAM,EAAE,aAAa,CAAC,6BAA6B,CAAC,IAAI,aAAa,CAAC,kCAAkC,CAAC,IAAI,CAAC;YAC9G,IAAI,EAAE,aAAa,CAAC,2BAA2B,CAAC,IAAI,aAAa,CAAC,gCAAgC,CAAC,IAAI,CAAC;YACxG,KAAK,EAAE,aAAa,CAAC,4BAA4B,CAAC,IAAI,aAAa,CAAC,iCAAiC,CAAC,IAAI,CAAC;SAC5G,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 StatusBarPlugin,\n StatusBarSetOverlaysWebViewOptions,\n StatusBarShowOptions,\n StatusBarHideOptions,\n StatusBarSetBackgroundOptions,\n SafeAreaInsets,\n} from './definitions';\n\nexport class StatusBarWeb extends WebPlugin implements StatusBarPlugin {\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"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAc5C,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAClD,KAAK,CAAC,QAAQ,CAAC,OAAyB;QACtC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAA6B;QACtC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAA6B;QACtC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,OAA2C;QAClE,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAsC;QACxD,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAAiC;QACvD,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAAiC;QACvD,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,uEAAuE;QACvE,6DAA6D;QAC7D,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAU,EAAE;YACjD,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;YAC3F,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC;QAEF,MAAM,MAAM,GAAmB;YAC7B,GAAG,EAAE,aAAa,CAAC,0BAA0B,CAAC,IAAI,aAAa,CAAC,+BAA+B,CAAC,IAAI,CAAC;YACrG,MAAM,EAAE,aAAa,CAAC,6BAA6B,CAAC,IAAI,aAAa,CAAC,kCAAkC,CAAC,IAAI,CAAC;YAC9G,IAAI,EAAE,aAAa,CAAC,2BAA2B,CAAC,IAAI,aAAa,CAAC,gCAAgC,CAAC,IAAI,CAAC;YACxG,KAAK,EAAE,aAAa,CAAC,4BAA4B,CAAC,IAAI,aAAa,CAAC,iCAAiC,CAAC,IAAI,CAAC;SAC5G,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 NavigationBarShowOptions,\n NavigationBarHideOptions,\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 showNavigationBar(options: NavigationBarShowOptions): Promise<void> {\n console.log('showNavigationBar', options);\n }\n\n async hideNavigationBar(options: NavigationBarHideOptions): Promise<void> {\n console.log('hideNavigationBar', 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"]}
@@ -15,11 +15,11 @@ exports.StatusBarAnimation = void 0;
15
15
  StatusBarAnimation["SLIDE"] = "slide";
16
16
  })(exports.StatusBarAnimation || (exports.StatusBarAnimation = {}));
17
17
 
18
- const StatusBar = core.registerPlugin('StatusBar', {
19
- web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.StatusBarWeb()),
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 StatusBarWeb extends core.WebPlugin {
22
+ class CapacitorStatusBarWeb extends core.WebPlugin {
23
23
  async setStyle(options) {
24
24
  console.log('setStyle', options);
25
25
  }
@@ -35,6 +35,12 @@ class StatusBarWeb extends core.WebPlugin {
35
35
  async setBackground(options) {
36
36
  console.log('setBackground', options);
37
37
  }
38
+ async showNavigationBar(options) {
39
+ console.log('showNavigationBar', options);
40
+ }
41
+ async hideNavigationBar(options) {
42
+ console.log('hideNavigationBar', options);
43
+ }
38
44
  async getSafeAreaInsets() {
39
45
  // On web, we can use CSS environment variables to get safe area insets
40
46
  // These are set by the browser on devices with notches, etc.
@@ -55,8 +61,8 @@ class StatusBarWeb extends core.WebPlugin {
55
61
 
56
62
  var web = /*#__PURE__*/Object.freeze({
57
63
  __proto__: null,
58
- StatusBarWeb: StatusBarWeb
64
+ CapacitorStatusBarWeb: CapacitorStatusBarWeb
59
65
  });
60
66
 
61
- exports.StatusBar = StatusBar;
67
+ exports.CapacitorStatusBar = CapacitorStatusBar;
62
68
  //# sourceMappingURL=plugin.cjs.js.map
@@ -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 StatusBar = registerPlugin('StatusBar', {\n web: () => import('./web').then((m) => new m.StatusBarWeb()),\n});\nexport * from './definitions';\nexport { StatusBar };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class StatusBarWeb 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;AACX,CAAC,UAAU,KAAK,EAAE;AAClB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO;AAC5B,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;AAC1B,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,QAAQ;AAC9B,CAAC,EAAEA,aAAK,KAAKA,aAAK,GAAG,EAAE,CAAC,CAAC;AACdC;AACX,CAAC,UAAU,kBAAkB,EAAE;AAC/B,IAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG,MAAM;AACvC,IAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG,MAAM;AACvC,IAAI,kBAAkB,CAAC,OAAO,CAAC,GAAG,OAAO;AACzC,CAAC,EAAEA,0BAAkB,KAAKA,0BAAkB,GAAG,EAAE,CAAC,CAAC;;ACV9C,MAAC,SAAS,GAAGC,mBAAc,CAAC,WAAW,EAAE;AAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;AAChE,CAAC;;ACFM,MAAM,YAAY,SAASC,cAAS,CAAC;AAC5C,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAQ,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC;AACxC,IAAI;AACJ,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,IAAI;AACJ,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,IAAI;AACJ,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;AACtC,QAAQ,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC;AAClD,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;;;;;;;;;"}
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 showNavigationBar(options) {\n console.log('showNavigationBar', options);\n }\n async hideNavigationBar(options) {\n console.log('hideNavigationBar', 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":"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"}
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 StatusBar = core.registerPlugin('StatusBar', {
18
- web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.StatusBarWeb()),
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 StatusBarWeb extends core.WebPlugin {
21
+ class CapacitorStatusBarWeb extends core.WebPlugin {
22
22
  async setStyle(options) {
23
23
  console.log('setStyle', options);
24
24
  }
@@ -34,6 +34,12 @@ var capStatusBar = (function (exports, core) {
34
34
  async setBackground(options) {
35
35
  console.log('setBackground', options);
36
36
  }
37
+ async showNavigationBar(options) {
38
+ console.log('showNavigationBar', options);
39
+ }
40
+ async hideNavigationBar(options) {
41
+ console.log('hideNavigationBar', options);
42
+ }
37
43
  async getSafeAreaInsets() {
38
44
  // On web, we can use CSS environment variables to get safe area insets
39
45
  // These are set by the browser on devices with notches, etc.
@@ -54,10 +60,10 @@ var capStatusBar = (function (exports, core) {
54
60
 
55
61
  var web = /*#__PURE__*/Object.freeze({
56
62
  __proto__: null,
57
- StatusBarWeb: StatusBarWeb
63
+ CapacitorStatusBarWeb: CapacitorStatusBarWeb
58
64
  });
59
65
 
60
- exports.StatusBar = StatusBar;
66
+ exports.CapacitorStatusBar = CapacitorStatusBar;
61
67
 
62
68
  return exports;
63
69
 
@@ -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 StatusBar = registerPlugin('StatusBar', {\n web: () => import('./web').then((m) => new m.StatusBarWeb()),\n});\nexport * from './definitions';\nexport { StatusBar };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class StatusBarWeb 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;IAC1B,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,QAAQ;IAC9B,CAAC,EAAEA,aAAK,KAAKA,aAAK,GAAG,EAAE,CAAC,CAAC;AACdC;IACX,CAAC,UAAU,kBAAkB,EAAE;IAC/B,IAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG,MAAM;IACvC,IAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG,MAAM;IACvC,IAAI,kBAAkB,CAAC,OAAO,CAAC,GAAG,OAAO;IACzC,CAAC,EAAEA,0BAAkB,KAAKA,0BAAkB,GAAG,EAAE,CAAC,CAAC;;ACV9C,UAAC,SAAS,GAAGC,mBAAc,CAAC,WAAW,EAAE;IAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;IAChE,CAAC;;ICFM,MAAM,YAAY,SAASC,cAAS,CAAC;IAC5C,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;IAC5B,QAAQ,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC;IACxC,IAAI;IACJ,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,IAAI;IACJ,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,IAAI;IACJ,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;IACtC,QAAQ,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC;IAClD,IAAI;IACJ,IAAI,MAAM,aAAa,CAAC,OAAO,EAAE;IACjC,QAAQ,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC;IAC7C,IAAI;IACJ,IAAI,MAAM,iBAAiB,GAAG;IAC9B;IACA;IACA,QAAQ,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;;;;;;;;;;;;;;;"}
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 showNavigationBar(options) {\n console.log('showNavigationBar', options);\n }\n async hideNavigationBar(options) {\n console.log('hideNavigationBar', 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":"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"}
@@ -2,7 +2,7 @@ import Foundation
2
2
  import UIKit
3
3
  import Capacitor
4
4
 
5
- @objc public class StatusBar: NSObject {
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("StatusBar: Applying default style based on system theme - isDarkMode=\(isDarkMode), style=\(style)")
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("StatusBar: setStyle - overlay mode active, skipping background color")
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("StatusBar: setStyle - style=\(upperStyle), backgroundColor=\(String(describing: backgroundColor)), statusBarStyle=\(statusBarStyle)")
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("StatusBar: show() - Current hidden state: \(statusBarManager.isStatusBarHidden)")
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("StatusBar: hide() - animation=\(animationType), Current hidden state: \(statusBarManager.isStatusBarHidden)")
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("StatusBar: hide() - fade mode: making background transparent")
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("StatusBar: hide() - slide mode: hiding bars completely")
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("StatusBar: hide() - unknown animation type '\(animationType)', defaulting to slide")
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(StatusBar.statusBarViewTag)
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 = StatusBar.statusBarViewTag
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("StatusBar: setOverlaysWebView - Unable to get window or status bar manager")
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(StatusBar.statusBarViewTag)
190
+ let statusBarView = window.viewWithTag(CapacitorStatusBar.statusBarViewTag)
191
191
  statusBarView?.backgroundColor = .clear
192
- print("StatusBar: setOverlaysWebView(true) - content extends behind status bar")
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("StatusBar: setOverlaysWebView(false) - restored background color")
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("StatusBar: setOverlaysWebView(false) - applied default style from config")
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("StatusBar: setBackground - Invalid color or nil")
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("StatusBar: setBackground - Unable to get window")
218
+ print("CapacitorStatusBar: setBackground - Unable to get window")
219
219
  return
220
220
  }
221
221
 
222
222
  window.backgroundColor = color
223
- print("StatusBar: setBackground - Set window background to \(colorHex)")
223
+ print("CapacitorStatusBar: setBackground - Set window background to \(colorHex)")
224
224
  }
225
225
  }
226
226
 
@@ -242,25 +242,95 @@ import Capacitor
242
242
  insets["left"] = safeAreaInsets.left
243
243
  insets["right"] = safeAreaInsets.right
244
244
 
245
- print("StatusBar: getSafeAreaInsets - top=\(statusBarHeight), bottom=\(safeAreaInsets.bottom), left=\(safeAreaInsets.left), right=\(safeAreaInsets.right)")
245
+ print("CapacitorStatusBar: getSafeAreaInsets - top=\(statusBarHeight), bottom=\(safeAreaInsets.bottom), left=\(safeAreaInsets.left), right=\(safeAreaInsets.right)")
246
246
  } else {
247
- print("StatusBar: getSafeAreaInsets - Unable to get window, returning zero insets")
247
+ print("CapacitorStatusBar: getSafeAreaInsets - Unable to get window, returning zero insets")
248
248
  }
249
249
 
250
250
  completion(insets)
251
251
  }
252
252
  }
253
253
 
254
+ // MARK: - Navigation Bar (Home Indicator)
255
+
256
+ /// Shared flag read by the swizzled `prefersHomeIndicatorAutoHidden` override.
257
+ static var homeIndicatorHidden = false
258
+
259
+ @objc public func showNavigationBar(animated: Bool) {
260
+ DispatchQueue.main.async {
261
+ guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
262
+ let window = windowScene.windows.first,
263
+ let rootVC = window.rootViewController else {
264
+ print("CapacitorStatusBar: showNavigationBar - Unable to get root view controller")
265
+ return
266
+ }
267
+
268
+ CapacitorStatusBar.homeIndicatorHidden = false
269
+ CapacitorStatusBar.swizzleHomeIndicatorIfNeeded()
270
+ rootVC.setNeedsUpdateOfHomeIndicatorAutoHidden()
271
+
272
+ print("CapacitorStatusBar: showNavigationBar - animated=\(animated)")
273
+ }
274
+ }
275
+
276
+ @objc public func hideNavigationBar(animation: String) {
277
+ DispatchQueue.main.async {
278
+ guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
279
+ let window = windowScene.windows.first,
280
+ let rootVC = window.rootViewController else {
281
+ print("CapacitorStatusBar: hideNavigationBar - Unable to get root view controller")
282
+ return
283
+ }
284
+
285
+ let animationType = animation.lowercased()
286
+ CapacitorStatusBar.homeIndicatorHidden = true
287
+ CapacitorStatusBar.swizzleHomeIndicatorIfNeeded()
288
+ rootVC.setNeedsUpdateOfHomeIndicatorAutoHidden()
289
+
290
+ print("CapacitorStatusBar: hideNavigationBar - animation=\(animationType)")
291
+ }
292
+ }
293
+
294
+ // MARK: - Home Indicator Swizzling
295
+
296
+ private static var hasSwizzled = false
297
+
298
+ /// Swizzle `prefersHomeIndicatorAutoHidden` on the root view controller so we
299
+ /// can control the home indicator visibility from the plugin.
300
+ static func swizzleHomeIndicatorIfNeeded() {
301
+ guard !hasSwizzled else { return }
302
+ hasSwizzled = true
303
+
304
+ guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
305
+ let window = windowScene.windows.first,
306
+ let rootVC = window.rootViewController else {
307
+ return
308
+ }
309
+
310
+ let vcClass: AnyClass = type(of: rootVC)
311
+ let originalSelector = #selector(getter: UIViewController.prefersHomeIndicatorAutoHidden)
312
+ let swizzledSelector = #selector(UIViewController.capsb_prefersHomeIndicatorAutoHidden)
313
+
314
+ guard let originalMethod = class_getInstanceMethod(vcClass, originalSelector),
315
+ let swizzledMethod = class_getInstanceMethod(UIViewController.self, swizzledSelector) else {
316
+ print("CapacitorStatusBar: Failed to swizzle prefersHomeIndicatorAutoHidden")
317
+ return
318
+ }
319
+
320
+ method_exchangeImplementations(originalMethod, swizzledMethod)
321
+ print("CapacitorStatusBar: Swizzled prefersHomeIndicatorAutoHidden on \(vcClass)")
322
+ }
323
+
254
324
  /// Makes the status bar background view transparent
255
325
  private func makeStatusBarBackgroundTransparent() {
256
326
  guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
257
327
  let window = windowScene.windows.first,
258
- let statusBarView = window.viewWithTag(StatusBar.statusBarViewTag) else {
328
+ let statusBarView = window.viewWithTag(CapacitorStatusBar.statusBarViewTag) else {
259
329
  return
260
330
  }
261
331
 
262
332
  statusBarView.backgroundColor = .clear
263
- print("StatusBar: Made background transparent")
333
+ print("CapacitorStatusBar: Made background transparent")
264
334
  }
265
335
 
266
336
  /// Restores the status bar background view to its original color
@@ -276,7 +346,7 @@ import Capacitor
276
346
  self.updateStatusBarBackgroundView(in: window,
277
347
  height: statusBarManager.statusBarFrame.height,
278
348
  color: color)
279
- print("StatusBar: Restored background color: \(color)")
349
+ print("CapacitorStatusBar: Restored background color: \(color)")
280
350
  }
281
351
  }
282
352
 
@@ -329,3 +399,11 @@ import Capacitor
329
399
  return window.traitCollection.userInterfaceStyle == .dark
330
400
  }
331
401
  }
402
+
403
+ // MARK: - UIViewController extension for home indicator swizzling
404
+
405
+ extension UIViewController {
406
+ @objc func capsb_prefersHomeIndicatorAutoHidden() -> Bool {
407
+ return CapacitorStatusBar.homeIndicatorHidden
408
+ }
409
+ }
@@ -5,19 +5,21 @@ 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(StatusBarPlugin)
9
- public class StatusBarPlugin: CAPPlugin, CAPBridgedPlugin {
10
- public let identifier = "StatusBarPlugin"
11
- public let jsName = "StatusBar"
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),
15
15
  CAPPluginMethod(name: "hide", returnType: CAPPluginReturnPromise),
16
16
  CAPPluginMethod(name: "setOverlaysWebView", returnType: CAPPluginReturnPromise),
17
17
  CAPPluginMethod(name: "setBackground", returnType: CAPPluginReturnPromise),
18
+ CAPPluginMethod(name: "showNavigationBar", returnType: CAPPluginReturnPromise),
19
+ CAPPluginMethod(name: "hideNavigationBar", returnType: CAPPluginReturnPromise),
18
20
  CAPPluginMethod(name: "getSafeAreaInsets", returnType: CAPPluginReturnPromise)
19
21
  ]
20
- private let implementation = StatusBar()
22
+ private let implementation = CapacitorStatusBar()
21
23
 
22
24
  override public func load() {
23
25
  super.load()
@@ -68,6 +70,21 @@ public class StatusBarPlugin: CAPPlugin, CAPBridgedPlugin {
68
70
  call.resolve()
69
71
  }
70
72
 
73
+ @objc func showNavigationBar(_ call: CAPPluginCall) {
74
+ let animated = call.getBool("animated") ?? true
75
+ implementation.showNavigationBar(animated: animated)
76
+ call.resolve()
77
+ }
78
+
79
+ @objc func hideNavigationBar(_ call: CAPPluginCall) {
80
+ guard let animation = call.getString("animation") else {
81
+ call.reject("animation is required")
82
+ return
83
+ }
84
+ implementation.hideNavigationBar(animation: animation)
85
+ call.resolve()
86
+ }
87
+
71
88
  @objc func getSafeAreaInsets(_ call: CAPPluginCall) {
72
89
  implementation.getSafeAreaInsets { insets in
73
90
  call.resolve([
@@ -1,12 +1,12 @@
1
1
  import XCTest
2
- @testable import StatusBarPlugin
2
+ @testable import CapacitorStatusBarPlugin
3
3
 
4
- class StatusBarTests: XCTestCase {
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 = StatusBar()
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",
3
+ "version": "2.0.5",
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 StatusBarPlugin --output-readme README.md --output-json dist/docs.json",
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",