@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octane-xplat/platform",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Headless platform capabilities for Octane xplat — web + NativeScript leaf pairs",
5
5
  "files": [
6
6
  "src"
@@ -32,4 +32,25 @@ function read(): AppInfo {
32
32
  return { supported: false, version: null, build: null, bundleId: null }
33
33
  }
34
34
 
35
- export const appInfo = read()
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. iOS status-bar style + Android
2
- // navigation-bar color via the application window.
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; fall back to
11
- // the app-level setter on older systems.
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
  }