ota-native-bridge 1.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 +76 -0
- package/dist/cjs/crypto-ns.js +9 -0
- package/dist/cjs/crypto.js +96 -0
- package/dist/cjs/index.js +67 -0
- package/dist/cjs/native-messenger.js +23 -0
- package/dist/cjs/native.js +87 -0
- package/dist/cjs/plugins.js +325 -0
- package/dist/cjs/runtime.js +101 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/version.js +7 -0
- package/dist/crypto-ns.d.ts +6 -0
- package/dist/crypto-ns.js +6 -0
- package/dist/crypto.d.ts +26 -0
- package/dist/crypto.js +92 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +7 -0
- package/dist/native-messenger.d.ts +6 -0
- package/dist/native-messenger.js +19 -0
- package/dist/native.d.ts +418 -0
- package/dist/native.js +54 -0
- package/dist/plugins.d.ts +209 -0
- package/dist/plugins.js +322 -0
- package/dist/runtime.d.ts +10 -0
- package/dist/runtime.js +92 -0
- package/dist/types.d.ts +609 -0
- package/dist/types.js +1 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.js +4 -0
- package/docs/USAGE.md +1486 -0
- package/ota-native-bridge.d.ts +10 -0
- package/ota-native-bridge.js +399 -0
- package/package.json +75 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
export interface AppInfo {
|
|
2
|
+
appName: string;
|
|
3
|
+
packageName: string;
|
|
4
|
+
configPackageName: string;
|
|
5
|
+
versionName: string;
|
|
6
|
+
versionCode: number;
|
|
7
|
+
/** 前端入口:本地填 index.html,远程网页填完整 URL */
|
|
8
|
+
url: string;
|
|
9
|
+
/** @deprecated 请使用 url */
|
|
10
|
+
wwwEntry?: string;
|
|
11
|
+
wwwVersion: string;
|
|
12
|
+
/** 前端资源包版本(app_config.json → resourceVersion,与上报后端的 resourceVersion 一致) */
|
|
13
|
+
resourceVersion?: string;
|
|
14
|
+
/** 是否由前端Custom更新 UI(来自 app_config.json → update.useCustomUpdate) */
|
|
15
|
+
useCustomUpdate?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 前端渠道码(打包写入 `stat.frontendChannel`)。
|
|
18
|
+
* 与 `Ota.setChannel` 运行时覆盖无关,始终为包内绑定值。
|
|
19
|
+
*/
|
|
20
|
+
frontendChannelCode?: string;
|
|
21
|
+
/** 统计渠道码(打包写入 `stat.channel`,增长统计上报用) */
|
|
22
|
+
channelCode?: string;
|
|
23
|
+
/** 广告码(打包写入 `stat.adCode`) */
|
|
24
|
+
adCode?: string;
|
|
25
|
+
resourceCheckUrl: string;
|
|
26
|
+
apkCheckUrl: string;
|
|
27
|
+
safeArea: SafeAreaFeatureConfig;
|
|
28
|
+
guideEnabled: boolean;
|
|
29
|
+
adSplashEnabled: boolean;
|
|
30
|
+
highPerformanceMode: boolean;
|
|
31
|
+
platform?: PlatformConfig;
|
|
32
|
+
}
|
|
33
|
+
export interface PlatformConfig {
|
|
34
|
+
/** 平台标识(app_config.json → platform / OtaConstants 兜底) */
|
|
35
|
+
platformId: string;
|
|
36
|
+
/** API 密钥(20 位) */
|
|
37
|
+
apiKey: string;
|
|
38
|
+
/** OTA 客户端 API 根地址 */
|
|
39
|
+
apiBaseUrl?: string;
|
|
40
|
+
/**
|
|
41
|
+
* 平台参数加密公钥 PEM(创建平台时生成)。
|
|
42
|
+
* H5 自行请求 Client API 时必须用 `Crypto.encryptRequestBody` / `postEncrypted` 加密。
|
|
43
|
+
*/
|
|
44
|
+
paramPublicKey?: string;
|
|
45
|
+
/** Client API 凭证已齐。不等于原生更新已接管;还要看 `useCustomUpdate === false`。 */
|
|
46
|
+
otaEnabled?: boolean;
|
|
47
|
+
autoCheckUpdateOnLaunch?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** 打包写入 App 的渠道绑定(app_config.json → stat) */
|
|
50
|
+
export interface AppChannelCodes {
|
|
51
|
+
/** 前端渠道码(stat.frontendChannel) */
|
|
52
|
+
frontendChannelCode: string;
|
|
53
|
+
/** 统计渠道码(stat.channel) */
|
|
54
|
+
channelCode: string;
|
|
55
|
+
/** 广告码(stat.adCode) */
|
|
56
|
+
adCode: string;
|
|
57
|
+
}
|
|
58
|
+
/** 前端触发原生更新后的结果(不含 downloadUrl,更新流程由原生完成) */
|
|
59
|
+
export interface AppUpdateTriggerResult {
|
|
60
|
+
success: boolean;
|
|
61
|
+
hasUpdate: boolean;
|
|
62
|
+
/** true:原生弹窗/下载;false:Custom更新模式,由前端处理 */
|
|
63
|
+
handledByNative: boolean;
|
|
64
|
+
message?: string;
|
|
65
|
+
/** 以下字段仅在 handledByNative=false 且 hasUpdate=true 时存在 */
|
|
66
|
+
version?: string;
|
|
67
|
+
updateType?: number;
|
|
68
|
+
forceUpdate?: number;
|
|
69
|
+
force?: boolean;
|
|
70
|
+
updateDesc?: string;
|
|
71
|
+
pushId?: number;
|
|
72
|
+
}
|
|
73
|
+
export interface AppUpdateDownloadUrlResult {
|
|
74
|
+
success: boolean;
|
|
75
|
+
pushId: number;
|
|
76
|
+
downloadUrl: string;
|
|
77
|
+
}
|
|
78
|
+
export interface AppUpdateCheckReportPayload {
|
|
79
|
+
hasUpdate: boolean;
|
|
80
|
+
targetVersion?: string;
|
|
81
|
+
updateType?: number;
|
|
82
|
+
forceUpdate?: number;
|
|
83
|
+
pushId?: number;
|
|
84
|
+
uid?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface AppUpdatePushEvent {
|
|
87
|
+
type: 'push_notify';
|
|
88
|
+
event: 'upsert' | 'remove' | string;
|
|
89
|
+
data: {
|
|
90
|
+
hasUpdate?: boolean;
|
|
91
|
+
version?: string;
|
|
92
|
+
updateType?: number;
|
|
93
|
+
forceUpdate?: number;
|
|
94
|
+
force?: boolean;
|
|
95
|
+
updateDesc?: string;
|
|
96
|
+
pushId?: number;
|
|
97
|
+
downloadUrl?: string;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export interface CheckAppUpdateOptions {
|
|
101
|
+
/** 无新版本时是否由原生 Toast 提示,Default true */
|
|
102
|
+
notifyWhenNoUpdate?: boolean;
|
|
103
|
+
uid?: string;
|
|
104
|
+
}
|
|
105
|
+
/** @deprecated 使用 CheckAppUpdateOptions */
|
|
106
|
+
export type CheckOtaUpdateOptions = CheckAppUpdateOptions;
|
|
107
|
+
/** @deprecated 使用 AppUpdateTriggerResult */
|
|
108
|
+
export type OtaUpdateResult = AppUpdateTriggerResult;
|
|
109
|
+
export interface SafeAreaFeatureConfig {
|
|
110
|
+
enableTop: boolean;
|
|
111
|
+
enableBottom: boolean;
|
|
112
|
+
/** 头部安全区/状态栏背景色,前端可配;为空则回退主题背景色 */
|
|
113
|
+
topBackgroundColor?: string;
|
|
114
|
+
/** 底部安全区背景色,前端可配;为空则回退主题背景色 */
|
|
115
|
+
bottomBackgroundColor?: string;
|
|
116
|
+
}
|
|
117
|
+
/** light = 浅色栏 + 深色图标;dark = 深色栏 + 浅色图标 */
|
|
118
|
+
export type SystemBarStyle = 'light' | 'dark';
|
|
119
|
+
export interface ThemeConfig {
|
|
120
|
+
primaryColor: string;
|
|
121
|
+
backgroundColor: string;
|
|
122
|
+
statusBarStyle: SystemBarStyle;
|
|
123
|
+
navigationBarStyle: SystemBarStyle;
|
|
124
|
+
}
|
|
125
|
+
export interface NativeFeatureConfig {
|
|
126
|
+
safeArea: SafeAreaFeatureConfig;
|
|
127
|
+
guide: {
|
|
128
|
+
enabled: boolean;
|
|
129
|
+
};
|
|
130
|
+
adSplash: {
|
|
131
|
+
enabled: boolean;
|
|
132
|
+
};
|
|
133
|
+
highPerformanceMode: boolean;
|
|
134
|
+
theme: ThemeConfig;
|
|
135
|
+
location: LocationFeatureConfig;
|
|
136
|
+
videoPlayer: {
|
|
137
|
+
enabled: boolean;
|
|
138
|
+
};
|
|
139
|
+
platform: PlatformConfig;
|
|
140
|
+
}
|
|
141
|
+
export interface LocationFeatureConfig {
|
|
142
|
+
enabled: boolean;
|
|
143
|
+
highAccuracy: boolean;
|
|
144
|
+
}
|
|
145
|
+
export interface LocationStatus {
|
|
146
|
+
enabled: boolean;
|
|
147
|
+
highAccuracy: boolean;
|
|
148
|
+
permissionGranted: boolean;
|
|
149
|
+
}
|
|
150
|
+
export interface LocationResult {
|
|
151
|
+
success: boolean;
|
|
152
|
+
message?: string;
|
|
153
|
+
enabled?: boolean;
|
|
154
|
+
permissionGranted?: boolean;
|
|
155
|
+
latitude?: number;
|
|
156
|
+
longitude?: number;
|
|
157
|
+
accuracy?: number;
|
|
158
|
+
altitude?: number;
|
|
159
|
+
speed?: number;
|
|
160
|
+
bearing?: number;
|
|
161
|
+
timestamp?: number;
|
|
162
|
+
provider?: string;
|
|
163
|
+
}
|
|
164
|
+
export interface LocationPermissionResult {
|
|
165
|
+
success: boolean;
|
|
166
|
+
granted: boolean;
|
|
167
|
+
message: string;
|
|
168
|
+
}
|
|
169
|
+
export interface LocationWatchResult {
|
|
170
|
+
success: boolean;
|
|
171
|
+
watchId?: string;
|
|
172
|
+
intervalMs?: number;
|
|
173
|
+
message?: string;
|
|
174
|
+
}
|
|
175
|
+
export interface LocationWatchUpdate {
|
|
176
|
+
watchId: string;
|
|
177
|
+
location: Omit<LocationResult, 'success' | 'message' | 'enabled' | 'permissionGranted'>;
|
|
178
|
+
}
|
|
179
|
+
export interface VideoPlayerStatus {
|
|
180
|
+
enabled: boolean;
|
|
181
|
+
supportedFormats: string[];
|
|
182
|
+
}
|
|
183
|
+
export interface PlayVideoOptions {
|
|
184
|
+
url: string;
|
|
185
|
+
src?: string;
|
|
186
|
+
title?: string;
|
|
187
|
+
startPositionMs?: number;
|
|
188
|
+
startMs?: number;
|
|
189
|
+
autoplay?: boolean;
|
|
190
|
+
}
|
|
191
|
+
export interface PlayVideoResult {
|
|
192
|
+
success: boolean;
|
|
193
|
+
message: string;
|
|
194
|
+
}
|
|
195
|
+
export interface HttpRequestOptions {
|
|
196
|
+
url: string;
|
|
197
|
+
method?: string;
|
|
198
|
+
headers?: Record<string, string>;
|
|
199
|
+
body?: string;
|
|
200
|
+
timeout?: number;
|
|
201
|
+
}
|
|
202
|
+
export interface HttpRequestResult {
|
|
203
|
+
status: number;
|
|
204
|
+
statusText: string;
|
|
205
|
+
headers: Record<string, string>;
|
|
206
|
+
data: string;
|
|
207
|
+
url: string;
|
|
208
|
+
}
|
|
209
|
+
export interface SetAppThemeOptions extends Partial<ThemeConfig> {
|
|
210
|
+
}
|
|
211
|
+
export type AppIconId = 'default' | 'alt1' | 'alt2' | 'custom';
|
|
212
|
+
export interface AppIconOption {
|
|
213
|
+
id: AppIconId;
|
|
214
|
+
label: string;
|
|
215
|
+
custom?: boolean;
|
|
216
|
+
}
|
|
217
|
+
export interface AppIconState {
|
|
218
|
+
iconId: AppIconId;
|
|
219
|
+
label: string;
|
|
220
|
+
/** 始终为 true:替换同一应用桌面图标,不新增启动器应用 */
|
|
221
|
+
replacesExistingIcon?: boolean;
|
|
222
|
+
/** 应为 1;大于 1 表示曾出现多个桌面入口,需手动删除多余快捷方式 */
|
|
223
|
+
launcherEntryCount?: number;
|
|
224
|
+
pendingBackgroundFinalize?: boolean;
|
|
225
|
+
componentEnabled?: boolean;
|
|
226
|
+
customIconPath: string;
|
|
227
|
+
customIconExists: boolean;
|
|
228
|
+
supportsCustomFromUrl: boolean;
|
|
229
|
+
}
|
|
230
|
+
export interface AppIconsResult {
|
|
231
|
+
icons: AppIconOption[];
|
|
232
|
+
current: AppIconState;
|
|
233
|
+
}
|
|
234
|
+
export interface SetAppIconOptions {
|
|
235
|
+
iconId: AppIconId;
|
|
236
|
+
/** 与 iconId 等价 */
|
|
237
|
+
icon?: AppIconId;
|
|
238
|
+
}
|
|
239
|
+
export interface SetAppIconResult {
|
|
240
|
+
success: boolean;
|
|
241
|
+
iconId: AppIconId;
|
|
242
|
+
message: string;
|
|
243
|
+
requiresLauncherRefresh?: boolean;
|
|
244
|
+
/** 为 true 时表示旧Default入口将在应用进入后台后Close,前台不会因此退出 */
|
|
245
|
+
pendingBackgroundFinalize?: boolean;
|
|
246
|
+
}
|
|
247
|
+
export interface SetNativeFeaturesOptions {
|
|
248
|
+
guideEnabled?: boolean;
|
|
249
|
+
adSplashEnabled?: boolean;
|
|
250
|
+
safeAreaEnableTop?: boolean;
|
|
251
|
+
safeAreaEnableBottom?: boolean;
|
|
252
|
+
/** 头部安全区/状态栏背景色(如 #RRGGBB),传空串不覆盖 */
|
|
253
|
+
safeAreaTopBackgroundColor?: string;
|
|
254
|
+
/** 底部安全区背景色(如 #RRGGBB),传空串不覆盖 */
|
|
255
|
+
safeAreaBottomBackgroundColor?: string;
|
|
256
|
+
/** 扁平字段,与 theme 二选一或同时使用 */
|
|
257
|
+
primaryColor?: string;
|
|
258
|
+
backgroundColor?: string;
|
|
259
|
+
statusBarStyle?: SystemBarStyle;
|
|
260
|
+
navigationBarStyle?: SystemBarStyle;
|
|
261
|
+
locationEnabled?: boolean;
|
|
262
|
+
videoPlayerEnabled?: boolean;
|
|
263
|
+
/** 嵌套主题对象,便于与配置文件结构一致 */
|
|
264
|
+
theme?: SetAppThemeOptions;
|
|
265
|
+
}
|
|
266
|
+
export interface DeviceInfo {
|
|
267
|
+
brand: string;
|
|
268
|
+
manufacturer: string;
|
|
269
|
+
model: string;
|
|
270
|
+
device: string;
|
|
271
|
+
androidId: string;
|
|
272
|
+
screenWidth: number;
|
|
273
|
+
screenHeight: number;
|
|
274
|
+
density: number;
|
|
275
|
+
networkType: string;
|
|
276
|
+
carrierName: string;
|
|
277
|
+
/** 屏幕方向,三端 getScreenInfo/getOrientation 也会返回 */
|
|
278
|
+
orientation?: ScreenOrientationName;
|
|
279
|
+
/** 0 / 90 / 180 / 270 */
|
|
280
|
+
rotation?: number;
|
|
281
|
+
screenLocked?: boolean;
|
|
282
|
+
}
|
|
283
|
+
export type ScreenOrientationName = 'portrait' | 'landscape' | 'unknown';
|
|
284
|
+
/** 物理分辨率(px / dp) */
|
|
285
|
+
export interface ScreenInfo {
|
|
286
|
+
widthPx: number;
|
|
287
|
+
heightPx: number;
|
|
288
|
+
widthDp: number;
|
|
289
|
+
heightDp: number;
|
|
290
|
+
density: number;
|
|
291
|
+
densityDpi: number;
|
|
292
|
+
xdpi: number;
|
|
293
|
+
ydpi: number;
|
|
294
|
+
}
|
|
295
|
+
export interface OrientationInfo {
|
|
296
|
+
orientation: ScreenOrientationName;
|
|
297
|
+
/** 0 / 90 / 180 / 270 */
|
|
298
|
+
rotation: number;
|
|
299
|
+
portrait: boolean;
|
|
300
|
+
landscape: boolean;
|
|
301
|
+
}
|
|
302
|
+
export interface LockStatus {
|
|
303
|
+
/** 当前是否锁屏(或钥匙串/保护数据不可用) */
|
|
304
|
+
locked: boolean;
|
|
305
|
+
keyguardLocked: boolean;
|
|
306
|
+
deviceLocked?: boolean;
|
|
307
|
+
secure?: boolean;
|
|
308
|
+
/** Harmony 可能为 false(系统未暴露锁屏查询) */
|
|
309
|
+
supported: boolean;
|
|
310
|
+
}
|
|
311
|
+
export interface SystemInfo {
|
|
312
|
+
os: string;
|
|
313
|
+
sdkInt: number;
|
|
314
|
+
release: string;
|
|
315
|
+
incremental: string;
|
|
316
|
+
locale: string;
|
|
317
|
+
timezone: string;
|
|
318
|
+
abi: string;
|
|
319
|
+
}
|
|
320
|
+
export interface SafeAreaInsets {
|
|
321
|
+
top: number;
|
|
322
|
+
bottom: number;
|
|
323
|
+
left: number;
|
|
324
|
+
right: number;
|
|
325
|
+
topPx: number;
|
|
326
|
+
bottomPx: number;
|
|
327
|
+
enableTop: boolean;
|
|
328
|
+
enableBottom: boolean;
|
|
329
|
+
/** 头部安全区/状态栏背景色,未配置时为空串 */
|
|
330
|
+
topBackgroundColor?: string;
|
|
331
|
+
/** 底部安全区背景色,未配置时为空串 */
|
|
332
|
+
bottomBackgroundColor?: string;
|
|
333
|
+
}
|
|
334
|
+
/** WebView 窗口与安全区信息(css px) */
|
|
335
|
+
export interface WindowInfo {
|
|
336
|
+
pixelRatio: number;
|
|
337
|
+
screenWidth: number;
|
|
338
|
+
screenHeight: number;
|
|
339
|
+
windowWidth: number;
|
|
340
|
+
windowHeight: number;
|
|
341
|
+
windowTop: number;
|
|
342
|
+
windowBottom: number;
|
|
343
|
+
statusBarHeight: number;
|
|
344
|
+
screenTop?: number;
|
|
345
|
+
safeArea: {
|
|
346
|
+
left: number;
|
|
347
|
+
right: number;
|
|
348
|
+
top: number;
|
|
349
|
+
bottom: number;
|
|
350
|
+
width: number;
|
|
351
|
+
height: number;
|
|
352
|
+
};
|
|
353
|
+
safeAreaInsets: {
|
|
354
|
+
top: number;
|
|
355
|
+
bottom: number;
|
|
356
|
+
left: number;
|
|
357
|
+
right: number;
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
export interface NotificationOptions {
|
|
361
|
+
title: string;
|
|
362
|
+
body: string;
|
|
363
|
+
badge?: number;
|
|
364
|
+
id?: number;
|
|
365
|
+
}
|
|
366
|
+
export interface ResourceUpdateResult {
|
|
367
|
+
hasUpdate: boolean;
|
|
368
|
+
version?: string;
|
|
369
|
+
url?: string;
|
|
370
|
+
force?: boolean;
|
|
371
|
+
}
|
|
372
|
+
export interface LaunchAppOptions {
|
|
373
|
+
/** 目标应用包名,如 com.tencent.mm */
|
|
374
|
+
packageName?: string;
|
|
375
|
+
/** 深链 / URL,如 weixin://、alipays://、https:// */
|
|
376
|
+
uri?: string;
|
|
377
|
+
url?: string;
|
|
378
|
+
/** 未安装时降级打开的链接(应用商店或 H5) */
|
|
379
|
+
fallbackUrl?: string;
|
|
380
|
+
fallbackUri?: string;
|
|
381
|
+
/** Custom Intent action */
|
|
382
|
+
action?: string;
|
|
383
|
+
dataUri?: string;
|
|
384
|
+
type?: string;
|
|
385
|
+
extras?: Record<string, string | number | boolean>;
|
|
386
|
+
}
|
|
387
|
+
export interface LaunchAppResult {
|
|
388
|
+
success: boolean;
|
|
389
|
+
message: string;
|
|
390
|
+
target?: string;
|
|
391
|
+
}
|
|
392
|
+
export interface OpenInBrowserOptions {
|
|
393
|
+
/** http/https 完整地址 */
|
|
394
|
+
url: string;
|
|
395
|
+
/** 与 url 等价 */
|
|
396
|
+
uri?: string;
|
|
397
|
+
}
|
|
398
|
+
export interface OpenInBrowserResult {
|
|
399
|
+
success: boolean;
|
|
400
|
+
message: string;
|
|
401
|
+
/** 实际打开的地址 */
|
|
402
|
+
target?: string;
|
|
403
|
+
}
|
|
404
|
+
export interface AppInstalledResult {
|
|
405
|
+
packageName: string;
|
|
406
|
+
installed: boolean;
|
|
407
|
+
}
|
|
408
|
+
export interface CheckAppsInstalledResult {
|
|
409
|
+
apps: AppInstalledResult[];
|
|
410
|
+
}
|
|
411
|
+
export interface InstallResourcePackageOptions {
|
|
412
|
+
/** 资源包 ZIP 下载地址(来自 update/download-url) */
|
|
413
|
+
url: string;
|
|
414
|
+
/** 安装成功后是否Restart now App,Default true */
|
|
415
|
+
restart?: boolean;
|
|
416
|
+
/** OTA 推送 ID,配合 version 可自动上报 update/record */
|
|
417
|
+
pushId?: number;
|
|
418
|
+
/** 目标版本号 */
|
|
419
|
+
version?: string;
|
|
420
|
+
uid?: string;
|
|
421
|
+
forceUpdate?: number;
|
|
422
|
+
}
|
|
423
|
+
export interface InstallAppPackageOptions {
|
|
424
|
+
/** APK/HAP 下载地址(来自 update/download-url) */
|
|
425
|
+
url: string;
|
|
426
|
+
pushId?: number;
|
|
427
|
+
version?: string;
|
|
428
|
+
uid?: string;
|
|
429
|
+
forceUpdate?: number;
|
|
430
|
+
}
|
|
431
|
+
export interface InstallResourcePackageResult {
|
|
432
|
+
success: boolean;
|
|
433
|
+
needsRestart?: boolean;
|
|
434
|
+
restarted?: boolean;
|
|
435
|
+
message?: string;
|
|
436
|
+
}
|
|
437
|
+
export interface InstallAppPackageResult {
|
|
438
|
+
success: boolean;
|
|
439
|
+
redirectedToStore?: boolean;
|
|
440
|
+
needsInstallPermission?: boolean;
|
|
441
|
+
message?: string;
|
|
442
|
+
}
|
|
443
|
+
export interface ApkUpdateResult {
|
|
444
|
+
hasUpdate: boolean;
|
|
445
|
+
versionCode?: number;
|
|
446
|
+
versionName?: string;
|
|
447
|
+
url?: string;
|
|
448
|
+
force?: boolean;
|
|
449
|
+
description?: string;
|
|
450
|
+
}
|
|
451
|
+
/** App 统一配置文件 app/src/main/assets/www/app_config.json */
|
|
452
|
+
export interface AppConfigFile {
|
|
453
|
+
packageName?: string;
|
|
454
|
+
appName?: string;
|
|
455
|
+
/** 前端入口:本地 index.html 或远程 https://... */
|
|
456
|
+
url?: string;
|
|
457
|
+
wwwEntry?: string;
|
|
458
|
+
safeArea?: SafeAreaFeatureConfig;
|
|
459
|
+
guide?: {
|
|
460
|
+
enabled?: boolean;
|
|
461
|
+
pages?: unknown[];
|
|
462
|
+
};
|
|
463
|
+
adSplash?: {
|
|
464
|
+
enabled?: boolean;
|
|
465
|
+
};
|
|
466
|
+
performance?: {
|
|
467
|
+
highPerformanceMode?: boolean;
|
|
468
|
+
};
|
|
469
|
+
theme?: Partial<ThemeConfig>;
|
|
470
|
+
location?: Partial<LocationFeatureConfig>;
|
|
471
|
+
videoPlayer?: {
|
|
472
|
+
enabled?: boolean;
|
|
473
|
+
};
|
|
474
|
+
/** @deprecated OTA 鉴权在壳 OtaConstants 中配置,勿在 app_config 中写 platform */
|
|
475
|
+
platform?: Partial<PlatformConfig> & {
|
|
476
|
+
id?: string;
|
|
477
|
+
};
|
|
478
|
+
update?: {
|
|
479
|
+
useCustomUpdate?: boolean;
|
|
480
|
+
resourceCheckUrl?: string;
|
|
481
|
+
apkCheckUrl?: string;
|
|
482
|
+
};
|
|
483
|
+
store?: Record<string, unknown>;
|
|
484
|
+
}
|
|
485
|
+
/** @deprecated 请使用 AppConfigFile,配置已统一到 app_config.json */
|
|
486
|
+
export type FrontendConfigFile = AppConfigFile;
|
|
487
|
+
export interface NativeOk {
|
|
488
|
+
success: boolean;
|
|
489
|
+
message?: string;
|
|
490
|
+
}
|
|
491
|
+
export interface ClipboardResult extends NativeOk {
|
|
492
|
+
text?: string;
|
|
493
|
+
}
|
|
494
|
+
export interface ShareOptions {
|
|
495
|
+
title?: string;
|
|
496
|
+
text?: string;
|
|
497
|
+
url?: string;
|
|
498
|
+
}
|
|
499
|
+
export interface PickerResult extends NativeOk {
|
|
500
|
+
type?: 'image' | 'video' | 'file';
|
|
501
|
+
uri?: string;
|
|
502
|
+
name?: string;
|
|
503
|
+
mimeType?: string;
|
|
504
|
+
size?: number;
|
|
505
|
+
dataUrl?: string;
|
|
506
|
+
}
|
|
507
|
+
export interface ScanResult extends NativeOk {
|
|
508
|
+
text?: string;
|
|
509
|
+
format?: string;
|
|
510
|
+
}
|
|
511
|
+
export interface BiometricStatus {
|
|
512
|
+
available: boolean;
|
|
513
|
+
enrolled?: boolean;
|
|
514
|
+
biometryType?: 'none' | 'touch' | 'face' | 'unknown';
|
|
515
|
+
message?: string;
|
|
516
|
+
}
|
|
517
|
+
export interface ContactResult extends NativeOk {
|
|
518
|
+
name?: string;
|
|
519
|
+
phones?: string[];
|
|
520
|
+
emails?: string[];
|
|
521
|
+
}
|
|
522
|
+
export interface CalendarEventOptions {
|
|
523
|
+
title?: string;
|
|
524
|
+
notes?: string;
|
|
525
|
+
location?: string;
|
|
526
|
+
startMs?: number;
|
|
527
|
+
endMs?: number;
|
|
528
|
+
}
|
|
529
|
+
export interface AdapterState {
|
|
530
|
+
available: boolean;
|
|
531
|
+
enabled: boolean;
|
|
532
|
+
state?: string;
|
|
533
|
+
message?: string;
|
|
534
|
+
}
|
|
535
|
+
export interface MotionReading {
|
|
536
|
+
success: boolean;
|
|
537
|
+
accelerometer?: {
|
|
538
|
+
x: number;
|
|
539
|
+
y: number;
|
|
540
|
+
z: number;
|
|
541
|
+
};
|
|
542
|
+
gyroscope?: {
|
|
543
|
+
x: number;
|
|
544
|
+
y: number;
|
|
545
|
+
z: number;
|
|
546
|
+
};
|
|
547
|
+
message?: string;
|
|
548
|
+
}
|
|
549
|
+
export interface PedometerResult extends NativeOk {
|
|
550
|
+
supported?: boolean;
|
|
551
|
+
steps?: number;
|
|
552
|
+
}
|
|
553
|
+
export interface FlashlightState extends NativeOk {
|
|
554
|
+
on?: boolean;
|
|
555
|
+
supported?: boolean;
|
|
556
|
+
}
|
|
557
|
+
export interface BrightnessState extends NativeOk {
|
|
558
|
+
value?: number;
|
|
559
|
+
}
|
|
560
|
+
export interface VolumeState extends NativeOk {
|
|
561
|
+
value?: number;
|
|
562
|
+
}
|
|
563
|
+
export interface RecorderResult extends NativeOk {
|
|
564
|
+
path?: string;
|
|
565
|
+
dataUrl?: string;
|
|
566
|
+
}
|
|
567
|
+
export interface CaptureResult extends NativeOk {
|
|
568
|
+
path?: string;
|
|
569
|
+
dataUrl?: string;
|
|
570
|
+
}
|
|
571
|
+
export interface PaymentOptions {
|
|
572
|
+
/** 收银 / H5 支付页。不内置微信/支付宝原生 SDK。 */
|
|
573
|
+
url?: string;
|
|
574
|
+
payUrl?: string;
|
|
575
|
+
channel?: string;
|
|
576
|
+
}
|
|
577
|
+
export interface PaymentResult extends NativeOk {
|
|
578
|
+
channel?: string;
|
|
579
|
+
target?: string;
|
|
580
|
+
}
|
|
581
|
+
export interface ReviewResult extends NativeOk {
|
|
582
|
+
shown?: boolean;
|
|
583
|
+
}
|
|
584
|
+
export interface PushTokenResult extends NativeOk {
|
|
585
|
+
provider?: string;
|
|
586
|
+
token?: string;
|
|
587
|
+
connected?: boolean;
|
|
588
|
+
}
|
|
589
|
+
declare global {
|
|
590
|
+
interface Window {
|
|
591
|
+
AndroidBridge?: {
|
|
592
|
+
postMessage: (msg: string) => void;
|
|
593
|
+
};
|
|
594
|
+
HarmonyBridge?: {
|
|
595
|
+
postMessage: (msg: string) => void;
|
|
596
|
+
};
|
|
597
|
+
webkit?: {
|
|
598
|
+
messageHandlers?: {
|
|
599
|
+
IOSBridge?: {
|
|
600
|
+
postMessage: (msg: string) => void;
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
};
|
|
604
|
+
Native?: typeof import('./native').Native;
|
|
605
|
+
__nativeBridgeCallback?: (id: string, success: boolean, payload: string | object) => void;
|
|
606
|
+
__nativeBridgeLocationUpdate?: (payload: LocationWatchUpdate) => void;
|
|
607
|
+
__NATIVE_BRIDGE_RUNTIME__?: NativeFeatureConfig;
|
|
608
|
+
}
|
|
609
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/version.js
ADDED