capacitor-plugin-status-bar 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapacitorPluginStatusBar.podspec +17 -0
- package/LICENSE +21 -0
- package/Package.swift +28 -0
- package/README.md +221 -0
- package/android/build.gradle +58 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/cap/plugins/statusbar/StatusBar.java +691 -0
- package/android/src/main/java/com/cap/plugins/statusbar/StatusBarPlugin.java +120 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +332 -0
- package/dist/esm/definitions.d.ts +97 -0
- package/dist/esm/definitions.js +13 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +10 -0
- package/dist/esm/web.js +35 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +62 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +65 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/StatusBarPlugin/StatusBar.swift +325 -0
- package/ios/Sources/StatusBarPlugin/StatusBarPlugin.swift +81 -0
- package/ios/Tests/StatusBarPluginTests/StatusBarPluginTests.swift +15 -0
- package/package.json +99 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'CapacitorPluginStatusBar'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.homepage = package['repository']['url']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
|
+
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
+
s.ios.deployment_target = '15.0'
|
|
15
|
+
s.dependency 'Capacitor'
|
|
16
|
+
s.swift_version = '5.9'
|
|
17
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Abdelfatah Ashour
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/Package.swift
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "CapacitorPluginStatusBar",
|
|
6
|
+
platforms: [.iOS(.v15)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "CapacitorPluginStatusBar",
|
|
10
|
+
targets: ["StatusBarPlugin"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
|
|
14
|
+
],
|
|
15
|
+
targets: [
|
|
16
|
+
.target(
|
|
17
|
+
name: "StatusBarPlugin",
|
|
18
|
+
dependencies: [
|
|
19
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
|
+
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
|
+
],
|
|
22
|
+
path: "ios/Sources/StatusBarPlugin"),
|
|
23
|
+
.testTarget(
|
|
24
|
+
name: "StatusBarPluginTests",
|
|
25
|
+
dependencies: ["StatusBarPlugin"],
|
|
26
|
+
path: "ios/Tests/StatusBarPluginTests")
|
|
27
|
+
]
|
|
28
|
+
)
|
package/README.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# capacitor-plugin-status-bar
|
|
2
|
+
|
|
3
|
+
Capacitor status bar
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install capacitor-plugin-status-bar
|
|
9
|
+
npx cap sync
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Configuration
|
|
13
|
+
|
|
14
|
+
### iOS
|
|
15
|
+
|
|
16
|
+
For the `show()` and `hide()` methods to work on iOS, you need to configure your app's `Info.plist`:
|
|
17
|
+
|
|
18
|
+
1. Open `ios/App/App/Info.plist`
|
|
19
|
+
2. Add or modify the following key:
|
|
20
|
+
|
|
21
|
+
```xml
|
|
22
|
+
<key>UIViewControllerBasedStatusBarAppearance</key>
|
|
23
|
+
<false/>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Note:** Starting with iOS 13, Apple deprecated the application-level status bar control API in favor of view controller-based appearance. Setting `UIViewControllerBasedStatusBarAppearance` to `false` allows this plugin to control the status bar programmatically. This is the recommended approach for Capacitor plugins.
|
|
27
|
+
|
|
28
|
+
### Android
|
|
29
|
+
|
|
30
|
+
No additional configuration required. The plugin works out of the box on Android.
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
<docgen-index>
|
|
35
|
+
|
|
36
|
+
* [`setStyle(...)`](#setstyle)
|
|
37
|
+
* [`show(...)`](#show)
|
|
38
|
+
* [`hide(...)`](#hide)
|
|
39
|
+
* [`setOverlaysWebView(...)`](#setoverlayswebview)
|
|
40
|
+
* [`setBackground(...)`](#setbackground)
|
|
41
|
+
* [`getSafeAreaInsets()`](#getsafeareainsets)
|
|
42
|
+
* [Type Aliases](#type-aliases)
|
|
43
|
+
* [Enums](#enums)
|
|
44
|
+
|
|
45
|
+
</docgen-index>
|
|
46
|
+
|
|
47
|
+
<docgen-api>
|
|
48
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
49
|
+
|
|
50
|
+
### setStyle(...)
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
setStyle(options: StatusBarOptions) => Promise<void>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Set the status bar and navigation bar style and color.
|
|
57
|
+
|
|
58
|
+
| Param | Type | Description |
|
|
59
|
+
| ------------- | ----------------------------------------------------------------------- | ---------------------------------------------------- |
|
|
60
|
+
| **`options`** | <code><a href="#statusbarstyleoptions">StatusBarStyleOptions</a></code> | - The options to set the status bar style and color. |
|
|
61
|
+
|
|
62
|
+
--------------------
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### show(...)
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
show(options: StatusBarShowOptions) => Promise<void>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Show the status bar.
|
|
72
|
+
|
|
73
|
+
| Param | Type | Description |
|
|
74
|
+
| ------------- | --------------------------------------------------------------------- | ------------------------------------- |
|
|
75
|
+
| **`options`** | <code><a href="#statusbarshowoptions">StatusBarShowOptions</a></code> | - The options to show the status bar. |
|
|
76
|
+
|
|
77
|
+
--------------------
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### hide(...)
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
hide(options: StatusBarHideOptions) => Promise<void>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Hide the status bar.
|
|
87
|
+
|
|
88
|
+
| Param | Type | Description |
|
|
89
|
+
| ------------- | --------------------------------------------------------------------- | ------------------------------------- |
|
|
90
|
+
| **`options`** | <code><a href="#statusbarhideoptions">StatusBarHideOptions</a></code> | - The options to hide the status bar. |
|
|
91
|
+
|
|
92
|
+
--------------------
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
### setOverlaysWebView(...)
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
setOverlaysWebView(options: StatusBarSetOverlaysWebViewOptions) => Promise<void>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Set whether the status bar overlays the web view.
|
|
102
|
+
|
|
103
|
+
**iOS only** - On Android this is a no-op (resolves without error).
|
|
104
|
+
|
|
105
|
+
- `true`: Web content extends behind the status bar (transparent background),
|
|
106
|
+
allowing content to be visible through the status bar area on scroll.
|
|
107
|
+
- `false`: Restores the status bar background to the color set by `setStyle`
|
|
108
|
+
or falls back to the default style from Capacitor config.
|
|
109
|
+
|
|
110
|
+
| Param | Type | Description |
|
|
111
|
+
| ------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
112
|
+
| **`options`** | <code><a href="#statusbarsetoverlayswebviewoptions">StatusBarSetOverlaysWebViewOptions</a></code> | - The options to set the status bar overlays web view. |
|
|
113
|
+
|
|
114
|
+
--------------------
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### setBackground(...)
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
setBackground(options: StatusBarSetBackgroundOptions) => Promise<void>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Set the window background color.
|
|
124
|
+
|
|
125
|
+
| Param | Type | Description |
|
|
126
|
+
| ------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------- |
|
|
127
|
+
| **`options`** | <code><a href="#statusbarsetbackgroundoptions">StatusBarSetBackgroundOptions</a></code> | - The options to set the window background color. |
|
|
128
|
+
|
|
129
|
+
--------------------
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### getSafeAreaInsets()
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
getSafeAreaInsets() => Promise<SafeAreaInsets>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Get the safe area insets.
|
|
139
|
+
Returns the insets for status bar, navigation bar, and notch areas.
|
|
140
|
+
Values are in pixels on Android and points on iOS.
|
|
141
|
+
|
|
142
|
+
**Returns:** <code>Promise<<a href="#safeareainsets">SafeAreaInsets</a>></code>
|
|
143
|
+
|
|
144
|
+
--------------------
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
### Type Aliases
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
#### StatusBarOptions
|
|
151
|
+
|
|
152
|
+
<code><a href="#statusbarstyleoptions">StatusBarStyleOptions</a></code>
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
#### StatusBarStyleOptions
|
|
156
|
+
|
|
157
|
+
<code><a href="#statusbarstylenodefaultoptions">StatusBarStyleNoDefaultOptions</a> | { style: <a href="#style">Style.CUSTOM</a>; color: <a href="#statusbarcolor">StatusBarColor</a>; }</code>
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
#### StatusBarStyleNoDefaultOptions
|
|
161
|
+
|
|
162
|
+
<code>{ style: <a href="#style">Style</a>; }</code>
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
#### StatusBarColor
|
|
166
|
+
|
|
167
|
+
Full HEX color format only (6 or 8 digits).
|
|
168
|
+
- 6 digits: #RRGGBB (e.g., #FFFFFF, #000000, #FF5733)
|
|
169
|
+
- 8 digits: #RRGGBBAA with alpha channel (e.g., #FFFFFF00, #FF5733CC)
|
|
170
|
+
|
|
171
|
+
Note: Short 3-digit format (#FFF) is NOT supported.
|
|
172
|
+
|
|
173
|
+
<code>`#${string}`</code>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
#### StatusBarShowOptions
|
|
177
|
+
|
|
178
|
+
<code>{ animated: boolean; }</code>
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
#### StatusBarHideOptions
|
|
182
|
+
|
|
183
|
+
<code>{ /** * The animation type for hiding the status bar. * - 'fade': Makes the background transparent without removing the status bar and navigation bar. * - 'slide': Hides the status bar and navigation bar completely (default behavior). */ animation: <a href="#statusbaranimation">StatusBarAnimation</a>; }</code>
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
#### StatusBarSetOverlaysWebViewOptions
|
|
187
|
+
|
|
188
|
+
<code>{ value: boolean; }</code>
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
#### StatusBarSetBackgroundOptions
|
|
192
|
+
|
|
193
|
+
<code>{ color: <a href="#statusbarcolor">StatusBarColor</a>; }</code>
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
#### SafeAreaInsets
|
|
197
|
+
|
|
198
|
+
<code>{ top: number; bottom: number; left: number; right: number; }</code>
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
### Enums
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
#### Style
|
|
205
|
+
|
|
206
|
+
| Members | Value |
|
|
207
|
+
| ------------ | --------------------- |
|
|
208
|
+
| **`LIGHT`** | <code>'LIGHT'</code> |
|
|
209
|
+
| **`DARK`** | <code>'DARK'</code> |
|
|
210
|
+
| **`CUSTOM`** | <code>'CUSTOM'</code> |
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
#### StatusBarAnimation
|
|
214
|
+
|
|
215
|
+
| Members | Value |
|
|
216
|
+
| ----------- | -------------------- |
|
|
217
|
+
| **`NONE`** | <code>'none'</code> |
|
|
218
|
+
| **`FADE`** | <code>'fade'</code> |
|
|
219
|
+
| **`SLIDE`** | <code>'slide'</code> |
|
|
220
|
+
|
|
221
|
+
</docgen-api>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
ext {
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
buildscript {
|
|
9
|
+
repositories {
|
|
10
|
+
google()
|
|
11
|
+
mavenCentral()
|
|
12
|
+
}
|
|
13
|
+
dependencies {
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.13.0'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
apply plugin: 'com.android.library'
|
|
19
|
+
|
|
20
|
+
android {
|
|
21
|
+
namespace "com.cap.plugins.statusbar"
|
|
22
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
|
|
26
|
+
versionCode 1
|
|
27
|
+
versionName "1.0"
|
|
28
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
29
|
+
}
|
|
30
|
+
buildTypes {
|
|
31
|
+
release {
|
|
32
|
+
minifyEnabled false
|
|
33
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
lintOptions {
|
|
37
|
+
abortOnError false
|
|
38
|
+
}
|
|
39
|
+
compileOptions {
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_21
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_21
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
repositories {
|
|
46
|
+
google()
|
|
47
|
+
mavenCentral()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
dependencies {
|
|
52
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
53
|
+
implementation project(':capacitor-android')
|
|
54
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
55
|
+
testImplementation "junit:junit:$junitVersion"
|
|
56
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
57
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
58
|
+
}
|