Skip to content

Commit 9a04a5d

Browse files
feat: Status Bar plugin (#58)
* Add status bar * edit plugin comment * Add license * update capacitor * docgen * fmt * update deps * docgen again Co-authored-by: Dan Imhoff <[email protected]>
1 parent 3a65a9a commit 9a04a5d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2274
-0
lines changed

lerna.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"network",
1212
"screen-reader",
1313
"share",
14+
"status-bar",
1415
"storage",
1516
"text-zoom",
1617
"toast"

status-bar/.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
dist

status-bar/.gitignore

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# node files
2+
dist
3+
node_modules
4+
5+
# iOS files
6+
Pods
7+
Podfile.lock
8+
Build
9+
xcuserdata
10+
11+
# macOS files
12+
.DS_Store
13+
14+
15+
16+
# Based on Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
17+
18+
# Built application files
19+
*.apk
20+
*.ap_
21+
22+
# Files for the ART/Dalvik VM
23+
*.dex
24+
25+
# Java class files
26+
*.class
27+
28+
# Generated files
29+
bin
30+
gen
31+
out
32+
33+
# Gradle files
34+
.gradle
35+
build
36+
37+
# Local configuration file (sdk path, etc)
38+
local.properties
39+
40+
# Proguard folder generated by Eclipse
41+
proguard
42+
43+
# Log Files
44+
*.log
45+
46+
# Android Studio Navigation editor temp files
47+
.navigation
48+
49+
# Android Studio captures folder
50+
captures
51+
52+
# IntelliJ
53+
*.iml
54+
.idea
55+
56+
# Keystore files
57+
# Uncomment the following line if you do not want to check your keystore files in.
58+
#*.jks
59+
60+
# External native build folder generated in Android Studio 2.2 and later
61+
.externalNativeBuild

status-bar/.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
dist
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 = 'CapacitorStatusBar'
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/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14+
s.ios.deployment_target = '11.0'
15+
s.dependency 'Capacitor'
16+
s.swift_version = '5.1'
17+
end

status-bar/LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright 2020-present Ionic
2+
https://ionic.io
3+
4+
MIT License
5+
6+
Permission is hereby granted, free of charge, to any person obtaining
7+
a copy of this software and associated documentation files (the
8+
"Software"), to deal in the Software without restriction, including
9+
without limitation the rights to use, copy, modify, merge, publish,
10+
distribute, sublicense, and/or sell copies of the Software, and to
11+
permit persons to whom the Software is furnished to do so, subject to
12+
the following conditions:
13+
14+
The above copyright notice and this permission notice shall be
15+
included in all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

status-bar/README.md

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# @capacitor/status-bar
2+
3+
The StatusBar API Provides methods for configuring the style of the Status Bar, along with showing or hiding it.
4+
5+
<!--DOCGEN_INDEX_START-->
6+
<div class="docgen docgen-index">
7+
8+
* [`setStyle(...)`](#setstyle)
9+
* [`setBackgroundColor(...)`](#setbackgroundcolor)
10+
* [`show(...)`](#show)
11+
* [`hide(...)`](#hide)
12+
* [`getInfo()`](#getinfo)
13+
* [`setOverlaysWebView(...)`](#setoverlayswebview)
14+
* [Interfaces](#interfaces)
15+
* [Enums](#enums)
16+
17+
</div>
18+
<!--DOCGEN_INDEX_END-->
19+
20+
<!--DOCGEN_API_START-->
21+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
22+
<div class="docgen docgen-api">
23+
24+
## API
25+
26+
### setStyle(...)
27+
28+
```typescript
29+
setStyle(options: StatusBarStyleOptions) => Promise<void>
30+
```
31+
32+
Set the current style of the status bar.
33+
34+
| Param | Type |
35+
| ------------- | ----------------------------------------------------------------------- |
36+
| **`options`** | <code><a href="#statusbarstyleoptions">StatusBarStyleOptions</a></code> |
37+
38+
**Returns:** <code>Promise&lt;void&gt;</code>
39+
40+
**Since:** 1.0.0
41+
42+
--------------------
43+
44+
45+
### setBackgroundColor(...)
46+
47+
```typescript
48+
setBackgroundColor(options: StatusBarBackgroundColorOptions) => Promise<void>
49+
```
50+
51+
Set the background color of the status bar.
52+
53+
This method is only supported on Android.
54+
55+
| Param | Type |
56+
| ------------- | ------------------------------------------------------------------------------------------- |
57+
| **`options`** | <code><a href="#statusbarbackgroundcoloroptions">StatusBarBackgroundColorOptions</a></code> |
58+
59+
**Returns:** <code>Promise&lt;void&gt;</code>
60+
61+
**Since:** 1.0.0
62+
63+
--------------------
64+
65+
66+
### show(...)
67+
68+
```typescript
69+
show(options?: StatusBarAnimationOptions | undefined) => Promise<void>
70+
```
71+
72+
Show the status bar.
73+
74+
| Param | Type |
75+
| ------------- | ------------------------------------------------------------------------------- |
76+
| **`options`** | <code><a href="#statusbaranimationoptions">StatusBarAnimationOptions</a></code> |
77+
78+
**Returns:** <code>Promise&lt;void&gt;</code>
79+
80+
**Since:** 1.0.0
81+
82+
--------------------
83+
84+
85+
### hide(...)
86+
87+
```typescript
88+
hide(options?: StatusBarAnimationOptions | undefined) => Promise<void>
89+
```
90+
91+
Hide the status bar.
92+
93+
| Param | Type |
94+
| ------------- | ------------------------------------------------------------------------------- |
95+
| **`options`** | <code><a href="#statusbaranimationoptions">StatusBarAnimationOptions</a></code> |
96+
97+
**Returns:** <code>Promise&lt;void&gt;</code>
98+
99+
**Since:** 1.0.0
100+
101+
--------------------
102+
103+
104+
### getInfo()
105+
106+
```typescript
107+
getInfo() => Promise<StatusBarInfoResult>
108+
```
109+
110+
Get info about the current state of the status bar.
111+
112+
**Returns:** <code>Promise&lt;<a href="#statusbarinforesult">StatusBarInfoResult</a>&gt;</code>
113+
114+
**Since:** 1.0.0
115+
116+
--------------------
117+
118+
119+
### setOverlaysWebView(...)
120+
121+
```typescript
122+
setOverlaysWebView(options: StatusBarOverlaysWebviewOptions) => Promise<void>
123+
```
124+
125+
Set whether or not the status bar should overlay the webview to allow usage
126+
of the space underneath it.
127+
128+
This method is only supported on Android.
129+
130+
| Param | Type |
131+
| ------------- | ------------------------------------------------------------------------------------------- |
132+
| **`options`** | <code><a href="#statusbaroverlayswebviewoptions">StatusBarOverlaysWebviewOptions</a></code> |
133+
134+
**Returns:** <code>Promise&lt;void&gt;</code>
135+
136+
**Since:** 1.0.0
137+
138+
--------------------
139+
140+
141+
### Interfaces
142+
143+
144+
#### StatusBarStyleOptions
145+
146+
| Prop | Type | Description | Since |
147+
| ----------- | --------------------------------------------------------- | ------------------------------------ | ----- |
148+
| **`style`** | <code><a href="#statusbarstyle">StatusBarStyle</a></code> | Style of the text of the status bar. | 1.0.0 |
149+
150+
151+
#### StatusBarBackgroundColorOptions
152+
153+
| Prop | Type | Description | Since |
154+
| ----------- | ------------------- | ------------------------------------------------------------------------------------------- | ----- |
155+
| **`color`** | <code>string</code> | A hex color to which the status bar color is set. This option is only supported on Android. | 1.0.0 |
156+
157+
158+
#### StatusBarAnimationOptions
159+
160+
| Prop | Type | Description | Since |
161+
| --------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | ----- |
162+
| **`animation`** | <code><a href="#statusbaranimation">StatusBarAnimation</a></code> | The type of status bar animation used when showing or hiding. This option is only supported on iOS. | 1.0.0 |
163+
164+
165+
#### StatusBarInfoResult
166+
167+
| Prop | Type | Description | Since |
168+
| -------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----- |
169+
| **`visible`** | <code>boolean</code> | Whether the status bar is visible or not. | 1.0.0 |
170+
| **`style`** | <code><a href="#statusbarstyle">StatusBarStyle</a></code> | The current status bar style. | 1.0.0 |
171+
| **`color`** | <code>string</code> | The current status bar color. This option is only supported on Android. | 1.0.0 |
172+
| **`overlays`** | <code>boolean</code> | Whether the statusbar is overlaid or not. This option is only supported on Android. | 1.0.0 |
173+
174+
175+
#### StatusBarOverlaysWebviewOptions
176+
177+
| Prop | Type | Description | Since |
178+
| ------------- | -------------------- | ----------------------------------------- | ----- |
179+
| **`overlay`** | <code>boolean</code> | Whether to overlay the status bar or not. | 1.0.0 |
180+
181+
182+
### Enums
183+
184+
185+
#### StatusBarStyle
186+
187+
| Members | Value | Description | Since |
188+
| ------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
189+
| **`Dark`** | <code>'DARK'</code> | Light text for dark backgrounds. | 1.0.0 |
190+
| **`Light`** | <code>'LIGHT'</code> | Dark text for light backgrounds. | 1.0.0 |
191+
| **`Default`** | <code>'DEFAULT'</code> | On iOS 13 and newer the style is based on the device appearance. If the device is using Dark mode, the statusbar text will be light. If the device is using Light mode, the statusbar text will be dark. On iOS 12 and older the statusbar text will be dark. On Android the default will be the one the app was launched with. | 1.0.0 |
192+
193+
194+
#### StatusBarAnimation
195+
196+
| Members | Value | Description | Since |
197+
| ----------- | -------------------- | --------------------------------- | ----- |
198+
| **`None`** | <code>'NONE'</code> | No animation during show/hide. | 1.0.0 |
199+
| **`Slide`** | <code>'SLIDE'</code> | Slide animation during show/hide. | 1.0.0 |
200+
| **`Fade`** | <code>'FADE'</code> | Fade animation during show/hide. | 1.0.0 |
201+
202+
</div>
203+
<!--DOCGEN_API_END-->

status-bar/android/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

status-bar/android/build.gradle

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
ext {
2+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.12'
3+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.1.0'
4+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.1'
5+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.2.0'
6+
}
7+
8+
buildscript {
9+
repositories {
10+
google()
11+
jcenter()
12+
}
13+
dependencies {
14+
classpath 'com.android.tools.build:gradle:4.0.1'
15+
}
16+
}
17+
18+
apply plugin: 'com.android.library'
19+
20+
android {
21+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 29
22+
defaultConfig {
23+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
24+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
25+
versionCode 1
26+
versionName "1.0"
27+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
28+
}
29+
buildTypes {
30+
release {
31+
minifyEnabled false
32+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
33+
}
34+
}
35+
lintOptions {
36+
abortOnError false
37+
}
38+
compileOptions {
39+
sourceCompatibility JavaVersion.VERSION_1_8
40+
targetCompatibility JavaVersion.VERSION_1_8
41+
}
42+
}
43+
44+
repositories {
45+
google()
46+
jcenter()
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+
}

0 commit comments

Comments
 (0)