deeke-script-app 1.6.9 → 1.7.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/@deekeScript/@type/Class/Global.d.ts +1 -1
- package/@deekeScript/@type/Class/Rect.d.ts +16 -16
- package/@deekeScript/@type/Class/UiSelector.d.ts +201 -201
- package/@deekeScript/@type/Class/WebSocket.d.ts +49 -49
- package/@deekeScript/@type/interface/Access.d.ts +104 -104
- package/@deekeScript/@type/interface/App.d.ts +101 -101
- package/@deekeScript/@type/interface/DeekeScriptJson.d.ts +13 -13
- package/@deekeScript/@type/interface/Device.d.ts +88 -88
- package/@deekeScript/@type/interface/Encrypt.d.ts +58 -58
- package/@deekeScript/@type/interface/Engines.d.ts +39 -39
- package/@deekeScript/@type/interface/Files.d.ts +283 -283
- package/@deekeScript/@type/interface/FloatDialogs.d.ts +41 -41
- package/@deekeScript/@type/interface/ForegroundServiceBridge.d.ts +31 -31
- package/@deekeScript/@type/interface/Hid.d.ts +342 -342
- package/@deekeScript/@type/interface/Http.d.ts +43 -41
- package/@deekeScript/@type/interface/Images.d.ts +71 -71
- package/@deekeScript/@type/interface/Java.d.ts +7 -7
- package/@deekeScript/@type/interface/KeyBoards.d.ts +27 -27
- package/@deekeScript/@type/interface/Log.d.ts +16 -16
- package/@deekeScript/@type/interface/MediaStore.d.ts +146 -146
- package/@deekeScript/@type/interface/NotificationBridge.d.ts +28 -28
- package/@deekeScript/@type/interface/{SocketIoClient.d.ts → SocketIOClient.d.ts} +76 -76
- package/@deekeScript/@type/interface/Storage.d.ts +119 -119
- package/@deekeScript/@type/interface/System.d.ts +114 -114
- package/@deekeScript/@type/interface/UiObject.d.ts +197 -197
- package/README.md +67 -67
- package/deekeScript.json +669 -669
- package/deekeScriptZipBuild +48 -48
- package/gulpfile +17 -17
- package/init +32 -32
- package/jsconfig.json +11 -11
- package/package.json +43 -43
- package/script/statistics/statistics.js +120 -120
- package/script/task.html +4 -4
- package/src/statistics/statistics.js +120 -120
- package/src/task/douyin_zan.js +89 -89
- package/src/task/dy.js +14 -14
- package/src/task/dyApp.js +7 -7
- package/src/task/tool.js +19 -19
- package/src/task.html +4 -4
- package/uglify-config.json +15 -15
- package/images/test/statistics.png +0 -0
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
var Http: Http;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
interface Http {
|
|
6
|
-
/**
|
|
7
|
-
* post请求
|
|
8
|
-
* @param url 请求地址
|
|
9
|
-
* @param json
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*
|
|
16
|
-
* @param
|
|
17
|
-
* @param headers 请求头
|
|
18
|
-
*/
|
|
19
|
-
public
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @param url 请求地址
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
declare global {
|
|
2
|
+
var Http: Http;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
interface Http {
|
|
6
|
+
/**
|
|
7
|
+
* post请求
|
|
8
|
+
* @param url 请求地址
|
|
9
|
+
* @param json 请求内容
|
|
10
|
+
* @param headers 请求头n的请求头,如:{"Content-Type":"application/json"}
|
|
11
|
+
*/
|
|
12
|
+
public post(url: string, json: object, headers?: object): string | null;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* get请求
|
|
16
|
+
* @param url 请求地址
|
|
17
|
+
* @param headers 请求头
|
|
18
|
+
*/
|
|
19
|
+
public get(url: string, headers: object): string | null;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param url 请求地址
|
|
24
|
+
* @param files
|
|
25
|
+
* @param params
|
|
26
|
+
* @param httpCallback
|
|
27
|
+
*/
|
|
28
|
+
public postFile(url: string, files: Files[], params: object, httpCallback: {
|
|
29
|
+
success: (response: any) => void,
|
|
30
|
+
fail: (response: any) => void
|
|
31
|
+
}): void;
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 下载文件
|
|
36
|
+
* @param url 下载链接
|
|
37
|
+
* @param destPath 保存路径(含文件名称)
|
|
38
|
+
* @param headers 请求头
|
|
39
|
+
*/
|
|
40
|
+
public download(url: string, destPath: string, headers?: object): string | null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { };
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
var Images: Images;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
interface Mat {
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface Point {
|
|
9
|
-
x: number;
|
|
10
|
-
y: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface TextAndRegion {
|
|
14
|
-
text: string;
|
|
15
|
-
rect: Rect;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface Images {
|
|
19
|
-
public getMat(imageFile: string): Mat;
|
|
20
|
-
|
|
21
|
-
public findOne(source: Mat, template: Mat, threshold: number): Point;
|
|
22
|
-
|
|
23
|
-
public find(source: Mat, template: Mat, threshold: number): Point[];
|
|
24
|
-
|
|
25
|
-
public capture(): string;
|
|
26
|
-
|
|
27
|
-
public getColor(imageFile: string, pixelX: number, pixelY: number): string;
|
|
28
|
-
|
|
29
|
-
public findColor(imageFile: string, color: string): Point[];
|
|
30
|
-
|
|
31
|
-
public findColor(imageFile: string, startColor: string, endColor: string): Point[];
|
|
32
|
-
|
|
33
|
-
public crop(imageFile: string, left: number, top: number, width: number, height: number): string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* @param imageFile 图片文件路径
|
|
38
|
-
* @param multiple 缩放倍数
|
|
39
|
-
* @throws Error 当参数非法时或者图片文件不存在时抛出异常
|
|
40
|
-
*/
|
|
41
|
-
public scale(imageFile: string, multiple: number): string;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* 返回图片的文本和区域
|
|
45
|
-
* @param imageFile 图片文件路径
|
|
46
|
-
* @throws Error 当图像识别失败或参数非法时
|
|
47
|
-
*/
|
|
48
|
-
public getTextAndRegion(imageFile: string): TextAndRegion[];
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 查找文本位置
|
|
52
|
-
* @param imageFile 图片文件路径
|
|
53
|
-
* @param keyword 查找的文本
|
|
54
|
-
* @throws Error 当图像识别失败或参数非法时
|
|
55
|
-
*/
|
|
56
|
-
public findTextPosition(imageFile: string, keyword: string): Rect[];
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* 在指定区域内查找文本。
|
|
60
|
-
* @param imageFile 图片文件路径
|
|
61
|
-
* @param left 区域左边界
|
|
62
|
-
* @param top 区域上边界
|
|
63
|
-
* @param width 区域宽度
|
|
64
|
-
* @param height 区域高度
|
|
65
|
-
* @returns 识别出的文本数组
|
|
66
|
-
* @throws Error 当图像识别失败或参数非法时
|
|
67
|
-
*/
|
|
68
|
-
public findTextInRegion(imageFile: string, left: number, top: number, width: number, height: number): string[];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export { };
|
|
1
|
+
declare global {
|
|
2
|
+
var Images: Images;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
interface Mat {
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface Point {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface TextAndRegion {
|
|
14
|
+
text: string;
|
|
15
|
+
rect: Rect;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface Images {
|
|
19
|
+
public getMat(imageFile: string): Mat;
|
|
20
|
+
|
|
21
|
+
public findOne(source: Mat, template: Mat, threshold: number): Point;
|
|
22
|
+
|
|
23
|
+
public find(source: Mat, template: Mat, threshold: number): Point[];
|
|
24
|
+
|
|
25
|
+
public capture(): string;
|
|
26
|
+
|
|
27
|
+
public getColor(imageFile: string, pixelX: number, pixelY: number): string;
|
|
28
|
+
|
|
29
|
+
public findColor(imageFile: string, color: string): Point[];
|
|
30
|
+
|
|
31
|
+
public findColor(imageFile: string, startColor: string, endColor: string): Point[];
|
|
32
|
+
|
|
33
|
+
public crop(imageFile: string, left: number, top: number, width: number, height: number): string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param imageFile 图片文件路径
|
|
38
|
+
* @param multiple 缩放倍数
|
|
39
|
+
* @throws Error 当参数非法时或者图片文件不存在时抛出异常
|
|
40
|
+
*/
|
|
41
|
+
public scale(imageFile: string, multiple: number): string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 返回图片的文本和区域
|
|
45
|
+
* @param imageFile 图片文件路径
|
|
46
|
+
* @throws Error 当图像识别失败或参数非法时
|
|
47
|
+
*/
|
|
48
|
+
public getTextAndRegion(imageFile: string): TextAndRegion[];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 查找文本位置
|
|
52
|
+
* @param imageFile 图片文件路径
|
|
53
|
+
* @param keyword 查找的文本
|
|
54
|
+
* @throws Error 当图像识别失败或参数非法时
|
|
55
|
+
*/
|
|
56
|
+
public findTextPosition(imageFile: string, keyword: string): Rect[];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 在指定区域内查找文本。
|
|
60
|
+
* @param imageFile 图片文件路径
|
|
61
|
+
* @param left 区域左边界
|
|
62
|
+
* @param top 区域上边界
|
|
63
|
+
* @param width 区域宽度
|
|
64
|
+
* @param height 区域高度
|
|
65
|
+
* @returns 识别出的文本数组
|
|
66
|
+
* @throws Error 当图像识别失败或参数非法时
|
|
67
|
+
*/
|
|
68
|
+
public findTextInRegion(imageFile: string, left: number, top: number, width: number, height: number): string[];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
var java: any;
|
|
3
|
-
var Packages: any;
|
|
4
|
-
function JavaImporter(...packages: any[]): any;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export { };
|
|
1
|
+
declare global {
|
|
2
|
+
var java: any;
|
|
3
|
+
var Packages: any;
|
|
4
|
+
function JavaImporter(...packages: any[]): any;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export { };
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
global {
|
|
2
|
-
var KeyBoards: KeyBoards;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
interface KeyBoards {
|
|
6
|
-
/**
|
|
7
|
-
* DeekeScript输入法是否启用(未设置为默认,也返回true,但是此时不能输入和删除)
|
|
8
|
-
*/
|
|
9
|
-
public isEnabled(): boolean;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 判断DeekeScript输入法是否设置为默认,是的话,则可以使用输入和删除方法
|
|
13
|
-
*/
|
|
14
|
-
public canInput():boolean;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* 往文本框追加字符串
|
|
18
|
-
*/
|
|
19
|
-
public input(str: string): boolean;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* 删除文本框最后一个字符
|
|
23
|
-
*/
|
|
24
|
-
public delete():boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { };
|
|
1
|
+
global {
|
|
2
|
+
var KeyBoards: KeyBoards;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
interface KeyBoards {
|
|
6
|
+
/**
|
|
7
|
+
* DeekeScript输入法是否启用(未设置为默认,也返回true,但是此时不能输入和删除)
|
|
8
|
+
*/
|
|
9
|
+
public isEnabled(): boolean;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 判断DeekeScript输入法是否设置为默认,是的话,则可以使用输入和删除方法
|
|
13
|
+
*/
|
|
14
|
+
public canInput():boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 往文本框追加字符串
|
|
18
|
+
*/
|
|
19
|
+
public input(str: string): boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 删除文本框最后一个字符
|
|
23
|
+
*/
|
|
24
|
+
public delete():boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
global {
|
|
2
|
-
var Log: log;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
interface log {
|
|
6
|
-
/**
|
|
7
|
-
* 全局设置日志输出文件
|
|
8
|
-
*/
|
|
9
|
-
public setFile(filename: string): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* 输出日志内容
|
|
12
|
-
*/
|
|
13
|
-
public log(...obj: object): void;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { };
|
|
1
|
+
global {
|
|
2
|
+
var Log: log;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
interface log {
|
|
6
|
+
/**
|
|
7
|
+
* 全局设置日志输出文件
|
|
8
|
+
*/
|
|
9
|
+
public setFile(filename: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* 输出日志内容
|
|
12
|
+
*/
|
|
13
|
+
public log(...obj: object): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { };
|
|
@@ -1,146 +1,146 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
var MediaStore: MediaStore;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* MediaStore 媒体库操作类
|
|
7
|
-
* 用于操作 Android 系统相册、下载、文档等媒体文件
|
|
8
|
-
*/
|
|
9
|
-
interface MediaStore {
|
|
10
|
-
// ==================== 图片操作 ====================
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 获取相册中的所有图片
|
|
14
|
-
* @return JavaScript 数组,包含图片信息对象 {id, name, path, uri, size, date}
|
|
15
|
-
*/
|
|
16
|
-
public getImages(): any[];
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 保存图片到相册
|
|
20
|
-
* @param sourcePath 源图片路径
|
|
21
|
-
* @param displayName 显示名称(可选)
|
|
22
|
-
* @param relativePath 相对路径(可选,如 "Pictures/MyApp")
|
|
23
|
-
* @return 保存后的 content:// Uri 字符串,失败返回 null
|
|
24
|
-
*/
|
|
25
|
-
public saveImage(sourcePath: string, displayName?: string, relativePath?: string): string | null;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 保存图片到相册(使用默认配置)
|
|
29
|
-
* @param sourcePath 源图片路径
|
|
30
|
-
* @return 保存后的 content:// Uri 字符串
|
|
31
|
-
*/
|
|
32
|
-
public saveImage(sourcePath: string): string | null;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* 删除图片
|
|
36
|
-
* @param uriString content:// Uri 字符串
|
|
37
|
-
* @return 删除成功返回 true
|
|
38
|
-
*/
|
|
39
|
-
public deleteImage(uriString: string): boolean;
|
|
40
|
-
|
|
41
|
-
// ==================== 视频操作 ====================
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* 获取相册中的所有视频
|
|
45
|
-
* @return JavaScript 数组,包含视频信息对象 {id, name, path, uri, size, duration, date}
|
|
46
|
-
*/
|
|
47
|
-
public getVideos(): any[];
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 保存视频到相册
|
|
51
|
-
* @param sourcePath 源视频路径
|
|
52
|
-
* @param displayName 显示名称(可选)
|
|
53
|
-
* @param relativePath 相对路径(可选)
|
|
54
|
-
* @return 保存后的 content:// Uri 字符串,失败返回 null
|
|
55
|
-
*/
|
|
56
|
-
public saveVideo(sourcePath: string, displayName?: string, relativePath?: string): string | null;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* 保存视频到相册(使用默认配置)
|
|
60
|
-
* @param sourcePath 源视频路径
|
|
61
|
-
* @return 保存后的 content:// Uri 字符串
|
|
62
|
-
*/
|
|
63
|
-
public saveVideo(sourcePath: string): string | null;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* 删除视频
|
|
67
|
-
* @param uriString content:// Uri 字符串
|
|
68
|
-
* @return 删除成功返回 true
|
|
69
|
-
*/
|
|
70
|
-
public deleteVideo(uriString: string): boolean;
|
|
71
|
-
|
|
72
|
-
// ==================== 音频操作 ====================
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* 获取所有音频文件
|
|
76
|
-
* @return JavaScript 数组,包含音频信息对象 {id, name, path, uri, size, duration, artist, album}
|
|
77
|
-
*/
|
|
78
|
-
public getAudios(): any[];
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* 保存音频文件
|
|
82
|
-
* @param sourcePath 源文件路径
|
|
83
|
-
* @param displayName 显示名称(可选)
|
|
84
|
-
* @return 保存后的 content:// Uri 字符串,失败返回 null
|
|
85
|
-
*/
|
|
86
|
-
public saveAudio(sourcePath: string, displayName?: string): string | null;
|
|
87
|
-
|
|
88
|
-
// ==================== 下载文件操作 ====================
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* 保存文件到下载目录
|
|
92
|
-
* @param sourcePath 源文件路径
|
|
93
|
-
* @param displayName 显示名称(可选)
|
|
94
|
-
* @return 保存后的 content:// Uri 字符串(Android 10+)或文件路径(Android 9-),失败返回 null
|
|
95
|
-
*/
|
|
96
|
-
public saveToDownloads(sourcePath: string, displayName?: string): string | null;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* 获取下载目录的所有文件
|
|
100
|
-
* API 29+ 使用 MediaStore,API 26-28 使用文件系统
|
|
101
|
-
* @return JavaScript 数组,包含文件信息对象 {id, name, uri, size, date} 或 {name, path, uri, size, date}
|
|
102
|
-
*/
|
|
103
|
-
public getDownloads(): any[];
|
|
104
|
-
|
|
105
|
-
// ==================== 文档操作 ====================
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* 保存文档文件到文档目录
|
|
109
|
-
* @param sourcePath 源文件路径
|
|
110
|
-
* @param displayName 显示名称(可选)
|
|
111
|
-
* @return 保存后的 content:// Uri 字符串(Android 10+)或文件路径(Android 9-),失败返回 null
|
|
112
|
-
*/
|
|
113
|
-
public saveToDocuments(sourcePath: string, displayName?: string): string | null;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* 保存文档文件到文档目录(使用默认名称)
|
|
117
|
-
* @param sourcePath 源文件路径
|
|
118
|
-
* @return 保存后的 content:// Uri 字符串或文件路径
|
|
119
|
-
*/
|
|
120
|
-
public saveToDocuments(sourcePath: string): string | null;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* 获取文档目录的所有文件
|
|
124
|
-
* @return JavaScript 数组,包含文件信息对象 {id, name, uri, size, date, mimeType} 或 {name, path, uri, size, date}
|
|
125
|
-
*/
|
|
126
|
-
public getDocuments(): any[];
|
|
127
|
-
|
|
128
|
-
// ==================== 通用操作 ====================
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* 从 URI 读取文件内容
|
|
132
|
-
* @param uriString content:// Uri 字符串
|
|
133
|
-
* @return 文件内容字节数组,失败返回 null
|
|
134
|
-
*/
|
|
135
|
-
public readFromUri(uriString: string): number[] | null;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* 查询媒体文件信息
|
|
139
|
-
* @param uriString content:// Uri 字符串
|
|
140
|
-
* @return JavaScript 对象,包含文件信息 {name, size, mimeType}
|
|
141
|
-
*/
|
|
142
|
-
public queryMediaInfo(uriString: string): any;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export { };
|
|
146
|
-
|
|
1
|
+
declare global {
|
|
2
|
+
var MediaStore: MediaStore;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MediaStore 媒体库操作类
|
|
7
|
+
* 用于操作 Android 系统相册、下载、文档等媒体文件
|
|
8
|
+
*/
|
|
9
|
+
interface MediaStore {
|
|
10
|
+
// ==================== 图片操作 ====================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 获取相册中的所有图片
|
|
14
|
+
* @return JavaScript 数组,包含图片信息对象 {id, name, path, uri, size, date}
|
|
15
|
+
*/
|
|
16
|
+
public getImages(): any[];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 保存图片到相册
|
|
20
|
+
* @param sourcePath 源图片路径
|
|
21
|
+
* @param displayName 显示名称(可选)
|
|
22
|
+
* @param relativePath 相对路径(可选,如 "Pictures/MyApp")
|
|
23
|
+
* @return 保存后的 content:// Uri 字符串,失败返回 null
|
|
24
|
+
*/
|
|
25
|
+
public saveImage(sourcePath: string, displayName?: string, relativePath?: string): string | null;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 保存图片到相册(使用默认配置)
|
|
29
|
+
* @param sourcePath 源图片路径
|
|
30
|
+
* @return 保存后的 content:// Uri 字符串
|
|
31
|
+
*/
|
|
32
|
+
public saveImage(sourcePath: string): string | null;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 删除图片
|
|
36
|
+
* @param uriString content:// Uri 字符串
|
|
37
|
+
* @return 删除成功返回 true
|
|
38
|
+
*/
|
|
39
|
+
public deleteImage(uriString: string): boolean;
|
|
40
|
+
|
|
41
|
+
// ==================== 视频操作 ====================
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 获取相册中的所有视频
|
|
45
|
+
* @return JavaScript 数组,包含视频信息对象 {id, name, path, uri, size, duration, date}
|
|
46
|
+
*/
|
|
47
|
+
public getVideos(): any[];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 保存视频到相册
|
|
51
|
+
* @param sourcePath 源视频路径
|
|
52
|
+
* @param displayName 显示名称(可选)
|
|
53
|
+
* @param relativePath 相对路径(可选)
|
|
54
|
+
* @return 保存后的 content:// Uri 字符串,失败返回 null
|
|
55
|
+
*/
|
|
56
|
+
public saveVideo(sourcePath: string, displayName?: string, relativePath?: string): string | null;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 保存视频到相册(使用默认配置)
|
|
60
|
+
* @param sourcePath 源视频路径
|
|
61
|
+
* @return 保存后的 content:// Uri 字符串
|
|
62
|
+
*/
|
|
63
|
+
public saveVideo(sourcePath: string): string | null;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 删除视频
|
|
67
|
+
* @param uriString content:// Uri 字符串
|
|
68
|
+
* @return 删除成功返回 true
|
|
69
|
+
*/
|
|
70
|
+
public deleteVideo(uriString: string): boolean;
|
|
71
|
+
|
|
72
|
+
// ==================== 音频操作 ====================
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 获取所有音频文件
|
|
76
|
+
* @return JavaScript 数组,包含音频信息对象 {id, name, path, uri, size, duration, artist, album}
|
|
77
|
+
*/
|
|
78
|
+
public getAudios(): any[];
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 保存音频文件
|
|
82
|
+
* @param sourcePath 源文件路径
|
|
83
|
+
* @param displayName 显示名称(可选)
|
|
84
|
+
* @return 保存后的 content:// Uri 字符串,失败返回 null
|
|
85
|
+
*/
|
|
86
|
+
public saveAudio(sourcePath: string, displayName?: string): string | null;
|
|
87
|
+
|
|
88
|
+
// ==================== 下载文件操作 ====================
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 保存文件到下载目录
|
|
92
|
+
* @param sourcePath 源文件路径
|
|
93
|
+
* @param displayName 显示名称(可选)
|
|
94
|
+
* @return 保存后的 content:// Uri 字符串(Android 10+)或文件路径(Android 9-),失败返回 null
|
|
95
|
+
*/
|
|
96
|
+
public saveToDownloads(sourcePath: string, displayName?: string): string | null;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 获取下载目录的所有文件
|
|
100
|
+
* API 29+ 使用 MediaStore,API 26-28 使用文件系统
|
|
101
|
+
* @return JavaScript 数组,包含文件信息对象 {id, name, uri, size, date} 或 {name, path, uri, size, date}
|
|
102
|
+
*/
|
|
103
|
+
public getDownloads(): any[];
|
|
104
|
+
|
|
105
|
+
// ==================== 文档操作 ====================
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 保存文档文件到文档目录
|
|
109
|
+
* @param sourcePath 源文件路径
|
|
110
|
+
* @param displayName 显示名称(可选)
|
|
111
|
+
* @return 保存后的 content:// Uri 字符串(Android 10+)或文件路径(Android 9-),失败返回 null
|
|
112
|
+
*/
|
|
113
|
+
public saveToDocuments(sourcePath: string, displayName?: string): string | null;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 保存文档文件到文档目录(使用默认名称)
|
|
117
|
+
* @param sourcePath 源文件路径
|
|
118
|
+
* @return 保存后的 content:// Uri 字符串或文件路径
|
|
119
|
+
*/
|
|
120
|
+
public saveToDocuments(sourcePath: string): string | null;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 获取文档目录的所有文件
|
|
124
|
+
* @return JavaScript 数组,包含文件信息对象 {id, name, uri, size, date, mimeType} 或 {name, path, uri, size, date}
|
|
125
|
+
*/
|
|
126
|
+
public getDocuments(): any[];
|
|
127
|
+
|
|
128
|
+
// ==================== 通用操作 ====================
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 从 URI 读取文件内容
|
|
132
|
+
* @param uriString content:// Uri 字符串
|
|
133
|
+
* @return 文件内容字节数组,失败返回 null
|
|
134
|
+
*/
|
|
135
|
+
public readFromUri(uriString: string): number[] | null;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 查询媒体文件信息
|
|
139
|
+
* @param uriString content:// Uri 字符串
|
|
140
|
+
* @return JavaScript 对象,包含文件信息 {name, size, mimeType}
|
|
141
|
+
*/
|
|
142
|
+
public queryMediaInfo(uriString: string): any;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export { };
|
|
146
|
+
|