assistsx-js 0.1.41 → 0.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 +32 -0
- package/dist/index.cjs +7957 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +4231 -0
- package/dist/index.d.ts +4231 -30
- package/dist/index.global.js +46 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +7879 -30
- package/dist/index.js.map +1 -0
- package/package.json +11 -5
- package/src/{AssistsXAsync.ts → assistsx-async.ts} +8 -8
- package/src/{AssistsX.ts → assistsx.ts} +8 -8
- package/src/barutils/bar-utils.ts +3 -3
- package/src/filesystem/fileio/file-io.ts +2 -2
- package/src/filesystem/fileutils/file-utils.ts +2 -2
- package/src/filesystem/path.ts +2 -2
- package/src/floatingwindow/float.ts +4 -4
- package/src/gallery/gallery.ts +2 -2
- package/src/global.d.ts +6 -1
- package/src/imageutils/image-utils.ts +2 -2
- package/src/ime/ime.ts +2 -2
- package/src/index.ts +21 -20
- package/src/log/log-call-method.ts +28 -0
- package/src/log/log.ts +445 -0
- package/src/mlkit/mlkit.ts +3 -3
- package/src/network/http.ts +2 -2
- package/src/{NodeAsync.ts → node-async.ts} +5 -5
- package/src/{Node.ts → node.ts} +5 -5
- package/src/{StepAsync.ts → step-async.ts} +8 -8
- package/src/{Step.ts → step.ts} +7 -7
- package/dist/AccessibilityEventFilter.d.ts +0 -105
- package/dist/AccessibilityEventFilter.js +0 -89
- package/dist/AppInfo.d.ts +0 -45
- package/dist/AppInfo.js +0 -38
- package/dist/AssistsX.d.ts +0 -484
- package/dist/AssistsX.js +0 -828
- package/dist/AssistsXAsync.d.ts +0 -532
- package/dist/AssistsXAsync.js +0 -874
- package/dist/Bounds.d.ts +0 -48
- package/dist/Bounds.js +0 -68
- package/dist/CallMethod.d.ts +0 -69
- package/dist/CallMethod.js +0 -71
- package/dist/CallResponse.d.ts +0 -10
- package/dist/CallResponse.js +0 -28
- package/dist/DeviceInfo.d.ts +0 -69
- package/dist/DeviceInfo.js +0 -50
- package/dist/Node.d.ts +0 -334
- package/dist/Node.js +0 -369
- package/dist/NodeAsync.d.ts +0 -213
- package/dist/NodeAsync.js +0 -313
- package/dist/NodeClassValue.d.ts +0 -15
- package/dist/NodeClassValue.js +0 -15
- package/dist/Step.d.ts +0 -355
- package/dist/Step.js +0 -689
- package/dist/StepAsync.d.ts +0 -162
- package/dist/StepAsync.js +0 -264
- package/dist/StepError.d.ts +0 -35
- package/dist/StepError.js +0 -26
- package/dist/StepStateStore.d.ts +0 -14
- package/dist/StepStateStore.js +0 -37
- package/dist/Utils.d.ts +0 -3
- package/dist/Utils.js +0 -20
- package/dist/WindowFlags.d.ts +0 -75
- package/dist/WindowFlags.js +0 -97
- package/dist/barutils/BarUtilsCallMethod.d.ts +0 -24
- package/dist/barutils/BarUtilsCallMethod.js +0 -26
- package/dist/barutils/bar-utils.d.ts +0 -41
- package/dist/barutils/bar-utils.js +0 -205
- package/dist/filesystem/fileio/file-io.d.ts +0 -101
- package/dist/filesystem/fileio/file-io.js +0 -235
- package/dist/filesystem/fileutils/file-utils.d.ts +0 -242
- package/dist/filesystem/fileutils/file-utils.js +0 -493
- package/dist/filesystem/path.d.ts +0 -252
- package/dist/filesystem/path.js +0 -589
- package/dist/floatingwindow/FloatCallMethod.d.ts +0 -19
- package/dist/floatingwindow/FloatCallMethod.js +0 -18
- package/dist/floatingwindow/float.d.ts +0 -29
- package/dist/floatingwindow/float.js +0 -149
- package/dist/gallery/gallery.d.ts +0 -60
- package/dist/gallery/gallery.js +0 -142
- package/dist/imageutils/image-utils.d.ts +0 -442
- package/dist/imageutils/image-utils.js +0 -543
- package/dist/ime/ime.d.ts +0 -80
- package/dist/ime/ime.js +0 -141
- package/dist/mlkit/MlkitCallMethod.d.ts +0 -27
- package/dist/mlkit/MlkitCallMethod.js +0 -26
- package/dist/mlkit/mlkit.d.ts +0 -86
- package/dist/mlkit/mlkit.js +0 -169
- package/dist/network/http.d.ts +0 -127
- package/dist/network/http.js +0 -202
- /package/src/{AccessibilityEventFilter.ts → accessibility-event-filter.ts} +0 -0
- /package/src/{AppInfo.ts → app-info.ts} +0 -0
- /package/src/barutils/{BarUtilsCallMethod.ts → bar-utils-call-method.ts} +0 -0
- /package/src/{Bounds.ts → bounds.ts} +0 -0
- /package/src/{CallMethod.ts → call-method.ts} +0 -0
- /package/src/{CallResponse.ts → call-response.ts} +0 -0
- /package/src/{DeviceInfo.ts → device-info.ts} +0 -0
- /package/src/floatingwindow/{FloatCallMethod.ts → float-call-method.ts} +0 -0
- /package/src/mlkit/{MlkitCallMethod.ts → mlkit-call-method.ts} +0 -0
- /package/src/{NodeClassValue.ts → node-class-value.ts} +0 -0
- /package/src/{StepError.ts → step-error.ts} +0 -0
- /package/src/{StepStateStore.ts → step-state-store.ts} +0 -0
- /package/src/{Utils.ts → utils.ts} +0 -0
- /package/src/{WindowFlags.ts → window-flags.ts} +0 -0
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Float window API for WebView.
|
|
3
|
-
* Requires assistsxFloat native bridge. Matches FloatJsInterface.kt.
|
|
4
|
-
*/
|
|
5
|
-
import { CallResponse } from "../CallResponse";
|
|
6
|
-
import { decodeBase64UTF8, generateUUID } from "../Utils";
|
|
7
|
-
import { FloatCallMethod } from "./FloatCallMethod";
|
|
8
|
-
const callbacks = new Map();
|
|
9
|
-
if (typeof window !== "undefined" && !window.assistsxFloatCallback) {
|
|
10
|
-
window.assistsxFloatCallback = (data) => {
|
|
11
|
-
let callbackId;
|
|
12
|
-
try {
|
|
13
|
-
const json = decodeBase64UTF8(data);
|
|
14
|
-
const response = JSON.parse(json);
|
|
15
|
-
callbackId = response.callbackId;
|
|
16
|
-
if (callbackId) {
|
|
17
|
-
const callback = callbacks.get(callbackId);
|
|
18
|
-
if (callback) {
|
|
19
|
-
callback(json);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
catch (e) {
|
|
24
|
-
console.error("Float callback error:", e);
|
|
25
|
-
}
|
|
26
|
-
finally {
|
|
27
|
-
if (callbackId) {
|
|
28
|
-
callbacks.delete(callbackId);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export class Float {
|
|
34
|
-
async asyncCall(method, args, timeout = 30) {
|
|
35
|
-
const uuid = generateUUID();
|
|
36
|
-
const params = {
|
|
37
|
-
method,
|
|
38
|
-
arguments: args !== null && args !== void 0 ? args : undefined,
|
|
39
|
-
callbackId: uuid,
|
|
40
|
-
};
|
|
41
|
-
const promise = new Promise((resolve) => {
|
|
42
|
-
callbacks.set(uuid, (data) => {
|
|
43
|
-
resolve(data);
|
|
44
|
-
});
|
|
45
|
-
setTimeout(() => {
|
|
46
|
-
callbacks.delete(uuid);
|
|
47
|
-
resolve(JSON.stringify(new CallResponse(-1, { message: "Timeout" }, uuid)));
|
|
48
|
-
}, timeout * 1000);
|
|
49
|
-
});
|
|
50
|
-
window.assistsxFloat.call(JSON.stringify(params));
|
|
51
|
-
const promiseResult = await promise;
|
|
52
|
-
if (typeof promiseResult === "string") {
|
|
53
|
-
const responseData = JSON.parse(promiseResult);
|
|
54
|
-
const data = responseData.code !== 0 && responseData.message != null
|
|
55
|
-
? { message: responseData.message }
|
|
56
|
-
: responseData.data;
|
|
57
|
-
return new CallResponse(responseData.code, data, responseData.callbackId);
|
|
58
|
-
}
|
|
59
|
-
throw new Error("Float call failed");
|
|
60
|
-
}
|
|
61
|
-
errorMessage(res, fallback) {
|
|
62
|
-
const d = res.getDataOrNull();
|
|
63
|
-
if (d &&
|
|
64
|
-
typeof d === "object" &&
|
|
65
|
-
typeof d.message === "string") {
|
|
66
|
-
return d.message;
|
|
67
|
-
}
|
|
68
|
-
if (typeof d === "string")
|
|
69
|
-
return d;
|
|
70
|
-
return fallback;
|
|
71
|
-
}
|
|
72
|
-
/** Load floating window */
|
|
73
|
-
async open(url, options = {}) {
|
|
74
|
-
const { initialWidth, initialHeight, initialX, initialY, minWidth, minHeight, maxWidth, maxHeight, initialCenter, showTopOperationArea, showBottomOperationArea, backgroundColor, timeout, } = options;
|
|
75
|
-
const res = await this.asyncCall(FloatCallMethod.open, {
|
|
76
|
-
url,
|
|
77
|
-
initialWidth,
|
|
78
|
-
initialHeight,
|
|
79
|
-
initialX,
|
|
80
|
-
initialY,
|
|
81
|
-
minWidth,
|
|
82
|
-
minHeight,
|
|
83
|
-
maxWidth,
|
|
84
|
-
maxHeight,
|
|
85
|
-
initialCenter,
|
|
86
|
-
showTopOperationArea,
|
|
87
|
-
showBottomOperationArea,
|
|
88
|
-
backgroundColor,
|
|
89
|
-
}, timeout);
|
|
90
|
-
if (!res.isSuccess()) {
|
|
91
|
-
throw new Error(this.errorMessage(res, "Float.open failed"));
|
|
92
|
-
}
|
|
93
|
-
return res.getDataOrDefault(false);
|
|
94
|
-
}
|
|
95
|
-
/** Close current floating window */
|
|
96
|
-
async close(timeout) {
|
|
97
|
-
const res = await this.asyncCall(FloatCallMethod.close, undefined, timeout);
|
|
98
|
-
if (!res.isSuccess()) {
|
|
99
|
-
throw new Error(this.errorMessage(res, "Float.close failed"));
|
|
100
|
-
}
|
|
101
|
-
return res.getDataOrDefault(false);
|
|
102
|
-
}
|
|
103
|
-
/** Set overlay flags */
|
|
104
|
-
async setFlags(flags, timeout) {
|
|
105
|
-
const flagList = Array.isArray(flags) ? flags : [flags];
|
|
106
|
-
const res = await this.asyncCall(FloatCallMethod.setFlags, { flags: flagList }, timeout);
|
|
107
|
-
if (!res.isSuccess()) {
|
|
108
|
-
throw new Error(this.errorMessage(res, "Float.setFlags failed"));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
/** Show overlay toast */
|
|
112
|
-
async toast(text, delay = 2000, timeout) {
|
|
113
|
-
const res = await this.asyncCall(FloatCallMethod.toast, { text, delay }, timeout);
|
|
114
|
-
if (!res.isSuccess()) {
|
|
115
|
-
throw new Error(this.errorMessage(res, "Float.toast failed"));
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/** Move floating window to x, y */
|
|
119
|
-
async move(x, y, timeout) {
|
|
120
|
-
const res = await this.asyncCall(FloatCallMethod.move, { x, y }, timeout);
|
|
121
|
-
if (!res.isSuccess()) {
|
|
122
|
-
throw new Error(this.errorMessage(res, "Float.move failed"));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/** Refresh floating window view config. Optional: showTopOperationArea, showBottomOperationArea, backgroundColor, width, height, x, y (omit to keep current) */
|
|
126
|
-
async refresh(options = {}) {
|
|
127
|
-
const { showTopOperationArea, showBottomOperationArea, backgroundColor, width, height, x, y, timeout, } = options;
|
|
128
|
-
const args = {};
|
|
129
|
-
if (showTopOperationArea !== undefined)
|
|
130
|
-
args.showTopOperationArea = showTopOperationArea;
|
|
131
|
-
if (showBottomOperationArea !== undefined)
|
|
132
|
-
args.showBottomOperationArea = showBottomOperationArea;
|
|
133
|
-
if (backgroundColor !== undefined)
|
|
134
|
-
args.backgroundColor = backgroundColor;
|
|
135
|
-
if (width !== undefined)
|
|
136
|
-
args.width = width;
|
|
137
|
-
if (height !== undefined)
|
|
138
|
-
args.height = height;
|
|
139
|
-
if (x !== undefined)
|
|
140
|
-
args.x = x;
|
|
141
|
-
if (y !== undefined)
|
|
142
|
-
args.y = y;
|
|
143
|
-
const res = await this.asyncCall(FloatCallMethod.refresh, Object.keys(args).length ? args : undefined, timeout);
|
|
144
|
-
if (!res.isSuccess()) {
|
|
145
|
-
throw new Error(this.errorMessage(res, "Float.refresh failed"));
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
export const float = new Float();
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 相册操作响应接口定义
|
|
3
|
-
*/
|
|
4
|
-
export interface GalleryResponse {
|
|
5
|
-
success: boolean;
|
|
6
|
-
uri?: string;
|
|
7
|
-
id?: number;
|
|
8
|
-
type?: string;
|
|
9
|
-
message?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* 删除相册项响应接口定义
|
|
13
|
-
*/
|
|
14
|
-
export interface GalleryDeleteResponse {
|
|
15
|
-
success: boolean;
|
|
16
|
-
deletedRows: number;
|
|
17
|
-
message?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare class Gallery {
|
|
20
|
-
/**
|
|
21
|
-
* 执行异步调用
|
|
22
|
-
* @param method 方法名
|
|
23
|
-
* @param args 参数对象
|
|
24
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
25
|
-
* @returns Promise<调用响应>
|
|
26
|
-
*/
|
|
27
|
-
private asyncCall;
|
|
28
|
-
/**
|
|
29
|
-
* 添加图片到系统相册
|
|
30
|
-
* @param filePath 图片文件路径(必需)
|
|
31
|
-
* @param displayName 显示名称(可选,默认使用文件名)
|
|
32
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
33
|
-
* @returns Promise<相册操作响应>
|
|
34
|
-
*/
|
|
35
|
-
addImageToGallery(filePath: string, displayName?: string, timeout?: number): Promise<GalleryResponse>;
|
|
36
|
-
/**
|
|
37
|
-
* 添加视频到系统相册
|
|
38
|
-
* @param filePath 视频文件路径(必需)
|
|
39
|
-
* @param displayName 显示名称(可选,默认使用文件名)
|
|
40
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
41
|
-
* @returns Promise<相册操作响应>
|
|
42
|
-
*/
|
|
43
|
-
addVideoToGallery(filePath: string, displayName?: string, timeout?: number): Promise<GalleryResponse>;
|
|
44
|
-
/**
|
|
45
|
-
* 从系统相册删除
|
|
46
|
-
* @param uri 媒体文件的URI(必需,格式如:content://media/external/images/media/123)
|
|
47
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
48
|
-
* @returns Promise<删除响应>
|
|
49
|
-
*/
|
|
50
|
-
deleteFromGalleryByUri(uri: string, timeout?: number): Promise<GalleryDeleteResponse>;
|
|
51
|
-
/**
|
|
52
|
-
* 从系统相册删除(通过ID和类型)
|
|
53
|
-
* @param id 媒体文件的ID(必需)
|
|
54
|
-
* @param type 媒体类型,"image" 或 "video"(必需)
|
|
55
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
56
|
-
* @returns Promise<删除响应>
|
|
57
|
-
*/
|
|
58
|
-
deleteFromGalleryById(id: number, type: "image" | "video", timeout?: number): Promise<GalleryDeleteResponse>;
|
|
59
|
-
}
|
|
60
|
-
export declare const gallery: Gallery;
|
package/dist/gallery/gallery.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 系统相册相关功能
|
|
3
|
-
* 提供添加图片/视频到相册和从相册删除的功能
|
|
4
|
-
*/
|
|
5
|
-
import { CallResponse } from "../CallResponse";
|
|
6
|
-
import { decodeBase64UTF8, generateUUID } from "../Utils";
|
|
7
|
-
// 回调函数存储对象
|
|
8
|
-
const callbacks = new Map();
|
|
9
|
-
// 初始化全局回调函数
|
|
10
|
-
if (typeof window !== "undefined" && !window.assistsxGalleryCallback) {
|
|
11
|
-
window.assistsxGalleryCallback = (data) => {
|
|
12
|
-
let callbackId;
|
|
13
|
-
try {
|
|
14
|
-
const json = decodeBase64UTF8(data);
|
|
15
|
-
const response = JSON.parse(json);
|
|
16
|
-
callbackId = response.callbackId;
|
|
17
|
-
if (callbackId) {
|
|
18
|
-
const callback = callbacks.get(callbackId);
|
|
19
|
-
if (callback) {
|
|
20
|
-
callback(json);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
console.error("Gallery callback error:", e);
|
|
26
|
-
}
|
|
27
|
-
finally {
|
|
28
|
-
if (callbackId) {
|
|
29
|
-
callbacks.delete(callbackId);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export class Gallery {
|
|
35
|
-
/**
|
|
36
|
-
* 执行异步调用
|
|
37
|
-
* @param method 方法名
|
|
38
|
-
* @param args 参数对象
|
|
39
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
40
|
-
* @returns Promise<调用响应>
|
|
41
|
-
*/
|
|
42
|
-
async asyncCall(method, args, timeout = 30) {
|
|
43
|
-
const uuid = generateUUID();
|
|
44
|
-
const params = {
|
|
45
|
-
method,
|
|
46
|
-
arguments: args ? args : undefined,
|
|
47
|
-
callbackId: uuid,
|
|
48
|
-
};
|
|
49
|
-
const promise = new Promise((resolve) => {
|
|
50
|
-
callbacks.set(uuid, (data) => {
|
|
51
|
-
resolve(data);
|
|
52
|
-
});
|
|
53
|
-
setTimeout(() => {
|
|
54
|
-
callbacks.delete(uuid);
|
|
55
|
-
resolve(JSON.stringify(new CallResponse(0, null, uuid)));
|
|
56
|
-
}, timeout * 1000);
|
|
57
|
-
});
|
|
58
|
-
const result = window.assistsxGallery.call(JSON.stringify(params));
|
|
59
|
-
const promiseResult = await promise;
|
|
60
|
-
if (typeof promiseResult === "string") {
|
|
61
|
-
const responseData = JSON.parse(promiseResult);
|
|
62
|
-
return new CallResponse(responseData.code, responseData.data, responseData.callbackId);
|
|
63
|
-
}
|
|
64
|
-
throw new Error("Call failed");
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* 添加图片到系统相册
|
|
68
|
-
* @param filePath 图片文件路径(必需)
|
|
69
|
-
* @param displayName 显示名称(可选,默认使用文件名)
|
|
70
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
71
|
-
* @returns Promise<相册操作响应>
|
|
72
|
-
*/
|
|
73
|
-
async addImageToGallery(filePath, displayName, timeout) {
|
|
74
|
-
var _a;
|
|
75
|
-
if (!filePath) {
|
|
76
|
-
throw new Error("filePath参数不能为空");
|
|
77
|
-
}
|
|
78
|
-
const response = await this.asyncCall("addImageToGallery", { filePath, displayName }, timeout);
|
|
79
|
-
if (!response.isSuccess()) {
|
|
80
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "添加图片到相册失败");
|
|
81
|
-
}
|
|
82
|
-
return response.data;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* 添加视频到系统相册
|
|
86
|
-
* @param filePath 视频文件路径(必需)
|
|
87
|
-
* @param displayName 显示名称(可选,默认使用文件名)
|
|
88
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
89
|
-
* @returns Promise<相册操作响应>
|
|
90
|
-
*/
|
|
91
|
-
async addVideoToGallery(filePath, displayName, timeout) {
|
|
92
|
-
var _a;
|
|
93
|
-
if (!filePath) {
|
|
94
|
-
throw new Error("filePath参数不能为空");
|
|
95
|
-
}
|
|
96
|
-
const response = await this.asyncCall("addVideoToGallery", { filePath, displayName }, timeout);
|
|
97
|
-
if (!response.isSuccess()) {
|
|
98
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "添加视频到相册失败");
|
|
99
|
-
}
|
|
100
|
-
return response.data;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* 从系统相册删除
|
|
104
|
-
* @param uri 媒体文件的URI(必需,格式如:content://media/external/images/media/123)
|
|
105
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
106
|
-
* @returns Promise<删除响应>
|
|
107
|
-
*/
|
|
108
|
-
async deleteFromGalleryByUri(uri, timeout) {
|
|
109
|
-
var _a;
|
|
110
|
-
if (!uri) {
|
|
111
|
-
throw new Error("uri参数不能为空");
|
|
112
|
-
}
|
|
113
|
-
const response = await this.asyncCall("deleteFromGallery", { uri }, timeout);
|
|
114
|
-
if (!response.isSuccess()) {
|
|
115
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "从相册删除失败");
|
|
116
|
-
}
|
|
117
|
-
return response.data;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* 从系统相册删除(通过ID和类型)
|
|
121
|
-
* @param id 媒体文件的ID(必需)
|
|
122
|
-
* @param type 媒体类型,"image" 或 "video"(必需)
|
|
123
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
124
|
-
* @returns Promise<删除响应>
|
|
125
|
-
*/
|
|
126
|
-
async deleteFromGalleryById(id, type, timeout) {
|
|
127
|
-
var _a;
|
|
128
|
-
if (id === undefined || id === null) {
|
|
129
|
-
throw new Error("id参数不能为空");
|
|
130
|
-
}
|
|
131
|
-
if (!type || (type !== "image" && type !== "video")) {
|
|
132
|
-
throw new Error("type参数必须为 'image' 或 'video'");
|
|
133
|
-
}
|
|
134
|
-
const response = await this.asyncCall("deleteFromGallery", { id, type }, timeout);
|
|
135
|
-
if (!response.isSuccess()) {
|
|
136
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "从相册删除失败");
|
|
137
|
-
}
|
|
138
|
-
return response.data;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// 导出常量实例
|
|
142
|
-
export const gallery = new Gallery();
|