@capgo/capacitor-navigation-bar 8.1.7 → 8.2.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/README.md +53 -0
- package/android/src/main/java/ee/forgr/capacitor_navigation_bar/CapgoNavigationBarPlugin.java +177 -69
- package/dist/docs.json +95 -1
- package/dist/esm/definitions.d.ts +61 -0
- package/dist/esm/definitions.js +1 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +2 -0
- package/dist/esm/web.js +6 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +7 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +7 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapgoNavigationBarPlugin/CapgoNavigationBarPlugin.swift +16 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -35,11 +35,34 @@ npx cap sync
|
|
|
35
35
|
|
|
36
36
|
- `example-app`: Interactive showcase that exercises all plugin options (color presets, custom hex, dark buttons, state reading).
|
|
37
37
|
|
|
38
|
+
## Configuration
|
|
39
|
+
|
|
40
|
+
You can apply navigation bar defaults when the native plugin loads:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import type { CapacitorConfig } from '@capacitor/cli';
|
|
44
|
+
|
|
45
|
+
const config: CapacitorConfig = {
|
|
46
|
+
plugins: {
|
|
47
|
+
NavigationBar: {
|
|
48
|
+
color: '#ffffff',
|
|
49
|
+
dividerColor: '#d9d9d9',
|
|
50
|
+
style: 'LIGHT',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default config;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`style` accepts `LIGHT`, `DARK`, or `DEFAULT`. Use `LIGHT` for dark buttons, `DARK` for light buttons, and `DEFAULT` to follow the current device appearance.
|
|
38
59
|
|
|
39
60
|
## API
|
|
40
61
|
|
|
41
62
|
<docgen-index>
|
|
42
63
|
|
|
64
|
+
* [`hide()`](#hide)
|
|
65
|
+
* [`show()`](#show)
|
|
43
66
|
* [`setNavigationBarColor(...)`](#setnavigationbarcolor)
|
|
44
67
|
* [`getNavigationBarColor()`](#getnavigationbarcolor)
|
|
45
68
|
* [`getPluginVersion()`](#getpluginversion)
|
|
@@ -52,6 +75,36 @@ npx cap sync
|
|
|
52
75
|
|
|
53
76
|
Capacitor Navigation Bar Plugin for customizing the Android navigation bar.
|
|
54
77
|
|
|
78
|
+
### hide()
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
hide() => Promise<void>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Hide the navigation bar.
|
|
85
|
+
|
|
86
|
+
Only available on Android.
|
|
87
|
+
|
|
88
|
+
**Since:** 8.2.0
|
|
89
|
+
|
|
90
|
+
--------------------
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
### show()
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
show() => Promise<void>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Show the navigation bar.
|
|
100
|
+
|
|
101
|
+
Only available on Android.
|
|
102
|
+
|
|
103
|
+
**Since:** 8.2.0
|
|
104
|
+
|
|
105
|
+
--------------------
|
|
106
|
+
|
|
107
|
+
|
|
55
108
|
### setNavigationBarColor(...)
|
|
56
109
|
|
|
57
110
|
```typescript
|
package/android/src/main/java/ee/forgr/capacitor_navigation_bar/CapgoNavigationBarPlugin.java
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
package ee.forgr.capacitor_navigation_bar;
|
|
2
2
|
|
|
3
|
+
import android.content.res.Configuration;
|
|
3
4
|
import android.graphics.Color;
|
|
4
5
|
import android.os.Build;
|
|
5
6
|
import android.view.View;
|
|
7
|
+
import android.view.Window;
|
|
8
|
+
import android.view.WindowInsets;
|
|
6
9
|
import android.view.WindowInsetsController;
|
|
7
10
|
import com.getcapacitor.JSObject;
|
|
11
|
+
import com.getcapacitor.Logger;
|
|
8
12
|
import com.getcapacitor.Plugin;
|
|
9
13
|
import com.getcapacitor.PluginCall;
|
|
10
14
|
import com.getcapacitor.PluginMethod;
|
|
@@ -15,7 +19,74 @@ import java.util.Locale;
|
|
|
15
19
|
@CapacitorPlugin(name = "NavigationBar")
|
|
16
20
|
public class CapgoNavigationBarPlugin extends Plugin {
|
|
17
21
|
|
|
18
|
-
private final String
|
|
22
|
+
private static final String ERROR_STYLE_INVALID = "style must be DARK, LIGHT, or DEFAULT.";
|
|
23
|
+
private static final String STYLE_DARK = "DARK";
|
|
24
|
+
private static final String STYLE_DEFAULT = "DEFAULT";
|
|
25
|
+
private static final String STYLE_LIGHT = "LIGHT";
|
|
26
|
+
private static final String TAG = "NavigationBar";
|
|
27
|
+
private static final String TRANSPARENT = "transparent";
|
|
28
|
+
|
|
29
|
+
private final String pluginVersion = "8.2.0";
|
|
30
|
+
|
|
31
|
+
@Override
|
|
32
|
+
public void load() {
|
|
33
|
+
final String color = getConfig().getString("color");
|
|
34
|
+
final String dividerColor = getConfig().getString("dividerColor");
|
|
35
|
+
final String style = getConfig().getString("style");
|
|
36
|
+
|
|
37
|
+
if (color == null && style == null) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getBridge().executeOnMainThread(() -> {
|
|
42
|
+
try {
|
|
43
|
+
if (color != null) {
|
|
44
|
+
applyColor(color, dividerColor);
|
|
45
|
+
}
|
|
46
|
+
if (style != null) {
|
|
47
|
+
applyStyle(style);
|
|
48
|
+
}
|
|
49
|
+
} catch (Exception ex) {
|
|
50
|
+
Logger.error(TAG, "Failed to apply NavigationBar config", ex);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@PluginMethod
|
|
56
|
+
public void hide(PluginCall call) {
|
|
57
|
+
getBridge().executeOnMainThread(() -> {
|
|
58
|
+
Window window = getActivity().getWindow();
|
|
59
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
60
|
+
WindowInsetsController insetsController = window.getInsetsController();
|
|
61
|
+
if (insetsController != null) {
|
|
62
|
+
insetsController.hide(WindowInsets.Type.navigationBars());
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
int flags = window.getDecorView().getSystemUiVisibility();
|
|
66
|
+
flags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
|
67
|
+
window.getDecorView().setSystemUiVisibility(flags);
|
|
68
|
+
}
|
|
69
|
+
call.resolve();
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@PluginMethod
|
|
74
|
+
public void show(PluginCall call) {
|
|
75
|
+
getBridge().executeOnMainThread(() -> {
|
|
76
|
+
Window window = getActivity().getWindow();
|
|
77
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
78
|
+
WindowInsetsController insetsController = window.getInsetsController();
|
|
79
|
+
if (insetsController != null) {
|
|
80
|
+
insetsController.show(WindowInsets.Type.navigationBars());
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
int flags = window.getDecorView().getSystemUiVisibility();
|
|
84
|
+
flags &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION & ~View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
|
85
|
+
window.getDecorView().setSystemUiVisibility(flags);
|
|
86
|
+
}
|
|
87
|
+
call.resolve();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
19
90
|
|
|
20
91
|
@PluginMethod
|
|
21
92
|
public void setNavigationBarColor(PluginCall call) {
|
|
@@ -30,55 +101,11 @@ public class CapgoNavigationBarPlugin extends Plugin {
|
|
|
30
101
|
|
|
31
102
|
getBridge().executeOnMainThread(() -> {
|
|
32
103
|
try {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
? ("transparent".equalsIgnoreCase(dividerColor) ? Color.TRANSPARENT : WebColor.parseColor(dividerColor))
|
|
36
|
-
: null;
|
|
37
|
-
|
|
38
|
-
if ("transparent".equalsIgnoreCase(color)) {
|
|
39
|
-
int flags = getActivity().getWindow().getDecorView().getSystemUiVisibility();
|
|
40
|
-
flags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
|
41
|
-
getActivity().getWindow().getDecorView().setSystemUiVisibility(flags);
|
|
42
|
-
getActivity().getWindow().setNavigationBarColor(Color.TRANSPARENT);
|
|
43
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && parsedDividerColor != null) {
|
|
44
|
-
getActivity().getWindow().setNavigationBarDividerColor(parsedDividerColor);
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
final int parsedColor = WebColor.parseColor(color);
|
|
48
|
-
View decor = getActivity().getWindow().getDecorView();
|
|
49
|
-
int flags = decor.getSystemUiVisibility();
|
|
50
|
-
flags &= ~View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION & ~View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
|
51
|
-
decor.setSystemUiVisibility(flags);
|
|
52
|
-
getActivity().getWindow().setNavigationBarColor(parsedColor);
|
|
53
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && parsedDividerColor != null) {
|
|
54
|
-
getActivity().getWindow().setNavigationBarDividerColor(parsedDividerColor);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
59
|
-
WindowInsetsController insetsController = getActivity().getWindow().getInsetsController();
|
|
60
|
-
if (insetsController != null) {
|
|
61
|
-
if (darkButtons) {
|
|
62
|
-
insetsController.setSystemBarsAppearance(
|
|
63
|
-
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS,
|
|
64
|
-
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS
|
|
65
|
-
);
|
|
66
|
-
} else {
|
|
67
|
-
insetsController.setSystemBarsAppearance(0, WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
71
|
-
int flags = getActivity().getWindow().getDecorView().getSystemUiVisibility();
|
|
72
|
-
if (darkButtons) {
|
|
73
|
-
flags |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
|
74
|
-
} else {
|
|
75
|
-
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
|
76
|
-
}
|
|
77
|
-
getActivity().getWindow().getDecorView().setSystemUiVisibility(flags);
|
|
78
|
-
}
|
|
104
|
+
applyColor(color, dividerColor);
|
|
105
|
+
applyDarkButtons(darkButtons);
|
|
79
106
|
call.resolve();
|
|
80
107
|
} catch (IllegalArgumentException ex) {
|
|
81
|
-
call.reject("Invalid color provided. color and dividerColor must be hex colors (#RRGGBB) or
|
|
108
|
+
call.reject("Invalid color provided. color and dividerColor must be hex colors (#RRGGBB) or 'transparent'.");
|
|
82
109
|
}
|
|
83
110
|
});
|
|
84
111
|
}
|
|
@@ -88,27 +115,8 @@ public class CapgoNavigationBarPlugin extends Plugin {
|
|
|
88
115
|
getBridge().executeOnMainThread(() -> {
|
|
89
116
|
try {
|
|
90
117
|
JSObject ret = new JSObject();
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
ret.put("color", hexColor);
|
|
94
|
-
|
|
95
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
96
|
-
WindowInsetsController insetsController = getActivity().getWindow().getInsetsController();
|
|
97
|
-
if (insetsController != null) {
|
|
98
|
-
int appearance = insetsController.getSystemBarsAppearance();
|
|
99
|
-
boolean isLight = (appearance & WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS) != 0;
|
|
100
|
-
ret.put("darkButtons", !isLight);
|
|
101
|
-
} else {
|
|
102
|
-
ret.put("darkButtons", true);
|
|
103
|
-
}
|
|
104
|
-
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
105
|
-
int flags = getActivity().getWindow().getDecorView().getSystemUiVisibility();
|
|
106
|
-
boolean isLight = (flags & View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR) != 0;
|
|
107
|
-
ret.put("darkButtons", !isLight);
|
|
108
|
-
} else {
|
|
109
|
-
ret.put("darkButtons", true);
|
|
110
|
-
}
|
|
111
|
-
|
|
118
|
+
ret.put("color", getFormattedNavigationBarColor());
|
|
119
|
+
ret.put("darkButtons", areDarkButtonsEnabled());
|
|
112
120
|
call.resolve(ret);
|
|
113
121
|
} catch (Exception ex) {
|
|
114
122
|
call.reject("Failed to get navigation bar color or button style", ex);
|
|
@@ -126,4 +134,104 @@ public class CapgoNavigationBarPlugin extends Plugin {
|
|
|
126
134
|
call.reject("Could not get plugin version", e);
|
|
127
135
|
}
|
|
128
136
|
}
|
|
137
|
+
|
|
138
|
+
private void applyColor(String color, String dividerColor) {
|
|
139
|
+
final Window window = getActivity().getWindow();
|
|
140
|
+
final Integer parsedDividerColor =
|
|
141
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && dividerColor != null ? parseColor(dividerColor) : null;
|
|
142
|
+
|
|
143
|
+
if (TRANSPARENT.equalsIgnoreCase(color)) {
|
|
144
|
+
setTransparentLayoutEnabled(window, true);
|
|
145
|
+
window.setNavigationBarColor(Color.TRANSPARENT);
|
|
146
|
+
} else {
|
|
147
|
+
setTransparentLayoutEnabled(window, false);
|
|
148
|
+
window.setNavigationBarColor(parseColor(color));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && parsedDividerColor != null) {
|
|
152
|
+
window.setNavigationBarDividerColor(parsedDividerColor);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
private void applyStyle(String style) {
|
|
157
|
+
final String resolvedStyle = resolveStyle(style);
|
|
158
|
+
applyDarkButtons(STYLE_LIGHT.equals(resolvedStyle));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private void applyDarkButtons(boolean darkButtons) {
|
|
162
|
+
final Window window = getActivity().getWindow();
|
|
163
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
164
|
+
WindowInsetsController insetsController = window.getInsetsController();
|
|
165
|
+
if (insetsController != null) {
|
|
166
|
+
insetsController.setSystemBarsAppearance(
|
|
167
|
+
darkButtons ? WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS : 0,
|
|
168
|
+
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
172
|
+
int flags = window.getDecorView().getSystemUiVisibility();
|
|
173
|
+
if (darkButtons) {
|
|
174
|
+
flags |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
|
175
|
+
} else {
|
|
176
|
+
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
|
177
|
+
}
|
|
178
|
+
window.getDecorView().setSystemUiVisibility(flags);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
private boolean areDarkButtonsEnabled() {
|
|
183
|
+
final Window window = getActivity().getWindow();
|
|
184
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
185
|
+
WindowInsetsController insetsController = window.getInsetsController();
|
|
186
|
+
if (insetsController != null) {
|
|
187
|
+
int appearance = insetsController.getSystemBarsAppearance();
|
|
188
|
+
return (appearance & WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS) != 0;
|
|
189
|
+
}
|
|
190
|
+
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
191
|
+
int flags = window.getDecorView().getSystemUiVisibility();
|
|
192
|
+
return (flags & View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR) != 0;
|
|
193
|
+
}
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
private String getFormattedNavigationBarColor() {
|
|
198
|
+
int intColor = getActivity().getWindow().getNavigationBarColor();
|
|
199
|
+
if (Color.alpha(intColor) == 0) {
|
|
200
|
+
return TRANSPARENT;
|
|
201
|
+
}
|
|
202
|
+
return String.format("#%06X", (0xFFFFFF & intColor));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
private boolean isNightMode() {
|
|
206
|
+
int nightModeFlags = getContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
|
207
|
+
return nightModeFlags == Configuration.UI_MODE_NIGHT_YES;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private int parseColor(String color) {
|
|
211
|
+
if (TRANSPARENT.equalsIgnoreCase(color)) {
|
|
212
|
+
return Color.TRANSPARENT;
|
|
213
|
+
}
|
|
214
|
+
return WebColor.parseColor(color);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
private String resolveStyle(String style) {
|
|
218
|
+
final String normalizedStyle = style.toUpperCase(Locale.ROOT);
|
|
219
|
+
if (STYLE_DEFAULT.equals(normalizedStyle)) {
|
|
220
|
+
return isNightMode() ? STYLE_DARK : STYLE_LIGHT;
|
|
221
|
+
}
|
|
222
|
+
if (STYLE_DARK.equals(normalizedStyle) || STYLE_LIGHT.equals(normalizedStyle)) {
|
|
223
|
+
return normalizedStyle;
|
|
224
|
+
}
|
|
225
|
+
throw new IllegalArgumentException(ERROR_STYLE_INVALID);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
private void setTransparentLayoutEnabled(Window window, boolean enabled) {
|
|
229
|
+
int flags = window.getDecorView().getSystemUiVisibility();
|
|
230
|
+
if (enabled) {
|
|
231
|
+
flags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
|
232
|
+
} else {
|
|
233
|
+
flags &= ~View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION & ~View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
|
234
|
+
}
|
|
235
|
+
window.getDecorView().setSystemUiVisibility(flags);
|
|
236
|
+
}
|
|
129
237
|
}
|
package/dist/docs.json
CHANGED
|
@@ -10,6 +10,44 @@
|
|
|
10
10
|
}
|
|
11
11
|
],
|
|
12
12
|
"methods": [
|
|
13
|
+
{
|
|
14
|
+
"name": "hide",
|
|
15
|
+
"signature": "() => Promise<void>",
|
|
16
|
+
"parameters": [],
|
|
17
|
+
"returns": "Promise<void>",
|
|
18
|
+
"tags": [
|
|
19
|
+
{
|
|
20
|
+
"name": "since",
|
|
21
|
+
"text": "8.2.0"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "example",
|
|
25
|
+
"text": "```typescript\nawait NavigationBar.hide();\n```"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"docs": "Hide the navigation bar.\n\nOnly available on Android.",
|
|
29
|
+
"complexTypes": [],
|
|
30
|
+
"slug": "hide"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "show",
|
|
34
|
+
"signature": "() => Promise<void>",
|
|
35
|
+
"parameters": [],
|
|
36
|
+
"returns": "Promise<void>",
|
|
37
|
+
"tags": [
|
|
38
|
+
{
|
|
39
|
+
"name": "since",
|
|
40
|
+
"text": "8.2.0"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "example",
|
|
44
|
+
"text": "```typescript\nawait NavigationBar.show();\n```"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"docs": "Show the navigation bar.\n\nOnly available on Android.",
|
|
48
|
+
"complexTypes": [],
|
|
49
|
+
"slug": "show"
|
|
50
|
+
},
|
|
13
51
|
{
|
|
14
52
|
"name": "setNavigationBarColor",
|
|
15
53
|
"signature": "(options: { color: NavigationBarColor | string; darkButtons?: boolean; dividerColor?: NavigationBarColor | string; }) => Promise<void>",
|
|
@@ -134,5 +172,61 @@
|
|
|
134
172
|
}
|
|
135
173
|
],
|
|
136
174
|
"typeAliases": [],
|
|
137
|
-
"pluginConfigs": [
|
|
175
|
+
"pluginConfigs": [
|
|
176
|
+
{
|
|
177
|
+
"name": "NavigationBar",
|
|
178
|
+
"slug": "navigationbar",
|
|
179
|
+
"properties": [
|
|
180
|
+
{
|
|
181
|
+
"name": "color",
|
|
182
|
+
"tags": [
|
|
183
|
+
{
|
|
184
|
+
"text": "8.2.0",
|
|
185
|
+
"name": "since"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"text": "\"#ffffff\"",
|
|
189
|
+
"name": "example"
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"docs": "The hexadecimal color to set as the background color of the navigation bar.\n\nUse `'transparent'` to make the navigation bar transparent.\n\nOnly available on Android.",
|
|
193
|
+
"complexTypes": [],
|
|
194
|
+
"type": "string | undefined"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"name": "dividerColor",
|
|
198
|
+
"tags": [
|
|
199
|
+
{
|
|
200
|
+
"text": "8.2.0",
|
|
201
|
+
"name": "since"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"text": "\"#d9d9d9\"",
|
|
205
|
+
"name": "example"
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"docs": "The hexadecimal color to set as the color of the navigation bar divider.\n\nUse `'transparent'` to hide the divider.\n\nOnly available on Android (API level 28+).",
|
|
209
|
+
"complexTypes": [],
|
|
210
|
+
"type": "string | undefined"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"name": "style",
|
|
214
|
+
"tags": [
|
|
215
|
+
{
|
|
216
|
+
"text": "8.2.0",
|
|
217
|
+
"name": "since"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"text": "\"LIGHT\"",
|
|
221
|
+
"name": "example"
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
"docs": "The style of the navigation bar buttons.\n\nOnly available on Android.",
|
|
225
|
+
"complexTypes": [],
|
|
226
|
+
"type": "'DARK' | 'LIGHT' | 'DEFAULT' | undefined"
|
|
227
|
+
}
|
|
228
|
+
],
|
|
229
|
+
"docs": ""
|
|
230
|
+
}
|
|
231
|
+
]
|
|
138
232
|
}
|
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
declare module '@capacitor/cli' {
|
|
2
|
+
interface PluginsConfig {
|
|
3
|
+
NavigationBar?: {
|
|
4
|
+
/**
|
|
5
|
+
* The hexadecimal color to set as the background color of the navigation bar.
|
|
6
|
+
*
|
|
7
|
+
* Use `'transparent'` to make the navigation bar transparent.
|
|
8
|
+
*
|
|
9
|
+
* Only available on Android.
|
|
10
|
+
*
|
|
11
|
+
* @since 8.2.0
|
|
12
|
+
* @example "#ffffff"
|
|
13
|
+
*/
|
|
14
|
+
color?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The hexadecimal color to set as the color of the navigation bar divider.
|
|
17
|
+
*
|
|
18
|
+
* Use `'transparent'` to hide the divider.
|
|
19
|
+
*
|
|
20
|
+
* Only available on Android (API level 28+).
|
|
21
|
+
*
|
|
22
|
+
* @since 8.2.0
|
|
23
|
+
* @example "#d9d9d9"
|
|
24
|
+
*/
|
|
25
|
+
dividerColor?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The style of the navigation bar buttons.
|
|
28
|
+
*
|
|
29
|
+
* Only available on Android.
|
|
30
|
+
*
|
|
31
|
+
* @since 8.2.0
|
|
32
|
+
* @example "LIGHT"
|
|
33
|
+
*/
|
|
34
|
+
style?: 'DARK' | 'LIGHT' | 'DEFAULT';
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
1
38
|
/**
|
|
2
39
|
* Predefined navigation bar colors.
|
|
3
40
|
*
|
|
@@ -17,6 +54,30 @@ export declare enum NavigationBarColor {
|
|
|
17
54
|
* @since 1.0.0
|
|
18
55
|
*/
|
|
19
56
|
export interface NavigationBarPlugin {
|
|
57
|
+
/**
|
|
58
|
+
* Hide the navigation bar.
|
|
59
|
+
*
|
|
60
|
+
* Only available on Android.
|
|
61
|
+
*
|
|
62
|
+
* @since 8.2.0
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* await NavigationBar.hide();
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
hide(): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Show the navigation bar.
|
|
71
|
+
*
|
|
72
|
+
* Only available on Android.
|
|
73
|
+
*
|
|
74
|
+
* @since 8.2.0
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* await NavigationBar.show();
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
show(): Promise<void>;
|
|
20
81
|
/**
|
|
21
82
|
* Set the navigation bar color and button theme.
|
|
22
83
|
*
|
package/dist/esm/definitions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC5B,kBAAkB;IAClB,uCAAiB,CAAA;IACjB,kBAAkB;IAClB,uCAAiB,CAAA;IACjB,wBAAwB;IACxB,iDAA2B,CAAA;AAC7B,CAAC,EAPW,kBAAkB,KAAlB,kBAAkB,QAO7B","sourcesContent":["/**\n * Predefined navigation bar colors.\n *\n * @since 1.0.0\n */\nexport enum NavigationBarColor {\n /** White color */\n WHITE = '#FFFFFF',\n /** Black color */\n BLACK = '#000000',\n /** Transparent color */\n TRANSPARENT = 'transparent',\n}\n
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAwCxC;;;;GAIG;AACH,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC5B,kBAAkB;IAClB,uCAAiB,CAAA;IACjB,kBAAkB;IAClB,uCAAiB,CAAA;IACjB,wBAAwB;IACxB,iDAA2B,CAAA;AAC7B,CAAC,EAPW,kBAAkB,KAAlB,kBAAkB,QAO7B","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n NavigationBar?: {\n /**\n * The hexadecimal color to set as the background color of the navigation bar.\n *\n * Use `'transparent'` to make the navigation bar transparent.\n *\n * Only available on Android.\n *\n * @since 8.2.0\n * @example \"#ffffff\"\n */\n color?: string;\n /**\n * The hexadecimal color to set as the color of the navigation bar divider.\n *\n * Use `'transparent'` to hide the divider.\n *\n * Only available on Android (API level 28+).\n *\n * @since 8.2.0\n * @example \"#d9d9d9\"\n */\n dividerColor?: string;\n /**\n * The style of the navigation bar buttons.\n *\n * Only available on Android.\n *\n * @since 8.2.0\n * @example \"LIGHT\"\n */\n style?: 'DARK' | 'LIGHT' | 'DEFAULT';\n };\n }\n}\n\n/**\n * Predefined navigation bar colors.\n *\n * @since 1.0.0\n */\nexport enum NavigationBarColor {\n /** White color */\n WHITE = '#FFFFFF',\n /** Black color */\n BLACK = '#000000',\n /** Transparent color */\n TRANSPARENT = 'transparent',\n}\n/**\n * Capacitor Navigation Bar Plugin for customizing the Android navigation bar.\n *\n * @since 1.0.0\n */\nexport interface NavigationBarPlugin {\n /**\n * Hide the navigation bar.\n *\n * Only available on Android.\n *\n * @since 8.2.0\n * @example\n * ```typescript\n * await NavigationBar.hide();\n * ```\n */\n hide(): Promise<void>;\n\n /**\n * Show the navigation bar.\n *\n * Only available on Android.\n *\n * @since 8.2.0\n * @example\n * ```typescript\n * await NavigationBar.show();\n * ```\n */\n show(): Promise<void>;\n\n /**\n * Set the navigation bar color and button theme.\n *\n * @param options - Configuration for navigation bar appearance\n * @returns Promise that resolves when the color is set\n * @throws Error if setting the color fails\n * @since 1.0.0\n * @example\n * ```typescript\n * // Set to white with dark buttons\n * await NavigationBar.setNavigationBarColor({\n * color: NavigationBarColor.WHITE,\n * darkButtons: true\n * });\n *\n * // Set to custom color\n * await NavigationBar.setNavigationBarColor({\n * color: '#FF5733',\n * darkButtons: false\n * });\n *\n * // Set a custom divider color on Android 9+\n * await NavigationBar.setNavigationBarColor({\n * color: NavigationBarColor.WHITE,\n * darkButtons: true,\n * dividerColor: '#D9D9D9'\n * });\n * ```\n */\n setNavigationBarColor(options: {\n /** Predefined colors or any valid hex color code */\n color: NavigationBarColor | string;\n /** Whether to use dark buttons. Defaults to true if not specified */\n darkButtons?: boolean;\n /** Divider color for Android 9+ (API 28+). Accepts predefined colors or any valid hex color code */\n dividerColor?: NavigationBarColor | string;\n }): Promise<void>;\n\n /**\n * Get the current navigation bar color and button theme.\n *\n * @returns Promise that resolves with the current navigation bar configuration\n * @throws Error if getting the color fails\n * @since 1.0.0\n * @example\n * ```typescript\n * const { color, darkButtons } = await NavigationBar.getNavigationBarColor();\n * console.log('Current color:', color);\n * console.log('Using dark buttons:', darkButtons);\n * ```\n */\n getNavigationBarColor(): Promise<{\n /** Current navigation bar color */\n color: string;\n /** Whether dark buttons are enabled */\n darkButtons: boolean;\n }>;\n\n /**\n * Get the native Capacitor plugin version.\n *\n * @returns Promise that resolves with the plugin version\n * @throws Error if getting the version fails\n * @since 1.0.0\n * @example\n * ```typescript\n * const { version } = await NavigationBar.getPluginVersion();\n * console.log('Plugin version:', version);\n * ```\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
2
|
import type { NavigationBarPlugin } from './definitions';
|
|
3
3
|
export declare class NavigationBarWeb extends WebPlugin implements NavigationBarPlugin {
|
|
4
|
+
hide(): Promise<void>;
|
|
5
|
+
show(): Promise<void>;
|
|
4
6
|
setNavigationBarColor(options: {
|
|
5
7
|
color: string;
|
|
6
8
|
darkButtons?: boolean;
|
package/dist/esm/web.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
2
|
export class NavigationBarWeb extends WebPlugin {
|
|
3
|
+
async hide() {
|
|
4
|
+
console.log('Cannot hide navigation bar on web');
|
|
5
|
+
}
|
|
6
|
+
async show() {
|
|
7
|
+
console.log('Cannot show navigation bar on web');
|
|
8
|
+
}
|
|
3
9
|
async setNavigationBarColor(options) {
|
|
4
10
|
console.log('Cannot setNavigationBarColor on web', options);
|
|
5
|
-
return;
|
|
6
11
|
}
|
|
7
12
|
async getNavigationBarColor() {
|
|
8
13
|
console.log('Cannot getNavigationBarColor on web');
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAC7C,KAAK,CAAC,qBAAqB,CAAC,OAAwE;QAClG,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAC7C,KAAK,CAAC,IAAI;QACR,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,OAAwE;QAClG,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,qBAAqB;QAIzB,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACnD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { NavigationBarPlugin } from './definitions';\n\nexport class NavigationBarWeb extends WebPlugin implements NavigationBarPlugin {\n async hide(): Promise<void> {\n console.log('Cannot hide navigation bar on web');\n }\n\n async show(): Promise<void> {\n console.log('Cannot show navigation bar on web');\n }\n\n async setNavigationBarColor(options: { color: string; darkButtons?: boolean; dividerColor?: string }): Promise<void> {\n console.log('Cannot setNavigationBarColor on web', options);\n }\n\n async getNavigationBarColor(): Promise<{\n color: string;\n darkButtons: boolean;\n }> {\n console.log('Cannot getNavigationBarColor on web');\n return { color: '#000000', darkButtons: true };\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: 'web' };\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@capacitor/core');
|
|
4
4
|
|
|
5
|
+
/// <reference types="@capacitor/cli" />
|
|
5
6
|
/**
|
|
6
7
|
* Predefined navigation bar colors.
|
|
7
8
|
*
|
|
@@ -22,9 +23,14 @@ const NavigationBar = core.registerPlugin('NavigationBar', {
|
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
class NavigationBarWeb extends core.WebPlugin {
|
|
26
|
+
async hide() {
|
|
27
|
+
console.log('Cannot hide navigation bar on web');
|
|
28
|
+
}
|
|
29
|
+
async show() {
|
|
30
|
+
console.log('Cannot show navigation bar on web');
|
|
31
|
+
}
|
|
25
32
|
async setNavigationBarColor(options) {
|
|
26
33
|
console.log('Cannot setNavigationBarColor on web', options);
|
|
27
|
-
return;
|
|
28
34
|
}
|
|
29
35
|
async getNavigationBarColor() {
|
|
30
36
|
console.log('Cannot getNavigationBarColor on web');
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Predefined navigation bar colors.\n *\n * @since 1.0.0\n */\nexport var NavigationBarColor;\n(function (NavigationBarColor) {\n /** White color */\n NavigationBarColor[\"WHITE\"] = \"#FFFFFF\";\n /** Black color */\n NavigationBarColor[\"BLACK\"] = \"#000000\";\n /** Transparent color */\n NavigationBarColor[\"TRANSPARENT\"] = \"transparent\";\n})(NavigationBarColor || (NavigationBarColor = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NavigationBar = registerPlugin('NavigationBar', {\n web: () => import('./web').then((m) => new m.NavigationBarWeb()),\n});\nexport * from './definitions';\nexport { NavigationBar };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class NavigationBarWeb extends WebPlugin {\n async setNavigationBarColor(options) {\n console.log('Cannot setNavigationBarColor on web', options);\n
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n/**\n * Predefined navigation bar colors.\n *\n * @since 1.0.0\n */\nexport var NavigationBarColor;\n(function (NavigationBarColor) {\n /** White color */\n NavigationBarColor[\"WHITE\"] = \"#FFFFFF\";\n /** Black color */\n NavigationBarColor[\"BLACK\"] = \"#000000\";\n /** Transparent color */\n NavigationBarColor[\"TRANSPARENT\"] = \"transparent\";\n})(NavigationBarColor || (NavigationBarColor = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NavigationBar = registerPlugin('NavigationBar', {\n web: () => import('./web').then((m) => new m.NavigationBarWeb()),\n});\nexport * from './definitions';\nexport { NavigationBar };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class NavigationBarWeb extends WebPlugin {\n async hide() {\n console.log('Cannot hide navigation bar on web');\n }\n async show() {\n console.log('Cannot show navigation bar on web');\n }\n async setNavigationBarColor(options) {\n console.log('Cannot setNavigationBarColor on web', options);\n }\n async getNavigationBarColor() {\n console.log('Cannot getNavigationBarColor on web');\n return { color: '#000000', darkButtons: true };\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["NavigationBarColor","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACWA;AACX,CAAC,UAAU,kBAAkB,EAAE;AAC/B;AACA,IAAI,kBAAkB,CAAC,OAAO,CAAC,GAAG,SAAS;AAC3C;AACA,IAAI,kBAAkB,CAAC,OAAO,CAAC,GAAG,SAAS;AAC3C;AACA,IAAI,kBAAkB,CAAC,aAAa,CAAC,GAAG,aAAa;AACrD,CAAC,EAAEA,0BAAkB,KAAKA,0BAAkB,GAAG,EAAE,CAAC,CAAC;;ACb9C,MAAC,aAAa,GAAGC,mBAAc,CAAC,eAAe,EAAE;AACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACpE,CAAC;;ACFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;AAChD,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC;AACxD,IAAI;AACJ,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC;AACxD,IAAI;AACJ,IAAI,MAAM,qBAAqB,CAAC,OAAO,EAAE;AACzC,QAAQ,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,OAAO,CAAC;AACnE,IAAI;AACJ,IAAI,MAAM,qBAAqB,GAAG;AAClC,QAAQ,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC;AAC1D,QAAQ,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE;AACtD,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var NavigationBarPlugin = (function (exports, core) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
/// <reference types="@capacitor/cli" />
|
|
4
5
|
/**
|
|
5
6
|
* Predefined navigation bar colors.
|
|
6
7
|
*
|
|
@@ -21,9 +22,14 @@ var NavigationBarPlugin = (function (exports, core) {
|
|
|
21
22
|
});
|
|
22
23
|
|
|
23
24
|
class NavigationBarWeb extends core.WebPlugin {
|
|
25
|
+
async hide() {
|
|
26
|
+
console.log('Cannot hide navigation bar on web');
|
|
27
|
+
}
|
|
28
|
+
async show() {
|
|
29
|
+
console.log('Cannot show navigation bar on web');
|
|
30
|
+
}
|
|
24
31
|
async setNavigationBarColor(options) {
|
|
25
32
|
console.log('Cannot setNavigationBarColor on web', options);
|
|
26
|
-
return;
|
|
27
33
|
}
|
|
28
34
|
async getNavigationBarColor() {
|
|
29
35
|
console.log('Cannot getNavigationBarColor on web');
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Predefined navigation bar colors.\n *\n * @since 1.0.0\n */\nexport var NavigationBarColor;\n(function (NavigationBarColor) {\n /** White color */\n NavigationBarColor[\"WHITE\"] = \"#FFFFFF\";\n /** Black color */\n NavigationBarColor[\"BLACK\"] = \"#000000\";\n /** Transparent color */\n NavigationBarColor[\"TRANSPARENT\"] = \"transparent\";\n})(NavigationBarColor || (NavigationBarColor = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NavigationBar = registerPlugin('NavigationBar', {\n web: () => import('./web').then((m) => new m.NavigationBarWeb()),\n});\nexport * from './definitions';\nexport { NavigationBar };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class NavigationBarWeb extends WebPlugin {\n async setNavigationBarColor(options) {\n console.log('Cannot setNavigationBarColor on web', options);\n
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n/**\n * Predefined navigation bar colors.\n *\n * @since 1.0.0\n */\nexport var NavigationBarColor;\n(function (NavigationBarColor) {\n /** White color */\n NavigationBarColor[\"WHITE\"] = \"#FFFFFF\";\n /** Black color */\n NavigationBarColor[\"BLACK\"] = \"#000000\";\n /** Transparent color */\n NavigationBarColor[\"TRANSPARENT\"] = \"transparent\";\n})(NavigationBarColor || (NavigationBarColor = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NavigationBar = registerPlugin('NavigationBar', {\n web: () => import('./web').then((m) => new m.NavigationBarWeb()),\n});\nexport * from './definitions';\nexport { NavigationBar };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class NavigationBarWeb extends WebPlugin {\n async hide() {\n console.log('Cannot hide navigation bar on web');\n }\n async show() {\n console.log('Cannot show navigation bar on web');\n }\n async setNavigationBarColor(options) {\n console.log('Cannot setNavigationBarColor on web', options);\n }\n async getNavigationBarColor() {\n console.log('Cannot getNavigationBarColor on web');\n return { color: '#000000', darkButtons: true };\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["NavigationBarColor","registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;IACA;AACWA;IACX,CAAC,UAAU,kBAAkB,EAAE;IAC/B;IACA,IAAI,kBAAkB,CAAC,OAAO,CAAC,GAAG,SAAS;IAC3C;IACA,IAAI,kBAAkB,CAAC,OAAO,CAAC,GAAG,SAAS;IAC3C;IACA,IAAI,kBAAkB,CAAC,aAAa,CAAC,GAAG,aAAa;IACrD,CAAC,EAAEA,0BAAkB,KAAKA,0BAAkB,GAAG,EAAE,CAAC,CAAC;;ACb9C,UAAC,aAAa,GAAGC,mBAAc,CAAC,eAAe,EAAE;IACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACpE,CAAC;;ICFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;IAChD,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC;IACxD,IAAI;IACJ,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC;IACxD,IAAI;IACJ,IAAI,MAAM,qBAAqB,CAAC,OAAO,EAAE;IACzC,QAAQ,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,OAAO,CAAC;IACnE,IAAI;IACJ,IAAI,MAAM,qBAAqB,GAAG;IAClC,QAAQ,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC;IAC1D,QAAQ,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE;IACtD,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -7,19 +7,30 @@ import Capacitor
|
|
|
7
7
|
*/
|
|
8
8
|
@objc(CapgoNavigationBarPlugin)
|
|
9
9
|
public class CapgoNavigationBarPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
10
|
-
private let pluginVersion: String = "8.
|
|
10
|
+
private let pluginVersion: String = "8.2.0"
|
|
11
11
|
public let identifier = "CapgoNavigationBarPlugin"
|
|
12
12
|
public let jsName = "NavigationBar"
|
|
13
13
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
14
|
+
CAPPluginMethod(name: "hide", returnType: CAPPluginReturnPromise),
|
|
15
|
+
CAPPluginMethod(name: "show", returnType: CAPPluginReturnPromise),
|
|
14
16
|
CAPPluginMethod(name: "setNavigationBarColor", returnType: CAPPluginReturnPromise),
|
|
15
17
|
CAPPluginMethod(name: "getNavigationBarColor", returnType: CAPPluginReturnPromise),
|
|
16
18
|
CAPPluginMethod(name: "getPluginVersion", returnType: CAPPluginReturnPromise)
|
|
17
19
|
]
|
|
20
|
+
|
|
21
|
+
@objc func hide(_ call: CAPPluginCall) {
|
|
22
|
+
rejectUnsupported(call)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@objc func show(_ call: CAPPluginCall) {
|
|
26
|
+
rejectUnsupported(call)
|
|
27
|
+
}
|
|
18
28
|
@objc func setNavigationBarColor(_ call: CAPPluginCall) {
|
|
19
29
|
let color = call.getString("color") ?? ""
|
|
20
30
|
print("Cannot set navigation bar color in ios \(color)")
|
|
21
31
|
call.reject("Cannot set navigation bar color in ios")
|
|
22
32
|
}
|
|
33
|
+
|
|
23
34
|
@objc func getNavigationBarColor(_ call: CAPPluginCall) {
|
|
24
35
|
print("Cannot get navigation bar color in ios")
|
|
25
36
|
call.reject("Cannot get navigation bar color in ios")
|
|
@@ -29,4 +40,8 @@ public class CapgoNavigationBarPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
29
40
|
call.resolve(["version": self.pluginVersion])
|
|
30
41
|
}
|
|
31
42
|
|
|
43
|
+
private func rejectUnsupported(_ call: CAPPluginCall) {
|
|
44
|
+
call.reject("Navigation bar is only available on Android")
|
|
45
|
+
}
|
|
46
|
+
|
|
32
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-navigation-bar",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "Capacitor plugin Set navigation bar color for android lollipop and higher",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
"native"
|
|
35
35
|
],
|
|
36
36
|
"scripts": {
|
|
37
|
-
"verify": "
|
|
37
|
+
"verify": "bun run verify:ios && bun run verify:android && bun run verify:web",
|
|
38
38
|
"verify:ios": "xcodebuild -scheme CapgoCapacitorNavigationBar -destination generic/platform=iOS",
|
|
39
39
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
40
|
-
"verify:web": "
|
|
41
|
-
"lint": "
|
|
42
|
-
"fmt": "
|
|
40
|
+
"verify:web": "bun run build",
|
|
41
|
+
"lint": "bun run eslint && bun run prettier -- --check && bun run swiftlint -- lint",
|
|
42
|
+
"fmt": "bun run eslint -- --fix && bun run prettier -- --write && bun run swiftlint -- --fix --format",
|
|
43
43
|
"eslint": "eslint .",
|
|
44
44
|
"prettier": "prettier-pretty-check \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
|
|
45
45
|
"swiftlint": "node-swiftlint",
|
|
46
46
|
"docgen": "docgen --api NavigationBarPlugin --output-readme README.md --output-json dist/docs.json",
|
|
47
|
-
"build": "
|
|
47
|
+
"build": "bun run clean && bun run docgen && tsc && rollup -c rollup.config.mjs",
|
|
48
48
|
"clean": "rimraf ./dist",
|
|
49
49
|
"watch": "tsc --watch",
|
|
50
|
-
"prepublishOnly": "
|
|
50
|
+
"prepublishOnly": "bun run build",
|
|
51
51
|
"check:wiring": "node scripts/check-capacitor-plugin-wiring.mjs"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|