@octane-xplat/platform 0.4.0 → 0.5.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/package.json +1 -1
- package/src/app-info.native.ts +22 -1
- package/src/system-bars.native.ts +13 -4
package/package.json
CHANGED
package/src/app-info.native.ts
CHANGED
|
@@ -32,4 +32,25 @@ function read(): AppInfo {
|
|
|
32
32
|
return { supported: false, version: null, build: null, bundleId: null }
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
// `Application.android.context` doesn't exist while the bundled entry is
|
|
36
|
+
// being evaluated (Application.onCreate), so read() must not run at module
|
|
37
|
+
// scope. Defer until first property access.
|
|
38
|
+
let cached: AppInfo | undefined
|
|
39
|
+
function info(): AppInfo {
|
|
40
|
+
return (cached ??= read())
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const appInfo: AppInfo = {
|
|
44
|
+
get supported() {
|
|
45
|
+
return info().supported
|
|
46
|
+
},
|
|
47
|
+
get version() {
|
|
48
|
+
return info().version
|
|
49
|
+
},
|
|
50
|
+
get build() {
|
|
51
|
+
return info().build
|
|
52
|
+
},
|
|
53
|
+
get bundleId() {
|
|
54
|
+
return info().bundleId
|
|
55
|
+
},
|
|
56
|
+
}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
// Status/nav bars — native leaf.
|
|
2
|
-
//
|
|
1
|
+
// Status/nav bars — native leaf. Status-bar icon style on both platforms +
|
|
2
|
+
// Android status/nav-bar tint via the application window.
|
|
3
3
|
import { Application, Color } from '@nativescript/core'
|
|
4
4
|
|
|
5
5
|
export const systemBars = {
|
|
6
6
|
setStatusBarStyle(style: 'light' | 'dark'): void {
|
|
7
|
+
// 'light'|'dark' name the icon appearance: 'light' = light content
|
|
8
|
+
// for dark backgrounds. NS View.statusBarStyle uses the same
|
|
9
|
+
// convention on both platforms (Android → APPEARANCE_LIGHT_*).
|
|
10
|
+
const root = Application.getRootView()
|
|
11
|
+
if (root) {
|
|
12
|
+
root.statusBarStyle = style
|
|
13
|
+
}
|
|
14
|
+
|
|
7
15
|
if (Application.ios) {
|
|
8
16
|
const app = Application.ios.nativeApp
|
|
9
17
|
|
|
10
|
-
// NS 9: per-page statusBarStyle is the preferred seam
|
|
11
|
-
// the app-level setter
|
|
18
|
+
// NS 9: per-page statusBarStyle is the preferred seam — the
|
|
19
|
+
// root-view write above drives it; keep the app-level setter as
|
|
20
|
+
// fallback for controllers outside the root's hierarchy.
|
|
12
21
|
|
|
13
22
|
;(app as any)?.setStatusBarStyle?.(style === 'light' ? 1 : 0)
|
|
14
23
|
}
|