@octane-xplat/platform 0.3.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/README.md +37 -0
- package/package.json +11 -9
- package/src/a11y.native.ts +9 -5
- package/src/a11y.web.ts +13 -9
- package/src/app-info.native.ts +56 -0
- package/src/app-info.web.ts +10 -0
- package/src/biometrics.native.ts +10 -10
- package/src/biometrics.web.ts +9 -17
- package/src/clipboard.native.ts +8 -8
- package/src/clipboard.web.ts +8 -7
- package/src/connectivity.native.ts +86 -0
- package/src/connectivity.web.ts +62 -0
- package/src/deep-links.native.ts +47 -20
- package/src/deep-links.web.ts +16 -11
- package/src/device.native.ts +3 -3
- package/src/device.web.ts +5 -4
- package/src/files.native.ts +118 -18
- package/src/files.web.ts +20 -19
- package/src/geolocation.native.ts +44 -0
- package/src/geolocation.web.ts +50 -0
- package/src/haptics.native.ts +14 -10
- package/src/haptics.web.ts +5 -4
- package/src/index.ts +35 -19
- package/src/lifecycle.native.ts +1 -1
- package/src/lifecycle.native.tsrx +2 -0
- package/src/lifecycle.web.ts +1 -1
- package/src/lifecycle.web.tsrx +1 -0
- package/src/locale.native.ts +3 -3
- package/src/locale.web.ts +5 -9
- package/src/media.native.ts +70 -32
- package/src/media.web.ts +64 -22
- package/src/notifications.native.ts +7 -7
- package/src/notifications.web.ts +18 -7
- package/src/open-url.native.ts +45 -0
- package/src/open-url.web.ts +15 -0
- package/src/permissions.native.ts +10 -10
- package/src/permissions.web.ts +13 -31
- package/src/safe-area.native.ts +1 -1
- package/src/safe-area.native.tsrx +76 -17
- package/src/safe-area.web.ts +1 -1
- package/src/safe-area.web.tsrx +3 -0
- package/src/screen.native.ts +1 -1
- package/src/screen.native.tsrx +1 -0
- package/src/screen.web.ts +1 -1
- package/src/screen.web.tsrx +1 -0
- package/src/secure-storage.native.ts +5 -5
- package/src/secure-storage.web.ts +2 -2
- package/src/share.native.ts +6 -6
- package/src/share.web.ts +17 -13
- package/src/storage.native.ts +8 -4
- package/src/storage.web.ts +7 -3
- package/src/system-bars.native.ts +23 -12
- package/src/system-bars.web.ts +9 -6
- package/src/types.ts +93 -33
package/src/system-bars.web.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
// Status/nav bars — web leaf. No status bar on web, but theme-color is the
|
|
2
2
|
// honest equivalent: it tints mobile browser chrome.
|
|
3
3
|
export const systemBars = {
|
|
4
|
+
// Browsers do not expose a status-bar icon-style API. `setColor` below is
|
|
5
|
+
// the available theme-color equivalent; this method intentionally no-ops.
|
|
4
6
|
setStatusBarStyle(_style: 'light' | 'dark'): void {},
|
|
5
7
|
setColor(color: string): void {
|
|
6
|
-
let meta = document.querySelector('meta[name="theme-color"]')
|
|
8
|
+
let meta = document.querySelector('meta[name="theme-color"]')
|
|
7
9
|
if (!meta) {
|
|
8
|
-
meta = document.createElement('meta')
|
|
9
|
-
meta.setAttribute('name', 'theme-color')
|
|
10
|
-
document.head.appendChild(meta)
|
|
10
|
+
meta = document.createElement('meta')
|
|
11
|
+
meta.setAttribute('name', 'theme-color')
|
|
12
|
+
document.head.appendChild(meta)
|
|
11
13
|
}
|
|
12
|
-
|
|
14
|
+
|
|
15
|
+
meta.setAttribute('content', color)
|
|
13
16
|
},
|
|
14
|
-
}
|
|
17
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -4,40 +4,40 @@
|
|
|
4
4
|
|
|
5
5
|
/** Optional capability — never throws for absence (docs/platform-services.md). */
|
|
6
6
|
export interface Capability<T> {
|
|
7
|
-
supported: boolean
|
|
8
|
-
ensure(): Promise<'granted' | 'denied' | 'unsupported'
|
|
7
|
+
supported: boolean
|
|
8
|
+
ensure(): Promise<'granted' | 'denied' | 'unsupported'>
|
|
9
9
|
/** usable iff supported && ensured */
|
|
10
|
-
impl: T | null
|
|
10
|
+
impl: T | null
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export type AppState = 'active' | 'background' | 'inactive'
|
|
13
|
+
export type AppState = 'active' | 'background' | 'inactive'
|
|
14
14
|
|
|
15
15
|
export interface DeviceInfo {
|
|
16
|
-
os: 'web' | 'ios' | 'android'
|
|
17
|
-
osVersion: string
|
|
18
|
-
model: string
|
|
19
|
-
manufacturer: string
|
|
20
|
-
language: string
|
|
21
|
-
region: string
|
|
16
|
+
os: 'web' | 'ios' | 'android'
|
|
17
|
+
osVersion: string
|
|
18
|
+
model: string
|
|
19
|
+
manufacturer: string
|
|
20
|
+
language: string
|
|
21
|
+
region: string
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export interface Insets {
|
|
25
|
-
top: number
|
|
26
|
-
bottom: number
|
|
27
|
-
left: number
|
|
28
|
-
right: number
|
|
25
|
+
top: number
|
|
26
|
+
bottom: number
|
|
27
|
+
left: number
|
|
28
|
+
right: number
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface WindowSize {
|
|
32
|
-
width: number
|
|
33
|
-
height: number
|
|
34
|
-
orientation: 'portrait' | 'landscape'
|
|
32
|
+
width: number
|
|
33
|
+
height: number
|
|
34
|
+
orientation: 'portrait' | 'landscape'
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export interface FileRef {
|
|
38
|
-
name: string
|
|
38
|
+
name: string
|
|
39
39
|
/** blob:/object URL on web, filesystem path on native — opaque */
|
|
40
|
-
uri: string
|
|
40
|
+
uri: string
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -46,35 +46,95 @@ export interface FileRef {
|
|
|
46
46
|
* preview is no longer needed.
|
|
47
47
|
*/
|
|
48
48
|
export interface PickedImage extends FileRef {
|
|
49
|
-
dataUrl: string
|
|
49
|
+
dataUrl: string
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export interface Locale {
|
|
53
|
-
tag: string
|
|
54
|
-
language: string
|
|
55
|
-
region: string
|
|
53
|
+
tag: string
|
|
54
|
+
language: string
|
|
55
|
+
region: string
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export interface SecureStore {
|
|
59
|
-
get(key: string): Promise<string | null
|
|
60
|
-
set(key: string, value: string): Promise<boolean
|
|
61
|
-
remove(key: string): Promise<boolean
|
|
59
|
+
get(key: string): Promise<string | null>
|
|
60
|
+
set(key: string, value: string): Promise<boolean>
|
|
61
|
+
remove(key: string): Promise<boolean>
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export interface HapticsImpl {
|
|
65
|
-
impact(style?: 'light' | 'medium' | 'heavy'): void
|
|
66
|
-
notification(kind: 'success' | 'warning' | 'error'): void
|
|
67
|
-
selection(): void
|
|
65
|
+
impact(style?: 'light' | 'medium' | 'heavy'): void
|
|
66
|
+
notification(kind: 'success' | 'warning' | 'error'): void
|
|
67
|
+
selection(): void
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export interface NotificationsImpl {
|
|
71
|
-
notify(title: string, body?: string): void
|
|
71
|
+
notify(title: string, body?: string): void
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
export interface BiometricsImpl {
|
|
75
|
-
verify(reason: string): Promise<boolean
|
|
75
|
+
verify(reason: string): Promise<boolean>
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
export type
|
|
78
|
+
export type PermissionResult = 'granted' | 'denied' | 'unsupported'
|
|
79
79
|
|
|
80
|
-
export type
|
|
80
|
+
export type PermissionKind = 'notifications' | 'camera' | 'photos' | 'location'
|
|
81
|
+
|
|
82
|
+
export type MediaPermissionKind = 'camera' | 'photos'
|
|
83
|
+
|
|
84
|
+
export interface GeolocationOptions {
|
|
85
|
+
enableHighAccuracy?: boolean
|
|
86
|
+
timeout?: number
|
|
87
|
+
maximumAge?: number
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface GeolocationPosition {
|
|
91
|
+
latitude: number
|
|
92
|
+
longitude: number
|
|
93
|
+
accuracy: number
|
|
94
|
+
altitude: number | null
|
|
95
|
+
heading: number | null
|
|
96
|
+
speed: number | null
|
|
97
|
+
timestamp: number
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface GeolocationImpl {
|
|
101
|
+
getCurrentPosition(options?: GeolocationOptions): Promise<GeolocationPosition>
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type ConnectionType =
|
|
105
|
+
| 'none'
|
|
106
|
+
| 'wifi'
|
|
107
|
+
| 'mobile'
|
|
108
|
+
| 'ethernet'
|
|
109
|
+
| 'bluetooth'
|
|
110
|
+
| 'vpn'
|
|
111
|
+
| 'unknown'
|
|
112
|
+
|
|
113
|
+
export interface ConnectivityState {
|
|
114
|
+
online: boolean
|
|
115
|
+
type: ConnectionType
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface ConnectivityImpl {
|
|
119
|
+
getState(): ConnectivityState
|
|
120
|
+
subscribe(listener: (state: ConnectivityState) => void): () => void
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface AppInfo {
|
|
124
|
+
supported: boolean
|
|
125
|
+
version: string | null
|
|
126
|
+
build: string | null
|
|
127
|
+
bundleId: string | null
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface OpenSettingsImpl {
|
|
131
|
+
open(): boolean
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface MediaImpl {
|
|
135
|
+
pickImage(): Promise<PickedImage | null>
|
|
136
|
+
pickImages(): Promise<PickedImage[]>
|
|
137
|
+
ensure(kind: MediaPermissionKind): Promise<PermissionResult>
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export type ShareResult = 'shared' | 'copied' | 'unavailable'
|