@octane-xplat/platform 0.1.0 → 0.4.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 +21 -8
- package/src/a11y.native.ts +9 -5
- package/src/a11y.web.ts +13 -9
- package/src/app-info.native.ts +35 -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 +28 -15
- package/src/clipboard.web.ts +29 -17
- 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 +122 -16
- 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 +49 -22
- 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 +74 -14
- package/src/media.web.ts +71 -9
- 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 +10 -8
- package/src/system-bars.web.ts +9 -6
- package/src/types.ts +101 -32
package/src/types.ts
CHANGED
|
@@ -4,68 +4,137 @@
|
|
|
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
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Result of `media.pickImage()`: a displayable URI and an upload data URL.
|
|
45
|
+
* Native URIs point to temporary JPEG files; call `files.release()` when the
|
|
46
|
+
* preview is no longer needed.
|
|
47
|
+
*/
|
|
48
|
+
export interface PickedImage extends FileRef {
|
|
49
|
+
dataUrl: string
|
|
41
50
|
}
|
|
42
51
|
|
|
43
52
|
export interface Locale {
|
|
44
|
-
tag: string
|
|
45
|
-
language: string
|
|
46
|
-
region: string
|
|
53
|
+
tag: string
|
|
54
|
+
language: string
|
|
55
|
+
region: string
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
export interface SecureStore {
|
|
50
|
-
get(key: string): Promise<string | null
|
|
51
|
-
set(key: string, value: string): Promise<boolean
|
|
52
|
-
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>
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
export interface HapticsImpl {
|
|
56
|
-
impact(style?: 'light' | 'medium' | 'heavy'): void
|
|
57
|
-
notification(kind: 'success' | 'warning' | 'error'): void
|
|
58
|
-
selection(): void
|
|
65
|
+
impact(style?: 'light' | 'medium' | 'heavy'): void
|
|
66
|
+
notification(kind: 'success' | 'warning' | 'error'): void
|
|
67
|
+
selection(): void
|
|
59
68
|
}
|
|
60
69
|
|
|
61
70
|
export interface NotificationsImpl {
|
|
62
|
-
notify(title: string, body?: string): void
|
|
71
|
+
notify(title: string, body?: string): void
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
export interface BiometricsImpl {
|
|
66
|
-
verify(reason: string): Promise<boolean
|
|
75
|
+
verify(reason: string): Promise<boolean>
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type PermissionResult = 'granted' | 'denied' | 'unsupported'
|
|
79
|
+
|
|
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>
|
|
67
102
|
}
|
|
68
103
|
|
|
69
|
-
export type
|
|
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
|
+
}
|
|
70
139
|
|
|
71
|
-
export type ShareResult = 'shared' | 'copied' | 'unavailable'
|
|
140
|
+
export type ShareResult = 'shared' | 'copied' | 'unavailable'
|