@capacitor/status-bar 6.0.2 → 7.0.0-alpha.2
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/CapacitorStatusBar.podspec +1 -1
- package/Package.swift +2 -2
- package/README.md +61 -17
- package/android/build.gradle +10 -10
- package/android/src/main/java/com/capacitorjs/plugins/statusbar/StatusBar.java +45 -1
- package/android/src/main/java/com/capacitorjs/plugins/statusbar/StatusBarConfig.java +34 -0
- package/android/src/main/java/com/capacitorjs/plugins/statusbar/StatusBarInfo.java +12 -1
- package/android/src/main/java/com/capacitorjs/plugins/statusbar/StatusBarPlugin.java +45 -10
- package/dist/docs.json +74 -6
- package/dist/esm/definitions.d.ts +38 -10
- package/dist/esm/definitions.js +1 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/plugin.cjs.js +1 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/StatusBarPlugin/CAPBridgeViewController.swift +14 -0
- package/ios/Sources/StatusBarPlugin/CAPNotifications.swift +6 -0
- package/ios/Sources/StatusBarPlugin/StatusBar.swift +166 -0
- package/ios/Sources/StatusBarPlugin/StatusBarConfig.swift +7 -0
- package/ios/Sources/StatusBarPlugin/StatusBarInfo.swift +9 -0
- package/ios/Sources/StatusBarPlugin/StatusBarPlugin.swift +81 -53
- package/ios/Sources/StatusBarPlugin/UIColor.swift +40 -0
- package/package.json +10 -10
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
|
|
13
13
|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}', 'status-bar/ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target
|
|
14
|
+
s.ios.deployment_target = '14.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
|
17
17
|
end
|
package/Package.swift
CHANGED
|
@@ -4,14 +4,14 @@ import PackageDescription
|
|
|
4
4
|
|
|
5
5
|
let package = Package(
|
|
6
6
|
name: "CapacitorStatusBar",
|
|
7
|
-
platforms: [.iOS(.
|
|
7
|
+
platforms: [.iOS(.v14)],
|
|
8
8
|
products: [
|
|
9
9
|
.library(
|
|
10
10
|
name: "CapacitorStatusBar",
|
|
11
11
|
targets: ["StatusBarPlugin"])
|
|
12
12
|
],
|
|
13
13
|
dependencies: [
|
|
14
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git",
|
|
14
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main")
|
|
15
15
|
],
|
|
16
16
|
targets: [
|
|
17
17
|
.target(
|
package/README.md
CHANGED
|
@@ -20,9 +20,6 @@ The status bar visibility defaults to visible and the style defaults to
|
|
|
20
20
|
`Style.Default`. You can change these defaults by adding
|
|
21
21
|
`UIStatusBarHidden` and/or `UIStatusBarStyle` in `Info.plist`.
|
|
22
22
|
|
|
23
|
-
`setBackgroundColor` and `setOverlaysWebView` are currently not supported on
|
|
24
|
-
iOS devices.
|
|
25
|
-
|
|
26
23
|
## Example
|
|
27
24
|
|
|
28
25
|
```typescript
|
|
@@ -33,7 +30,7 @@ window.addEventListener('statusTap', function () {
|
|
|
33
30
|
console.log('statusbar tapped');
|
|
34
31
|
});
|
|
35
32
|
|
|
36
|
-
// Display content under transparent status bar
|
|
33
|
+
// Display content under transparent status bar
|
|
37
34
|
StatusBar.setOverlaysWebView({ overlay: true });
|
|
38
35
|
|
|
39
36
|
const setStatusBarStyleDark = async () => {
|
|
@@ -53,6 +50,57 @@ const showStatusBar = async () => {
|
|
|
53
50
|
};
|
|
54
51
|
```
|
|
55
52
|
|
|
53
|
+
## Configuration
|
|
54
|
+
|
|
55
|
+
<docgen-config>
|
|
56
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
57
|
+
|
|
58
|
+
These config values are available:
|
|
59
|
+
|
|
60
|
+
| Prop | Type | Description | Default | Since |
|
|
61
|
+
| --------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ----- |
|
|
62
|
+
| **`overlaysWebView`** | <code>boolean</code> | Whether the statusbar is overlaid or not. For applications targeting Android 15, this property has no effect unless the property windowOptOutEdgeToEdgeEnforcement is added to the application layout file. Otherwise, the application assumes always overlays as true. More details in https://developer.android.com/reference/android/R.attr#windowOptOutEdgeToEdgeEnforcement | <code>true</code> | 1.0.0 |
|
|
63
|
+
| **`style`** | <code>string</code> | <a href="#style">Style</a> of the text of the status bar. | <code>default</code> | 1.0.0 |
|
|
64
|
+
| **`backgroundColor`** | <code>string</code> | Color of the background of the statusbar in hex format, #RRGGBB. Doesn't work if `overlaysWebView` is true. | <code>#000000</code> | 1.0.0 |
|
|
65
|
+
|
|
66
|
+
### Examples
|
|
67
|
+
|
|
68
|
+
In `capacitor.config.json`:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"plugins": {
|
|
73
|
+
"StatusBar": {
|
|
74
|
+
"overlaysWebView": false,
|
|
75
|
+
"style": "DARK",
|
|
76
|
+
"backgroundColor": "#ffffffff"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
In `capacitor.config.ts`:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
/// <reference types="@capacitor/status-bar" />
|
|
86
|
+
|
|
87
|
+
import { CapacitorConfig } from '@capacitor/cli';
|
|
88
|
+
|
|
89
|
+
const config: CapacitorConfig = {
|
|
90
|
+
plugins: {
|
|
91
|
+
StatusBar: {
|
|
92
|
+
overlaysWebView: false,
|
|
93
|
+
style: "DARK",
|
|
94
|
+
backgroundColor: "#ffffffff",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default config;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
</docgen-config>
|
|
103
|
+
|
|
56
104
|
## API
|
|
57
105
|
|
|
58
106
|
<docgen-index>
|
|
@@ -96,8 +144,6 @@ setBackgroundColor(options: BackgroundColorOptions) => Promise<void>
|
|
|
96
144
|
|
|
97
145
|
Set the background color of the status bar.
|
|
98
146
|
|
|
99
|
-
This method is only supported on Android.
|
|
100
|
-
|
|
101
147
|
| Param | Type |
|
|
102
148
|
| ------------- | ------------------------------------------------------------------------- |
|
|
103
149
|
| **`options`** | <code><a href="#backgroundcoloroptions">BackgroundColorOptions</a></code> |
|
|
@@ -169,8 +215,6 @@ setOverlaysWebView(options: SetOverlaysWebViewOptions) => Promise<void>
|
|
|
169
215
|
Set whether or not the status bar should overlay the webview to allow usage
|
|
170
216
|
of the space underneath it.
|
|
171
217
|
|
|
172
|
-
This method is only supported on Android.
|
|
173
|
-
|
|
174
218
|
| Param | Type |
|
|
175
219
|
| ------------- | ------------------------------------------------------------------------------- |
|
|
176
220
|
| **`options`** | <code><a href="#setoverlayswebviewoptions">SetOverlaysWebViewOptions</a></code> |
|
|
@@ -192,9 +236,9 @@ This method is only supported on Android.
|
|
|
192
236
|
|
|
193
237
|
#### BackgroundColorOptions
|
|
194
238
|
|
|
195
|
-
| Prop | Type | Description
|
|
196
|
-
| ----------- | ------------------- |
|
|
197
|
-
| **`color`** | <code>string</code> | A hex color to which the status bar color is set.
|
|
239
|
+
| Prop | Type | Description | Since |
|
|
240
|
+
| ----------- | ------------------- | ------------------------------------------------- | ----- |
|
|
241
|
+
| **`color`** | <code>string</code> | A hex color to which the status bar color is set. | 1.0.0 |
|
|
198
242
|
|
|
199
243
|
|
|
200
244
|
#### AnimationOptions
|
|
@@ -206,12 +250,12 @@ This method is only supported on Android.
|
|
|
206
250
|
|
|
207
251
|
#### StatusBarInfo
|
|
208
252
|
|
|
209
|
-
| Prop | Type | Description
|
|
210
|
-
| -------------- | --------------------------------------- |
|
|
211
|
-
| **`visible`** | <code>boolean</code> | Whether the status bar is visible or not.
|
|
212
|
-
| **`style`** | <code><a href="#style">Style</a></code> | The current status bar style.
|
|
213
|
-
| **`color`** | <code>string</code> | The current status bar color.
|
|
214
|
-
| **`overlays`** | <code>boolean</code> | Whether the statusbar is overlaid or not.
|
|
253
|
+
| Prop | Type | Description | Since |
|
|
254
|
+
| -------------- | --------------------------------------- | ----------------------------------------- | ----- |
|
|
255
|
+
| **`visible`** | <code>boolean</code> | Whether the status bar is visible or not. | 1.0.0 |
|
|
256
|
+
| **`style`** | <code><a href="#style">Style</a></code> | The current status bar style. | 1.0.0 |
|
|
257
|
+
| **`color`** | <code>string</code> | The current status bar color. | 1.0.0 |
|
|
258
|
+
| **`overlays`** | <code>boolean</code> | Whether the statusbar is overlaid or not. | 1.0.0 |
|
|
215
259
|
|
|
216
260
|
|
|
217
261
|
#### SetOverlaysWebViewOptions
|
package/android/build.gradle
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
capacitorVersion = System.getenv('CAPACITOR_VERSION')
|
|
3
3
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
4
|
-
androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.
|
|
5
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.
|
|
6
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1
|
|
7
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
4
|
+
androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.15.0'
|
|
5
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
|
6
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
|
|
7
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
buildscript {
|
|
@@ -16,7 +16,7 @@ buildscript {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
dependencies {
|
|
19
|
-
classpath 'com.android.tools.build:gradle:8.2
|
|
19
|
+
classpath 'com.android.tools.build:gradle:8.7.2'
|
|
20
20
|
if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
|
|
21
21
|
classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
|
|
22
22
|
}
|
|
@@ -32,10 +32,10 @@ if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
|
|
|
32
32
|
|
|
33
33
|
android {
|
|
34
34
|
namespace "com.capacitorjs.plugins.statusbar"
|
|
35
|
-
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
35
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
|
|
36
36
|
defaultConfig {
|
|
37
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
38
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
37
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
|
|
38
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
|
|
39
39
|
versionCode 1
|
|
40
40
|
versionName "1.0"
|
|
41
41
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -50,8 +50,8 @@ android {
|
|
|
50
50
|
abortOnError false
|
|
51
51
|
}
|
|
52
52
|
compileOptions {
|
|
53
|
-
sourceCompatibility JavaVersion.
|
|
54
|
-
targetCompatibility JavaVersion.
|
|
53
|
+
sourceCompatibility JavaVersion.VERSION_21
|
|
54
|
+
targetCompatibility JavaVersion.VERSION_21
|
|
55
55
|
}
|
|
56
56
|
publishing {
|
|
57
57
|
singleVariant("release")
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
package com.capacitorjs.plugins.statusbar;
|
|
2
2
|
|
|
3
3
|
import android.graphics.Color;
|
|
4
|
+
import android.os.Build;
|
|
5
|
+
import android.util.DisplayMetrics;
|
|
4
6
|
import android.view.View;
|
|
5
7
|
import android.view.Window;
|
|
8
|
+
import android.view.WindowInsets;
|
|
6
9
|
import android.view.WindowManager;
|
|
7
10
|
import androidx.appcompat.app.AppCompatActivity;
|
|
8
11
|
import androidx.core.view.ViewCompat;
|
|
@@ -12,15 +15,27 @@ import androidx.core.view.WindowInsetsControllerCompat;
|
|
|
12
15
|
|
|
13
16
|
public class StatusBar {
|
|
14
17
|
|
|
18
|
+
public static final String statusBarVisibilityChanged = "statusBarVisibilityChanged";
|
|
19
|
+
public static final String statusBarOverlayChanged = "statusBarOverlayChanged";
|
|
20
|
+
|
|
15
21
|
private int currentStatusBarColor;
|
|
22
|
+
private final ChangeListener listener;
|
|
16
23
|
private final AppCompatActivity activity;
|
|
17
24
|
private final String defaultStyle;
|
|
18
25
|
|
|
19
|
-
public StatusBar(AppCompatActivity activity) {
|
|
26
|
+
public StatusBar(AppCompatActivity activity, StatusBarConfig config, ChangeListener listener) {
|
|
20
27
|
// save initial color of the status bar
|
|
21
28
|
this.activity = activity;
|
|
22
29
|
this.currentStatusBarColor = activity.getWindow().getStatusBarColor();
|
|
30
|
+
this.listener = listener;
|
|
23
31
|
this.defaultStyle = getStyle();
|
|
32
|
+
|
|
33
|
+
setBackgroundColor(config.getBackgroundColor());
|
|
34
|
+
setStyle(config.getStyle());
|
|
35
|
+
setOverlaysWebView(config.isOverlaysWebView());
|
|
36
|
+
StatusBarInfo info = getInfo();
|
|
37
|
+
info.setVisible(true);
|
|
38
|
+
listener.onChange(statusBarOverlayChanged, info);
|
|
24
39
|
}
|
|
25
40
|
|
|
26
41
|
public void setStyle(String style) {
|
|
@@ -49,12 +64,18 @@ public class StatusBar {
|
|
|
49
64
|
View decorView = activity.getWindow().getDecorView();
|
|
50
65
|
WindowInsetsControllerCompat windowInsetsControllerCompat = WindowCompat.getInsetsController(activity.getWindow(), decorView);
|
|
51
66
|
windowInsetsControllerCompat.hide(WindowInsetsCompat.Type.statusBars());
|
|
67
|
+
StatusBarInfo info = getInfo();
|
|
68
|
+
info.setVisible(false);
|
|
69
|
+
listener.onChange(statusBarVisibilityChanged, info);
|
|
52
70
|
}
|
|
53
71
|
|
|
54
72
|
public void show() {
|
|
55
73
|
View decorView = activity.getWindow().getDecorView();
|
|
56
74
|
WindowInsetsControllerCompat windowInsetsControllerCompat = WindowCompat.getInsetsController(activity.getWindow(), decorView);
|
|
57
75
|
windowInsetsControllerCompat.show(WindowInsetsCompat.Type.statusBars());
|
|
76
|
+
StatusBarInfo info = getInfo();
|
|
77
|
+
info.setVisible(true);
|
|
78
|
+
listener.onChange(statusBarVisibilityChanged, info);
|
|
58
79
|
}
|
|
59
80
|
|
|
60
81
|
@SuppressWarnings("deprecation")
|
|
@@ -74,6 +95,7 @@ public class StatusBar {
|
|
|
74
95
|
// recover the previous color of the status bar
|
|
75
96
|
activity.getWindow().setStatusBarColor(currentStatusBarColor);
|
|
76
97
|
}
|
|
98
|
+
listener.onChange(statusBarOverlayChanged, getInfo());
|
|
77
99
|
}
|
|
78
100
|
|
|
79
101
|
@SuppressWarnings("deprecation")
|
|
@@ -93,6 +115,7 @@ public class StatusBar {
|
|
|
93
115
|
info.setOverlays(getIsOverlaid());
|
|
94
116
|
info.setVisible(isVisible);
|
|
95
117
|
info.setColor(String.format("#%06X", (0xFFFFFF & window.getStatusBarColor())));
|
|
118
|
+
info.setHeight(getStatusBarHeight());
|
|
96
119
|
return info;
|
|
97
120
|
}
|
|
98
121
|
|
|
@@ -105,4 +128,25 @@ public class StatusBar {
|
|
|
105
128
|
}
|
|
106
129
|
return style;
|
|
107
130
|
}
|
|
131
|
+
|
|
132
|
+
private int getStatusBarHeight() {
|
|
133
|
+
DisplayMetrics metrics = activity.getResources().getDisplayMetrics();
|
|
134
|
+
|
|
135
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
136
|
+
WindowInsets insets = activity.getWindowManager().getCurrentWindowMetrics().getWindowInsets();
|
|
137
|
+
return (int) (insets.getInsets(WindowInsets.Type.statusBars()).top / metrics.density);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
WindowInsets insets = activity.getWindow().getDecorView().getRootWindowInsets();
|
|
141
|
+
if (insets != null) {
|
|
142
|
+
return (int) (insets.getSystemWindowInsetTop() / metrics.density);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Fallback if the insets are not available
|
|
146
|
+
return 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public interface ChangeListener {
|
|
150
|
+
void onChange(String eventName, StatusBarInfo info);
|
|
151
|
+
}
|
|
108
152
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
package com.capacitorjs.plugins.statusbar;
|
|
2
|
+
|
|
3
|
+
import com.getcapacitor.util.WebColor;
|
|
4
|
+
|
|
5
|
+
public class StatusBarConfig {
|
|
6
|
+
|
|
7
|
+
private boolean overlaysWebView = true;
|
|
8
|
+
private Integer backgroundColor = WebColor.parseColor("#000000");
|
|
9
|
+
private String style = "DEFAULT";
|
|
10
|
+
|
|
11
|
+
public boolean isOverlaysWebView() {
|
|
12
|
+
return overlaysWebView;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public void setOverlaysWebView(boolean overlaysWebView) {
|
|
16
|
+
this.overlaysWebView = overlaysWebView;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public Integer getBackgroundColor() {
|
|
20
|
+
return backgroundColor;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public void setBackgroundColor(Integer backgroundColor) {
|
|
24
|
+
this.backgroundColor = backgroundColor;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public String getStyle() {
|
|
28
|
+
return style;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public void setStyle(String style) {
|
|
32
|
+
this.style = style;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
package com.capacitorjs.plugins.statusbar;
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import java.io.Serializable;
|
|
4
|
+
|
|
5
|
+
public class StatusBarInfo implements Serializable {
|
|
4
6
|
|
|
5
7
|
private boolean overlays;
|
|
6
8
|
private boolean visible;
|
|
7
9
|
private String style;
|
|
8
10
|
private String color;
|
|
11
|
+
private int height;
|
|
9
12
|
|
|
10
13
|
public boolean isOverlays() {
|
|
11
14
|
return overlays;
|
|
@@ -38,4 +41,12 @@ public class StatusBarInfo {
|
|
|
38
41
|
public void setColor(String color) {
|
|
39
42
|
this.color = color;
|
|
40
43
|
}
|
|
44
|
+
|
|
45
|
+
public int getHeight() {
|
|
46
|
+
return height;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public void setHeight(int height) {
|
|
50
|
+
this.height = height;
|
|
51
|
+
}
|
|
41
52
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.capacitorjs.plugins.statusbar;
|
|
2
2
|
|
|
3
3
|
import com.getcapacitor.JSObject;
|
|
4
|
+
import com.getcapacitor.Logger;
|
|
4
5
|
import com.getcapacitor.Plugin;
|
|
5
6
|
import com.getcapacitor.PluginCall;
|
|
6
7
|
import com.getcapacitor.PluginMethod;
|
|
@@ -15,7 +16,37 @@ public class StatusBarPlugin extends Plugin {
|
|
|
15
16
|
|
|
16
17
|
@Override
|
|
17
18
|
public void load() {
|
|
18
|
-
|
|
19
|
+
StatusBarConfig config = getStatusBarConfig();
|
|
20
|
+
implementation = new StatusBar(getActivity(), config, (eventName, info) -> notifyListeners(eventName, toJSObject(info), true));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private StatusBarConfig getStatusBarConfig() {
|
|
24
|
+
StatusBarConfig config = new StatusBarConfig();
|
|
25
|
+
String backgroundColor = getConfig().getString("backgroundColor");
|
|
26
|
+
if (backgroundColor != null) {
|
|
27
|
+
try {
|
|
28
|
+
config.setBackgroundColor(WebColor.parseColor(backgroundColor));
|
|
29
|
+
} catch (IllegalArgumentException ex) {
|
|
30
|
+
Logger.debug("Background color not applied");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
config.setStyle(styleFromConfig(getConfig().getString("style", config.getStyle())));
|
|
34
|
+
config.setOverlaysWebView(getConfig().getBoolean("overlaysWebView", config.isOverlaysWebView()));
|
|
35
|
+
return config;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private String styleFromConfig(String style) {
|
|
39
|
+
switch (style.toLowerCase()) {
|
|
40
|
+
case "lightcontent":
|
|
41
|
+
case "dark":
|
|
42
|
+
return "DARK";
|
|
43
|
+
case "darkcontent":
|
|
44
|
+
case "light":
|
|
45
|
+
return "LIGHT";
|
|
46
|
+
case "default":
|
|
47
|
+
default:
|
|
48
|
+
return "DEFAULT";
|
|
49
|
+
}
|
|
19
50
|
}
|
|
20
51
|
|
|
21
52
|
@PluginMethod
|
|
@@ -84,24 +115,28 @@ public class StatusBarPlugin extends Plugin {
|
|
|
84
115
|
@PluginMethod
|
|
85
116
|
public void getInfo(final PluginCall call) {
|
|
86
117
|
StatusBarInfo info = implementation.getInfo();
|
|
87
|
-
|
|
88
|
-
JSObject data = new JSObject();
|
|
89
|
-
data.put("visible", info.isVisible());
|
|
90
|
-
data.put("style", info.getStyle());
|
|
91
|
-
data.put("color", info.getColor());
|
|
92
|
-
data.put("overlays", info.isOverlays());
|
|
93
|
-
call.resolve(data);
|
|
118
|
+
call.resolve(toJSObject(info));
|
|
94
119
|
}
|
|
95
120
|
|
|
96
121
|
@PluginMethod
|
|
97
122
|
public void setOverlaysWebView(final PluginCall call) {
|
|
98
|
-
final Boolean
|
|
123
|
+
final Boolean overlay = call.getBoolean("overlay", true);
|
|
99
124
|
getBridge()
|
|
100
125
|
.executeOnMainThread(
|
|
101
126
|
() -> {
|
|
102
|
-
implementation.setOverlaysWebView(
|
|
127
|
+
implementation.setOverlaysWebView(overlay);
|
|
103
128
|
call.resolve();
|
|
104
129
|
}
|
|
105
130
|
);
|
|
106
131
|
}
|
|
132
|
+
|
|
133
|
+
private JSObject toJSObject(StatusBarInfo info) {
|
|
134
|
+
JSObject data = new JSObject();
|
|
135
|
+
data.put("visible", info.isVisible());
|
|
136
|
+
data.put("style", info.getStyle());
|
|
137
|
+
data.put("color", info.getColor());
|
|
138
|
+
data.put("overlays", info.isOverlays());
|
|
139
|
+
data.put("height", info.getHeight());
|
|
140
|
+
return data;
|
|
141
|
+
}
|
|
107
142
|
}
|
package/dist/docs.json
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"text": "1.0.0"
|
|
46
46
|
}
|
|
47
47
|
],
|
|
48
|
-
"docs": "Set the background color of the status bar
|
|
48
|
+
"docs": "Set the background color of the status bar.",
|
|
49
49
|
"complexTypes": [
|
|
50
50
|
"BackgroundColorOptions"
|
|
51
51
|
],
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
"text": "1.0.0"
|
|
132
132
|
}
|
|
133
133
|
],
|
|
134
|
-
"docs": "Set whether or not the status bar should overlay the webview to allow usage\nof the space underneath it
|
|
134
|
+
"docs": "Set whether or not the status bar should overlay the webview to allow usage\nof the space underneath it.",
|
|
135
135
|
"complexTypes": [
|
|
136
136
|
"SetOverlaysWebViewOptions"
|
|
137
137
|
],
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
"name": "since"
|
|
180
180
|
}
|
|
181
181
|
],
|
|
182
|
-
"docs": "A hex color to which the status bar color is set
|
|
182
|
+
"docs": "A hex color to which the status bar color is set.",
|
|
183
183
|
"complexTypes": [],
|
|
184
184
|
"type": "string"
|
|
185
185
|
}
|
|
@@ -253,7 +253,7 @@
|
|
|
253
253
|
"name": "since"
|
|
254
254
|
}
|
|
255
255
|
],
|
|
256
|
-
"docs": "The current status bar color
|
|
256
|
+
"docs": "The current status bar color.",
|
|
257
257
|
"complexTypes": [],
|
|
258
258
|
"type": "string | undefined"
|
|
259
259
|
},
|
|
@@ -265,7 +265,7 @@
|
|
|
265
265
|
"name": "since"
|
|
266
266
|
}
|
|
267
267
|
],
|
|
268
|
-
"docs": "Whether the statusbar is overlaid or not
|
|
268
|
+
"docs": "Whether the statusbar is overlaid or not.",
|
|
269
269
|
"complexTypes": [],
|
|
270
270
|
"type": "boolean | undefined"
|
|
271
271
|
}
|
|
@@ -378,5 +378,73 @@
|
|
|
378
378
|
}
|
|
379
379
|
],
|
|
380
380
|
"typeAliases": [],
|
|
381
|
-
"pluginConfigs": [
|
|
381
|
+
"pluginConfigs": [
|
|
382
|
+
{
|
|
383
|
+
"name": "StatusBar",
|
|
384
|
+
"slug": "statusbar",
|
|
385
|
+
"properties": [
|
|
386
|
+
{
|
|
387
|
+
"name": "overlaysWebView",
|
|
388
|
+
"tags": [
|
|
389
|
+
{
|
|
390
|
+
"text": "1.0.0",
|
|
391
|
+
"name": "since"
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
"text": "true",
|
|
395
|
+
"name": "default"
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"text": "false",
|
|
399
|
+
"name": "example"
|
|
400
|
+
}
|
|
401
|
+
],
|
|
402
|
+
"docs": "Whether the statusbar is overlaid or not.\nFor applications targeting Android 15, this property has no effect unless\nthe property windowOptOutEdgeToEdgeEnforcement is added to the application layout file.\nOtherwise, the application assumes always overlays as true.\nMore details in https://developer.android.com/reference/android/R.attr#windowOptOutEdgeToEdgeEnforcement",
|
|
403
|
+
"complexTypes": [],
|
|
404
|
+
"type": "boolean | undefined"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"name": "style",
|
|
408
|
+
"tags": [
|
|
409
|
+
{
|
|
410
|
+
"text": "1.0.0",
|
|
411
|
+
"name": "since"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"text": "default",
|
|
415
|
+
"name": "default"
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"text": "\"DARK\"",
|
|
419
|
+
"name": "example"
|
|
420
|
+
}
|
|
421
|
+
],
|
|
422
|
+
"docs": "Style of the text of the status bar.",
|
|
423
|
+
"complexTypes": [],
|
|
424
|
+
"type": "string | undefined"
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"name": "backgroundColor",
|
|
428
|
+
"tags": [
|
|
429
|
+
{
|
|
430
|
+
"text": "1.0.0",
|
|
431
|
+
"name": "since"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"text": "#000000",
|
|
435
|
+
"name": "default"
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"text": "\"#ffffffff\"",
|
|
439
|
+
"name": "example"
|
|
440
|
+
}
|
|
441
|
+
],
|
|
442
|
+
"docs": "Color of the background of the statusbar in hex format, #RRGGBB.\nDoesn't work if `overlaysWebView` is true.",
|
|
443
|
+
"complexTypes": [],
|
|
444
|
+
"type": "string | undefined"
|
|
445
|
+
}
|
|
446
|
+
],
|
|
447
|
+
"docs": "These config values are available:"
|
|
448
|
+
}
|
|
449
|
+
]
|
|
382
450
|
}
|
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
declare module '@capacitor/cli' {
|
|
2
|
+
interface PluginsConfig {
|
|
3
|
+
/**
|
|
4
|
+
* These config values are available:
|
|
5
|
+
*/
|
|
6
|
+
StatusBar?: {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the statusbar is overlaid or not.
|
|
9
|
+
* For applications targeting Android 15, this property has no effect unless
|
|
10
|
+
* the property windowOptOutEdgeToEdgeEnforcement is added to the application layout file.
|
|
11
|
+
* Otherwise, the application assumes always overlays as true.
|
|
12
|
+
* More details in https://developer.android.com/reference/android/R.attr#windowOptOutEdgeToEdgeEnforcement
|
|
13
|
+
*
|
|
14
|
+
* @since 1.0.0
|
|
15
|
+
* @default true
|
|
16
|
+
* @example false
|
|
17
|
+
*/
|
|
18
|
+
overlaysWebView?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Style of the text of the status bar.
|
|
21
|
+
*
|
|
22
|
+
* @since 1.0.0
|
|
23
|
+
* @default default
|
|
24
|
+
* @example "DARK"
|
|
25
|
+
*/
|
|
26
|
+
style?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Color of the background of the statusbar in hex format, #RRGGBB.
|
|
29
|
+
* Doesn't work if `overlaysWebView` is true.
|
|
30
|
+
*
|
|
31
|
+
* @since 1.0.0
|
|
32
|
+
* @default #000000
|
|
33
|
+
* @example "#ffffffff"
|
|
34
|
+
*/
|
|
35
|
+
backgroundColor?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
1
39
|
export interface StyleOptions {
|
|
2
40
|
/**
|
|
3
41
|
* Style of the text of the status bar.
|
|
@@ -68,8 +106,6 @@ export interface BackgroundColorOptions {
|
|
|
68
106
|
/**
|
|
69
107
|
* A hex color to which the status bar color is set.
|
|
70
108
|
*
|
|
71
|
-
* This option is only supported on Android.
|
|
72
|
-
*
|
|
73
109
|
* @since 1.0.0
|
|
74
110
|
*/
|
|
75
111
|
color: string;
|
|
@@ -90,16 +126,12 @@ export interface StatusBarInfo {
|
|
|
90
126
|
/**
|
|
91
127
|
* The current status bar color.
|
|
92
128
|
*
|
|
93
|
-
* This option is only supported on Android.
|
|
94
|
-
*
|
|
95
129
|
* @since 1.0.0
|
|
96
130
|
*/
|
|
97
131
|
color?: string;
|
|
98
132
|
/**
|
|
99
133
|
* Whether the statusbar is overlaid or not.
|
|
100
134
|
*
|
|
101
|
-
* This option is only supported on Android.
|
|
102
|
-
*
|
|
103
135
|
* @since 1.0.0
|
|
104
136
|
*/
|
|
105
137
|
overlays?: boolean;
|
|
@@ -122,8 +154,6 @@ export interface StatusBarPlugin {
|
|
|
122
154
|
/**
|
|
123
155
|
* Set the background color of the status bar.
|
|
124
156
|
*
|
|
125
|
-
* This method is only supported on Android.
|
|
126
|
-
*
|
|
127
157
|
* @since 1.0.0
|
|
128
158
|
*/
|
|
129
159
|
setBackgroundColor(options: BackgroundColorOptions): Promise<void>;
|
|
@@ -153,8 +183,6 @@ export interface StatusBarPlugin {
|
|
|
153
183
|
* Set whether or not the status bar should overlay the webview to allow usage
|
|
154
184
|
* of the space underneath it.
|
|
155
185
|
*
|
|
156
|
-
* This method is only supported on Android.
|
|
157
|
-
*
|
|
158
186
|
* @since 1.0.0
|
|
159
187
|
*/
|
|
160
188
|
setOverlaysWebView(options: SetOverlaysWebViewOptions): Promise<void>;
|
package/dist/esm/definitions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAoDxC,MAAM,CAAN,IAAY,KAwBX;AAxBD,WAAY,KAAK;IACf;;;;OAIG;IACH,sBAAa,CAAA;IAEb;;;;OAIG;IACH,wBAAe,CAAA;IAEf;;;;;;;OAOG;IACH,4BAAmB,CAAA;AACrB,CAAC,EAxBW,KAAK,KAAL,KAAK,QAwBhB;AAeD,MAAM,CAAN,IAAY,SAwBX;AAxBD,WAAY,SAAS;IACnB;;;;OAIG;IACH,0BAAa,CAAA;IAEb;;;;;;;OAOG;IACH,4BAAe,CAAA;IAEf;;;;OAIG;IACH,0BAAa,CAAA;AACf,CAAC,EAxBW,SAAS,KAAT,SAAS,QAwBpB;AAiID;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * These config values are available:\n */\n StatusBar?: {\n /**\n * Whether the statusbar is overlaid or not.\n * For applications targeting Android 15, this property has no effect unless\n * the property windowOptOutEdgeToEdgeEnforcement is added to the application layout file.\n * Otherwise, the application assumes always overlays as true.\n * More details in https://developer.android.com/reference/android/R.attr#windowOptOutEdgeToEdgeEnforcement\n *\n * @since 1.0.0\n * @default true\n * @example false\n */\n overlaysWebView?: boolean;\n\n /**\n * Style of the text of the status bar.\n *\n * @since 1.0.0\n * @default default\n * @example \"DARK\"\n */\n style?: string;\n\n /**\n * Color of the background of the statusbar in hex format, #RRGGBB.\n * Doesn't work if `overlaysWebView` is true.\n *\n * @since 1.0.0\n * @default #000000\n * @example \"#ffffffff\"\n */\n backgroundColor?: string;\n };\n }\n}\n\nexport interface StyleOptions {\n /**\n * Style of the text of the status bar.\n *\n * @since 1.0.0\n */\n style: Style;\n}\n\nexport enum Style {\n /**\n * Light text for dark backgrounds.\n *\n * @since 1.0.0\n */\n Dark = 'DARK',\n\n /**\n * Dark text for light backgrounds.\n *\n * @since 1.0.0\n */\n Light = 'LIGHT',\n\n /**\n * The style is based on the device appearance.\n * If the device is using Dark mode, the statusbar text will be light.\n * If the device is using Light mode, the statusbar text will be dark.\n * On Android the default will be the one the app was launched with.\n *\n * @since 1.0.0\n */\n Default = 'DEFAULT',\n}\n\nexport interface AnimationOptions {\n /**\n * The type of status bar animation used when showing or hiding.\n *\n * This option is only supported on iOS.\n *\n * @default Animation.Fade\n *\n * @since 1.0.0\n */\n animation: Animation;\n}\n\nexport enum Animation {\n /**\n * No animation during show/hide.\n *\n * @since 1.0.0\n */\n None = 'NONE',\n\n /**\n * Slide animation during show/hide.\n * It doesn't work on iOS 15+.\n *\n * @deprecated Use Animation.Fade or Animation.None instead.\n *\n * @since 1.0.0\n */\n Slide = 'SLIDE',\n\n /**\n * Fade animation during show/hide.\n *\n * @since 1.0.0\n */\n Fade = 'FADE',\n}\n\nexport interface BackgroundColorOptions {\n /**\n * A hex color to which the status bar color is set.\n *\n * @since 1.0.0\n */\n color: string;\n}\n\nexport interface StatusBarInfo {\n /**\n * Whether the status bar is visible or not.\n *\n * @since 1.0.0\n */\n visible: boolean;\n\n /**\n * The current status bar style.\n *\n * @since 1.0.0\n */\n style: Style;\n\n /**\n * The current status bar color.\n *\n * @since 1.0.0\n */\n color?: string;\n\n /**\n * Whether the statusbar is overlaid or not.\n *\n * @since 1.0.0\n */\n overlays?: boolean;\n}\n\nexport interface SetOverlaysWebViewOptions {\n /**\n * Whether to overlay the status bar or not.\n *\n * @since 1.0.0\n */\n overlay: boolean;\n}\n\nexport interface StatusBarPlugin {\n /**\n * Set the current style of the status bar.\n *\n * @since 1.0.0\n */\n setStyle(options: StyleOptions): Promise<void>;\n\n /**\n * Set the background color of the status bar.\n *\n * @since 1.0.0\n */\n setBackgroundColor(options: BackgroundColorOptions): Promise<void>;\n\n /**\n * Show the status bar.\n * On iOS, if the status bar is initially hidden and the initial style is set to\n * `UIStatusBarStyleLightContent`, first show call might present a glitch on the\n * animation showing the text as dark and then transition to light. It's recommended\n * to use `Animation.None` as the animation on the first call.\n *\n * @since 1.0.0\n */\n show(options?: AnimationOptions): Promise<void>;\n\n /**\n * Hide the status bar.\n *\n * @since 1.0.0\n */\n hide(options?: AnimationOptions): Promise<void>;\n\n /**\n * Get info about the current state of the status bar.\n *\n * @since 1.0.0\n */\n getInfo(): Promise<StatusBarInfo>;\n\n /**\n * Set whether or not the status bar should overlay the webview to allow usage\n * of the space underneath it.\n *\n * @since 1.0.0\n */\n setOverlaysWebView(options: SetOverlaysWebViewOptions): Promise<void>;\n}\n\n/**\n * @deprecated Use `StyleOptions`.\n * @since 1.0.0\n */\nexport type StatusBarStyleOptions = StyleOptions;\n\n/**\n * @deprecated Use `BackgroundColorOptions`.\n * @since 1.0.0\n */\nexport type StatusBarBackgroundColorOptions = BackgroundColorOptions;\n\n/**\n * @deprecated Use `SetOverlaysWebViewOptions`.\n * @since 1.0.0\n */\nexport type StatusBarOverlaysWebviewOptions = SetOverlaysWebViewOptions;\n\n/**\n * @deprecated Use `StatusBarInfo`.\n * @since 1.0.0\n */\nexport type StatusBarInfoResult = StatusBarInfo;\n\n/**\n * @deprecated Use `AnimationOptions`.\n * @since 1.0.0\n */\nexport type StatusBarAnimationOptions = AnimationOptions;\n\n/**\n * @deprecated Use `Animation`.\n * @since 1.0.0\n */\nexport const StatusBarAnimation = Animation;\n\n/**\n * @deprecated Use `Style`.\n * @since 1.0.0\n */\nexport const StatusBarStyle = Style;\n"]}
|
package/dist/plugin.cjs.js
CHANGED
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js"],"sourcesContent":["/// <reference types=\"@capacitor/cli\" />\nexport var Style;\n(function (Style) {\n /**\n * Light text for dark backgrounds.\n *\n * @since 1.0.0\n */\n Style[\"Dark\"] = \"DARK\";\n /**\n * Dark text for light backgrounds.\n *\n * @since 1.0.0\n */\n Style[\"Light\"] = \"LIGHT\";\n /**\n * The style is based on the device appearance.\n * If the device is using Dark mode, the statusbar text will be light.\n * If the device is using Light mode, the statusbar text will be dark.\n * On Android the default will be the one the app was launched with.\n *\n * @since 1.0.0\n */\n Style[\"Default\"] = \"DEFAULT\";\n})(Style || (Style = {}));\nexport var Animation;\n(function (Animation) {\n /**\n * No animation during show/hide.\n *\n * @since 1.0.0\n */\n Animation[\"None\"] = \"NONE\";\n /**\n * Slide animation during show/hide.\n * It doesn't work on iOS 15+.\n *\n * @deprecated Use Animation.Fade or Animation.None instead.\n *\n * @since 1.0.0\n */\n Animation[\"Slide\"] = \"SLIDE\";\n /**\n * Fade animation during show/hide.\n *\n * @since 1.0.0\n */\n Animation[\"Fade\"] = \"FADE\";\n})(Animation || (Animation = {}));\n/**\n * @deprecated Use `Animation`.\n * @since 1.0.0\n */\nexport const StatusBarAnimation = Animation;\n/**\n * @deprecated Use `Style`.\n * @since 1.0.0\n */\nexport const StatusBarStyle = Style;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst StatusBar = registerPlugin('StatusBar');\nexport * from './definitions';\nexport { StatusBar };\n//# sourceMappingURL=index.js.map"],"names":["Style","Animation","registerPlugin"],"mappings":";;;;AAAA;AACWA;AACX,CAAC,UAAU,KAAK,EAAE;AAClB;AACA;AACA;AACA;AACA;AACA,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;AAC1B;AACA;AACA;AACA;AACA;AACA,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,KAAK,CAAC,SAAS,CAAC,GAAG,SAAS;AAChC,CAAC,EAAEA,aAAK,KAAKA,aAAK,GAAG,EAAE,CAAC,CAAC;AACdC;AACX,CAAC,UAAU,SAAS,EAAE;AACtB;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO;AAChC;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM;AAC9B,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;AACjC;AACA;AACA;AACA;AACY,MAAC,kBAAkB,GAAGA;AAClC;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAGD;;ACzDzB,MAAC,SAAS,GAAGE,mBAAc,CAAC,WAAW;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var capacitorStatusBar = (function (exports, core) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
/// <reference types="@capacitor/cli" />
|
|
4
5
|
exports.Style = void 0;
|
|
5
6
|
(function (Style) {
|
|
6
7
|
/**
|
|
@@ -66,8 +67,6 @@ var capacitorStatusBar = (function (exports, core) {
|
|
|
66
67
|
exports.StatusBarAnimation = StatusBarAnimation;
|
|
67
68
|
exports.StatusBarStyle = StatusBarStyle;
|
|
68
69
|
|
|
69
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
70
|
-
|
|
71
70
|
return exports;
|
|
72
71
|
|
|
73
72
|
})({}, capacitorExports);
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js"],"sourcesContent":["/// <reference types=\"@capacitor/cli\" />\nexport var Style;\n(function (Style) {\n /**\n * Light text for dark backgrounds.\n *\n * @since 1.0.0\n */\n Style[\"Dark\"] = \"DARK\";\n /**\n * Dark text for light backgrounds.\n *\n * @since 1.0.0\n */\n Style[\"Light\"] = \"LIGHT\";\n /**\n * The style is based on the device appearance.\n * If the device is using Dark mode, the statusbar text will be light.\n * If the device is using Light mode, the statusbar text will be dark.\n * On Android the default will be the one the app was launched with.\n *\n * @since 1.0.0\n */\n Style[\"Default\"] = \"DEFAULT\";\n})(Style || (Style = {}));\nexport var Animation;\n(function (Animation) {\n /**\n * No animation during show/hide.\n *\n * @since 1.0.0\n */\n Animation[\"None\"] = \"NONE\";\n /**\n * Slide animation during show/hide.\n * It doesn't work on iOS 15+.\n *\n * @deprecated Use Animation.Fade or Animation.None instead.\n *\n * @since 1.0.0\n */\n Animation[\"Slide\"] = \"SLIDE\";\n /**\n * Fade animation during show/hide.\n *\n * @since 1.0.0\n */\n Animation[\"Fade\"] = \"FADE\";\n})(Animation || (Animation = {}));\n/**\n * @deprecated Use `Animation`.\n * @since 1.0.0\n */\nexport const StatusBarAnimation = Animation;\n/**\n * @deprecated Use `Style`.\n * @since 1.0.0\n */\nexport const StatusBarStyle = Style;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst StatusBar = registerPlugin('StatusBar');\nexport * from './definitions';\nexport { StatusBar };\n//# sourceMappingURL=index.js.map"],"names":["Style","Animation","registerPlugin"],"mappings":";;;IAAA;AACWA;IACX,CAAC,UAAU,KAAK,EAAE;IAClB;IACA;IACA;IACA;IACA;IACA,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAC1B;IACA;IACA;IACA;IACA;IACA,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO;IAC5B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,KAAK,CAAC,SAAS,CAAC,GAAG,SAAS;IAChC,CAAC,EAAEA,aAAK,KAAKA,aAAK,GAAG,EAAE,CAAC,CAAC;AACdC;IACX,CAAC,UAAU,SAAS,EAAE;IACtB;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM;IAC9B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO;IAChC;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM;IAC9B,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;IACjC;IACA;IACA;IACA;AACY,UAAC,kBAAkB,GAAGA;IAClC;IACA;IACA;IACA;AACY,UAAC,cAAc,GAAGD;;ACzDzB,UAAC,SAAS,GAAGE,mBAAc,CAAC,WAAW;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Capacitor
|
|
2
|
+
|
|
3
|
+
extension CAPBridgeViewController {
|
|
4
|
+
|
|
5
|
+
override open func viewDidAppear(_ animated: Bool) {
|
|
6
|
+
super.viewDidAppear(animated)
|
|
7
|
+
NotificationCenter.default.post(Notification(name: .capacitorViewDidAppear))
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
override open func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
|
|
11
|
+
super.viewWillTransition(to: size, with: coordinator)
|
|
12
|
+
NotificationCenter.default.post(Notification(name: .capacitorViewWillTransition))
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
public class StatusBar {
|
|
5
|
+
|
|
6
|
+
private var bridge: CAPBridgeProtocol
|
|
7
|
+
private var isOverlayingWebview = true
|
|
8
|
+
private var backgroundColor = UIColor.black
|
|
9
|
+
private var backgroundView: UIView?
|
|
10
|
+
private var observers: [NSObjectProtocol] = []
|
|
11
|
+
|
|
12
|
+
init(bridge: CAPBridgeProtocol, config: StatusBarConfig) {
|
|
13
|
+
self.bridge = bridge
|
|
14
|
+
setupObservers(with: config)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
deinit {
|
|
18
|
+
observers.forEach { NotificationCenter.default.removeObserver($0) }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private func setupObservers(with config: StatusBarConfig) {
|
|
22
|
+
observers.append(NotificationCenter.default.addObserver(forName: .capacitorViewDidAppear, object: .none, queue: .none) { [weak self] _ in
|
|
23
|
+
self?.handleViewDidAppear(config: config)
|
|
24
|
+
})
|
|
25
|
+
observers.append(NotificationCenter.default.addObserver(forName: .capacitorStatusBarTapped, object: .none, queue: .none) { [weak self] _ in
|
|
26
|
+
self?.bridge.triggerJSEvent(eventName: "statusTap", target: "window")
|
|
27
|
+
})
|
|
28
|
+
observers.append(NotificationCenter.default.addObserver(forName: .capacitorViewWillTransition, object: .none, queue: .none) { [weak self] _ in
|
|
29
|
+
self?.handleViewWillTransition()
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private func handleViewDidAppear(config: StatusBarConfig) {
|
|
34
|
+
setStyle(config.style)
|
|
35
|
+
setBackgroundColor(config.backgroundColor)
|
|
36
|
+
setOverlaysWebView(config.overlaysWebView)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private func handleViewWillTransition() {
|
|
40
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
|
|
41
|
+
self?.resizeStatusBarBackgroundView()
|
|
42
|
+
self?.resizeWebView()
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
func setStyle(_ style: UIStatusBarStyle) {
|
|
47
|
+
bridge.statusBarStyle = style
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
func setBackgroundColor(_ color: UIColor) {
|
|
51
|
+
backgroundColor = color
|
|
52
|
+
backgroundView?.backgroundColor = color
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
func setAnimation(_ animation: String) {
|
|
56
|
+
if animation == "SLIDE" {
|
|
57
|
+
bridge.statusBarAnimation = .slide
|
|
58
|
+
} else if animation == "NONE" {
|
|
59
|
+
bridge.statusBarAnimation = .none
|
|
60
|
+
} else {
|
|
61
|
+
bridge.statusBarAnimation = .fade
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
func hide(animation: String) {
|
|
66
|
+
setAnimation(animation)
|
|
67
|
+
if bridge.statusBarVisible {
|
|
68
|
+
bridge.statusBarVisible = false
|
|
69
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
|
|
70
|
+
self?.resizeWebView()
|
|
71
|
+
self?.backgroundView?.removeFromSuperview()
|
|
72
|
+
self?.backgroundView?.isHidden = true
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
func show(animation: String) {
|
|
78
|
+
setAnimation(animation)
|
|
79
|
+
if !bridge.statusBarVisible {
|
|
80
|
+
bridge.statusBarVisible = true
|
|
81
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [self] in
|
|
82
|
+
resizeWebView()
|
|
83
|
+
if !isOverlayingWebview {
|
|
84
|
+
resizeStatusBarBackgroundView()
|
|
85
|
+
bridge.webView?.superview?.addSubview(backgroundView!)
|
|
86
|
+
}
|
|
87
|
+
backgroundView?.isHidden = false
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
func getInfo() -> StatusBarInfo {
|
|
93
|
+
let style: String
|
|
94
|
+
switch bridge.statusBarStyle {
|
|
95
|
+
case .default:
|
|
96
|
+
style = "DEFAULT"
|
|
97
|
+
case .lightContent:
|
|
98
|
+
style = "DARK"
|
|
99
|
+
case .darkContent:
|
|
100
|
+
style = "LIGHT"
|
|
101
|
+
@unknown default:
|
|
102
|
+
style = "DEFAULT"
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return StatusBarInfo(
|
|
106
|
+
overlays: isOverlayingWebview,
|
|
107
|
+
visible: bridge.statusBarVisible,
|
|
108
|
+
style: style,
|
|
109
|
+
color: UIColor.capacitor.hex(fromColor: backgroundColor),
|
|
110
|
+
height: getStatusBarFrame().size.height
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
func setOverlaysWebView(_ overlay: Bool) {
|
|
115
|
+
if overlay == isOverlayingWebview { return }
|
|
116
|
+
isOverlayingWebview = overlay
|
|
117
|
+
if overlay {
|
|
118
|
+
backgroundView?.removeFromSuperview()
|
|
119
|
+
} else {
|
|
120
|
+
initializeBackgroundViewIfNeeded()
|
|
121
|
+
bridge.webView?.superview?.addSubview(backgroundView!)
|
|
122
|
+
}
|
|
123
|
+
resizeWebView()
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private func resizeWebView() {
|
|
127
|
+
guard
|
|
128
|
+
let webView = bridge.webView,
|
|
129
|
+
let bounds = bridge.viewController?.view.window?.windowScene?.screen.bounds
|
|
130
|
+
else { return }
|
|
131
|
+
bridge.viewController?.view.frame = bounds
|
|
132
|
+
webView.frame = bounds
|
|
133
|
+
let statusBarHeight = getStatusBarFrame().size.height
|
|
134
|
+
var webViewFrame = webView.frame
|
|
135
|
+
|
|
136
|
+
if isOverlayingWebview {
|
|
137
|
+
let safeAreaTop = webView.safeAreaInsets.top
|
|
138
|
+
if statusBarHeight >= safeAreaTop && safeAreaTop > 0 {
|
|
139
|
+
webViewFrame.origin.y = safeAreaTop == 40 ? 20 : statusBarHeight - safeAreaTop
|
|
140
|
+
} else {
|
|
141
|
+
webViewFrame.origin.y = 0
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
webViewFrame.origin.y = statusBarHeight
|
|
145
|
+
}
|
|
146
|
+
webViewFrame.size.height -= webViewFrame.origin.y
|
|
147
|
+
webView.frame = webViewFrame
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private func resizeStatusBarBackgroundView() {
|
|
151
|
+
backgroundView?.frame = getStatusBarFrame()
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private func getStatusBarFrame() -> CGRect {
|
|
155
|
+
return UIApplication.shared.windows.first(where: { $0.isKeyWindow })?.windowScene?.statusBarManager?.statusBarFrame ?? .zero
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
private func initializeBackgroundViewIfNeeded() {
|
|
159
|
+
if backgroundView == nil {
|
|
160
|
+
backgroundView = UIView(frame: getStatusBarFrame())
|
|
161
|
+
backgroundView!.backgroundColor = backgroundColor
|
|
162
|
+
backgroundView!.autoresizingMask = [.flexibleWidth, .flexibleBottomMargin]
|
|
163
|
+
backgroundView!.isHidden = !bridge.statusBarVisible
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -17,90 +17,118 @@ public class StatusBarPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
17
17
|
CAPPluginMethod(name: "getInfo", returnType: CAPPluginReturnPromise),
|
|
18
18
|
CAPPluginMethod(name: "setOverlaysWebView", returnType: CAPPluginReturnPromise)
|
|
19
19
|
]
|
|
20
|
-
private var
|
|
20
|
+
private var statusBar: StatusBar?
|
|
21
|
+
private let statusBarVisibilityChanged = "statusBarVisibilityChanged"
|
|
22
|
+
private let statusBarOverlayChanged = "statusBarOverlayChanged"
|
|
21
23
|
|
|
22
24
|
override public func load() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
guard let bridge = bridge else { return }
|
|
26
|
+
statusBar = StatusBar(bridge: bridge, config: statusBarConfig())
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private func statusBarConfig() -> StatusBarConfig {
|
|
30
|
+
var config = StatusBarConfig()
|
|
31
|
+
config.overlaysWebView = getConfig().getBoolean("overlaysWebView", config.overlaysWebView)
|
|
32
|
+
if let colorConfig = getConfig().getString("backgroundColor"), let color = UIColor.capacitor.color(fromHex: colorConfig) {
|
|
33
|
+
config.backgroundColor = color
|
|
34
|
+
}
|
|
35
|
+
if let configStyle = getConfig().getString("style") {
|
|
36
|
+
config.style = style(fromString: configStyle)
|
|
25
37
|
}
|
|
38
|
+
return config
|
|
26
39
|
}
|
|
27
40
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
private func style(fromString: String) -> UIStatusBarStyle {
|
|
42
|
+
switch fromString.lowercased() {
|
|
43
|
+
case "dark", "lightcontent":
|
|
44
|
+
return .lightContent
|
|
45
|
+
case "light", "darkcontent":
|
|
46
|
+
return .darkContent
|
|
47
|
+
case "default":
|
|
48
|
+
return .default
|
|
49
|
+
default:
|
|
50
|
+
return .default
|
|
31
51
|
}
|
|
32
52
|
}
|
|
33
53
|
|
|
34
54
|
@objc func setStyle(_ call: CAPPluginCall) {
|
|
35
55
|
let options = call.options!
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if style == "DARK" {
|
|
39
|
-
bridge?.statusBarStyle = .lightContent
|
|
40
|
-
} else if style == "LIGHT" {
|
|
41
|
-
bridge?.statusBarStyle = .darkContent
|
|
42
|
-
} else if style == "DEFAULT" {
|
|
43
|
-
bridge?.statusBarStyle = .default
|
|
44
|
-
}
|
|
56
|
+
if let styleString = options["style"] as? String {
|
|
57
|
+
statusBar?.setStyle(style(fromString: styleString))
|
|
45
58
|
}
|
|
46
|
-
|
|
47
59
|
call.resolve([:])
|
|
48
60
|
}
|
|
49
61
|
|
|
50
62
|
@objc func setBackgroundColor(_ call: CAPPluginCall) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
bridge?.statusBarAnimation = .slide
|
|
58
|
-
} else if animation == "NONE" {
|
|
59
|
-
bridge?.statusBarAnimation = .none
|
|
60
|
-
} else {
|
|
61
|
-
bridge?.statusBarAnimation = .fade
|
|
63
|
+
guard
|
|
64
|
+
let hexString = call.options["color"] as? String,
|
|
65
|
+
let color = UIColor.capacitor.color(fromHex: hexString)
|
|
66
|
+
else { return }
|
|
67
|
+
DispatchQueue.main.async { [weak self] in
|
|
68
|
+
self?.statusBar?.setBackgroundColor(color)
|
|
62
69
|
}
|
|
70
|
+
call.resolve()
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
@objc func hide(_ call: CAPPluginCall) {
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
let animation = call.getString("animation", "FADE")
|
|
75
|
+
DispatchQueue.main.async { [weak self] in
|
|
76
|
+
self?.statusBar?.hide(animation: animation)
|
|
77
|
+
guard
|
|
78
|
+
let info = self?.statusBar?.getInfo(),
|
|
79
|
+
let dict = self?.toDict(info),
|
|
80
|
+
let event = self?.statusBarVisibilityChanged
|
|
81
|
+
else { return }
|
|
82
|
+
self?.notifyListeners(event, data: dict)
|
|
83
|
+
}
|
|
68
84
|
call.resolve()
|
|
69
85
|
}
|
|
70
86
|
|
|
71
87
|
@objc func show(_ call: CAPPluginCall) {
|
|
72
|
-
|
|
73
|
-
|
|
88
|
+
let animation = call.getString("animation", "FADE")
|
|
89
|
+
DispatchQueue.main.async { [weak self] in
|
|
90
|
+
self?.statusBar?.show(animation: animation)
|
|
91
|
+
guard
|
|
92
|
+
let info = self?.statusBar?.getInfo(),
|
|
93
|
+
let dict = self?.toDict(info),
|
|
94
|
+
let event = self?.statusBarVisibilityChanged
|
|
95
|
+
else { return }
|
|
96
|
+
self?.notifyListeners(event, data: dict)
|
|
97
|
+
}
|
|
74
98
|
call.resolve()
|
|
75
99
|
}
|
|
76
100
|
|
|
77
101
|
@objc func getInfo(_ call: CAPPluginCall) {
|
|
78
102
|
DispatchQueue.main.async { [weak self] in
|
|
79
|
-
guard
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
case .default:
|
|
85
|
-
if bridge.userInterfaceStyle == UIUserInterfaceStyle.dark {
|
|
86
|
-
style = "DARK"
|
|
87
|
-
} else {
|
|
88
|
-
style = "LIGHT"
|
|
89
|
-
}
|
|
90
|
-
case .lightContent:
|
|
91
|
-
style = "DARK"
|
|
92
|
-
default:
|
|
93
|
-
style = "LIGHT"
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
call.resolve([
|
|
97
|
-
"visible": bridge.statusBarVisible,
|
|
98
|
-
"style": style
|
|
99
|
-
])
|
|
103
|
+
guard
|
|
104
|
+
let info = self?.statusBar?.getInfo(),
|
|
105
|
+
let dict = self?.toDict(info)
|
|
106
|
+
else { return }
|
|
107
|
+
call.resolve(dict)
|
|
100
108
|
}
|
|
101
109
|
}
|
|
102
110
|
|
|
103
111
|
@objc func setOverlaysWebView(_ call: CAPPluginCall) {
|
|
104
|
-
call.
|
|
112
|
+
guard let overlay = call.options["overlay"] as? Bool else { return }
|
|
113
|
+
DispatchQueue.main.async { [weak self] in
|
|
114
|
+
self?.statusBar?.setOverlaysWebView(overlay)
|
|
115
|
+
guard
|
|
116
|
+
let info = self?.statusBar?.getInfo(),
|
|
117
|
+
let dict = self?.toDict(info),
|
|
118
|
+
let event = self?.statusBarOverlayChanged
|
|
119
|
+
else { return }
|
|
120
|
+
self?.notifyListeners(event, data: dict)
|
|
121
|
+
}
|
|
122
|
+
call.resolve()
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private func toDict(_ info: StatusBarInfo) -> [String: Any] {
|
|
126
|
+
return [
|
|
127
|
+
"visible": info.visible!,
|
|
128
|
+
"style": info.style!,
|
|
129
|
+
"color": info.color!,
|
|
130
|
+
"overlays": info.overlays!,
|
|
131
|
+
"height": info.height!
|
|
132
|
+
]
|
|
105
133
|
}
|
|
106
134
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Capacitor
|
|
2
|
+
|
|
3
|
+
public extension CapacitorExtensionTypeWrapper where T: UIColor {
|
|
4
|
+
|
|
5
|
+
static func hex(fromColor: UIColor) -> String? {
|
|
6
|
+
var red: CGFloat = 0
|
|
7
|
+
var green: CGFloat = 0
|
|
8
|
+
var blue: CGFloat = 0
|
|
9
|
+
var alpha: CGFloat = 0
|
|
10
|
+
|
|
11
|
+
guard fromColor.getRed(&red, green: &green, blue: &blue, alpha: &alpha) else {
|
|
12
|
+
assertionFailure("Failed to get RGBA components from UIColor")
|
|
13
|
+
return nil
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
red = max(0, min(1, red))
|
|
17
|
+
green = max(0, min(1, green))
|
|
18
|
+
blue = max(0, min(1, blue))
|
|
19
|
+
alpha = max(0, min(1, alpha))
|
|
20
|
+
|
|
21
|
+
if alpha == 1 {
|
|
22
|
+
// RGB
|
|
23
|
+
return String(
|
|
24
|
+
format: "#%02lX%02lX%02lX",
|
|
25
|
+
Int(round(red * 255)),
|
|
26
|
+
Int(round(green * 255)),
|
|
27
|
+
Int(round(blue * 255))
|
|
28
|
+
)
|
|
29
|
+
} else {
|
|
30
|
+
// RGBA
|
|
31
|
+
return String(
|
|
32
|
+
format: "#%02lX%02lX%02lX%02lX",
|
|
33
|
+
Int(round(red * 255)),
|
|
34
|
+
Int(round(green * 255)),
|
|
35
|
+
Int(round(blue * 255)),
|
|
36
|
+
Int(round(alpha * 255))
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/status-bar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.2",
|
|
4
4
|
"description": "The StatusBar API Provides methods for configuring the style of the Status Bar, along with showing or hiding it.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
33
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
34
|
-
"verify:ios": "xcodebuild build -scheme CapacitorStatusBar -
|
|
34
|
+
"verify:ios": "xcodebuild build -scheme CapacitorStatusBar -destination generic/platform=iOS",
|
|
35
35
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
36
36
|
"verify:web": "npm run build",
|
|
37
37
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
@@ -40,30 +40,30 @@
|
|
|
40
40
|
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
41
41
|
"swiftlint": "node-swiftlint",
|
|
42
42
|
"docgen": "docgen --api StatusBarPlugin --output-readme README.md --output-json dist/docs.json",
|
|
43
|
-
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.
|
|
43
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
44
44
|
"clean": "rimraf ./dist",
|
|
45
45
|
"watch": "tsc --watch",
|
|
46
46
|
"prepublishOnly": "npm run build",
|
|
47
47
|
"publish:cocoapod": "pod trunk push ./CapacitorStatusBar.podspec --allow-warnings"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@capacitor/android": "
|
|
51
|
-
"@capacitor/core": "
|
|
50
|
+
"@capacitor/android": "next",
|
|
51
|
+
"@capacitor/core": "next",
|
|
52
52
|
"@capacitor/docgen": "0.2.2",
|
|
53
|
-
"@capacitor/ios": "
|
|
53
|
+
"@capacitor/ios": "next",
|
|
54
54
|
"@ionic/eslint-config": "^0.4.0",
|
|
55
55
|
"@ionic/prettier-config": "~1.0.1",
|
|
56
56
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
57
57
|
"eslint": "^8.57.0",
|
|
58
58
|
"prettier": "~2.3.0",
|
|
59
59
|
"prettier-plugin-java": "~1.0.2",
|
|
60
|
-
"rimraf": "^
|
|
61
|
-
"rollup": "^
|
|
60
|
+
"rimraf": "^6.0.1",
|
|
61
|
+
"rollup": "^4.26.0",
|
|
62
62
|
"swiftlint": "^1.0.1",
|
|
63
63
|
"typescript": "~4.1.5"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@capacitor/core": "
|
|
66
|
+
"@capacitor/core": "next"
|
|
67
67
|
},
|
|
68
68
|
"prettier": "@ionic/prettier-config",
|
|
69
69
|
"swiftlint": "@ionic/swiftlint-config",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "023f53b42a81049b7cdef6c7b0102b85b4df1c01"
|
|
85
85
|
}
|