deeke-script-app 1.6.8 → 1.6.9
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.
|
@@ -63,9 +63,42 @@ interface access {
|
|
|
63
63
|
public requestNotificationAccess(): void;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
* 是否开启读取通知权限
|
|
67
|
+
*/
|
|
68
68
|
public hasNotificationAccess(): boolean;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 检查是否有媒体库读取权限(图片、视频)
|
|
72
|
+
* @return true 如果有权限
|
|
73
|
+
*/
|
|
74
|
+
public hasMediaReadPermission(): boolean;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 申请媒体库权限(统一接口,自动处理各Android版本差异)
|
|
78
|
+
*
|
|
79
|
+
* 权限说明:
|
|
80
|
+
* - Android 13+: 请求 READ_MEDIA_IMAGES 和 READ_MEDIA_VIDEO
|
|
81
|
+
* - Android 10-12: 请求 READ_EXTERNAL_STORAGE
|
|
82
|
+
* - Android 9-: 请求 READ_EXTERNAL_STORAGE 和 WRITE_EXTERNAL_STORAGE
|
|
83
|
+
*
|
|
84
|
+
* 注意:这是异步操作,不会阻塞
|
|
85
|
+
*/
|
|
86
|
+
public requestMediaPermissions(): void;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 打开应用权限设置页面
|
|
90
|
+
*/
|
|
91
|
+
public openPermissionSettings(): void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 检查媒体权限是否被永久拒绝(用户选择了"不再询问")
|
|
95
|
+
*
|
|
96
|
+
* 如果返回true,说明用户之前拒绝过权限并选择了"不再询问",
|
|
97
|
+
* 系统不会再弹出权限对话框,需要引导用户去设置页面手动开启
|
|
98
|
+
*
|
|
99
|
+
* @return true 如果权限被永久拒绝
|
|
100
|
+
*/
|
|
101
|
+
public isMediaPermissionPermanentlyDenied(): boolean;
|
|
69
102
|
}
|
|
70
103
|
|
|
71
104
|
export { };
|
|
@@ -0,0 +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
|
+
|