deeke-script-app 1.9.2 → 1.9.4

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.
@@ -162,13 +162,38 @@ interface access {
162
162
 
163
163
  /**
164
164
  * 检查位置权限是否被永久拒绝(用户选择了"不再询问")
165
- *
165
+ *
166
166
  * 如果返回true,说明用户之前拒绝过权限并选择了"不再询问",
167
167
  * 系统不会再弹出权限对话框,需要引导用户去设置页面手动开启
168
- *
168
+ *
169
169
  * @return true 如果权限被永久拒绝
170
170
  */
171
171
  public isLocationPermissionPermanentlyDenied(): boolean;
172
+
173
+ /**
174
+ * 检查是否有蓝牙连接权限(Android 12+ 需要 BLUETOOTH_CONNECT)
175
+ * Android 12 以下始终返回 true
176
+ */
177
+ public hasBluetoothConnectionPermission(): boolean;
178
+
179
+ /**
180
+ * 申请蓝牙连接权限(BLUETOOTH_CONNECT + BLUETOOTH_SCAN)
181
+ * Android 12 以下无需申请
182
+ * 注意:这是异步操作
183
+ */
184
+ public requestBluetoothConnectionPermission(): void;
185
+
186
+ /**
187
+ * 检查蓝牙权限是否被永久拒绝(用户选择了"不再询问")
188
+ *
189
+ * 如果返回true,需要引导用户去设置页面手动开启
190
+ */
191
+ public isBluetoothPermissionPermanentlyDenied(): boolean;
192
+
193
+ /**
194
+ * 打开蓝牙权限设置页面(跳转到应用详情设置页)
195
+ */
196
+ public openBluetoothPermissionSettings(): void;
172
197
  }
173
198
 
174
199
  export { };
@@ -0,0 +1,96 @@
1
+ declare global {
2
+ var Audio: Audio;
3
+ }
4
+
5
+ interface Audio {
6
+ /**
7
+ * 载入音频资源(不会自动播放)
8
+ * @param source 支持 http(s)、file://、content://、绝对路径、project:// 前缀
9
+ * @returns 是否载入成功
10
+ */
11
+ public load(source: string): boolean;
12
+
13
+ /**
14
+ * 加载并播放音频
15
+ * @param source 音频资源路径
16
+ * @returns 是否成功
17
+ */
18
+ public play(source: string): boolean;
19
+
20
+ /**
21
+ * 播放当前已加载的音频
22
+ * @returns 是否成功
23
+ */
24
+ public play(): boolean;
25
+
26
+ /**
27
+ * 暂停播放
28
+ */
29
+ public pause(): boolean;
30
+
31
+ /**
32
+ * 停止播放(播放位置重置到开头)
33
+ */
34
+ public stop(): boolean;
35
+
36
+ /**
37
+ * 释放播放器资源
38
+ */
39
+ public release(): void;
40
+
41
+ /**
42
+ * 跳转到指定位置
43
+ * @param msec 毫秒
44
+ */
45
+ public seekTo(msec: number): boolean;
46
+
47
+ /**
48
+ * 设置是否循环播放
49
+ * @param looping 是否循环
50
+ */
51
+ public setLooping(looping: boolean): boolean;
52
+
53
+ /**
54
+ * 设置左右声道音量
55
+ * @param leftVolume 左声道音量 0.0 ~ 1.0
56
+ * @param rightVolume 右声道音量 0.0 ~ 1.0
57
+ */
58
+ public setVolume(leftVolume: number, rightVolume: number): boolean;
59
+
60
+ /**
61
+ * 是否正在播放
62
+ */
63
+ public isPlaying(): boolean;
64
+
65
+ /**
66
+ * 是否已加载音频
67
+ */
68
+ public isLoaded(): boolean;
69
+
70
+ /**
71
+ * 获取音频总时长(毫秒),未加载返回 -1
72
+ */
73
+ public getDuration(): number;
74
+
75
+ /**
76
+ * 获取当前播放位置(毫秒),未加载返回 -1
77
+ */
78
+ public getCurrentPosition(): number;
79
+
80
+ /**
81
+ * 获取当前加载的音频源路径
82
+ */
83
+ public getCurrentSource(): string;
84
+
85
+ /**
86
+ * 是否具备后台播放能力(检测前台服务权限)
87
+ */
88
+ public canPlayInBackground(): boolean;
89
+
90
+ /**
91
+ * 是否已声明前台服务权限(Android 9+ 推荐用于后台保活播放)
92
+ */
93
+ public hasForegroundServicePermission(): boolean;
94
+ }
95
+
96
+ export { };
@@ -217,4 +217,4 @@ interface Console {
217
217
  };
218
218
  }
219
219
 
220
- export { };
220
+
@@ -3,7 +3,81 @@ declare global {
3
3
  }
4
4
 
5
5
  interface DeekeScript {
6
+ /**
7
+ * DeekeScript 版本号
8
+ */
6
9
  public version(): number;
10
+
11
+ /**
12
+ * 读取 JS 项目目录下的文件内容
13
+ * @param path 相对于项目根目录的文件路径
14
+ * @returns 文件内容字符串,失败返回 null
15
+ */
16
+ public readFile(path: string): string | null;
17
+
18
+ /**
19
+ * 获取当前 JS 项目的根目录绝对路径
20
+ * @returns 项目根目录路径
21
+ */
22
+ public getProjectRoot(): string;
23
+
24
+ /**
25
+ * 获取可设置的节点字段名列表
26
+ * @returns 字段名字符串数组,用于 getAllAccessibilityNodeInfo 的 fields 参数
27
+ */
28
+ public getNodeFields(): string[];
29
+
30
+ /**
31
+ * 一次性获取当前界面所有控件的节点信息
32
+ * @param bool true 为复杂模式(包含所有字段),false 为简单模式
33
+ * @param fields 需要返回的字段名数组,可通过 getNodeFields() 获取完整字段列表
34
+ * @returns { nodes: DeekeNodeInfo[] } 或 null(无障碍服务未启用时)
35
+ */
36
+ public getAllAccessibilityNodeInfo(bool: boolean, fields: string[]): { nodes: DeekeNodeInfo[] } | null;
37
+ }
38
+
39
+ /**
40
+ * 节点位置/大小信息
41
+ */
42
+ interface DeekeBounds {
43
+ left: number;
44
+ top: number;
45
+ width: number;
46
+ height: number;
47
+ }
48
+
49
+ /**
50
+ * 无障碍节点信息
51
+ */
52
+ interface DeekeNodeInfo {
53
+ key?: string;
54
+ viewIdResourceName?: string;
55
+ text?: string;
56
+ contentDescription?: string;
57
+ className?: string;
58
+ childCount?: number;
59
+ packageName?: string;
60
+ hintText?: string;
61
+ inputType?: number;
62
+ drawingOrder?: number;
63
+ depth?: number;
64
+ maxTextLength?: number;
65
+ isPassword?: boolean;
66
+ boundsInScreen?: DeekeBounds;
67
+ boundsInParent?: DeekeBounds;
68
+ isClickable?: boolean;
69
+ isCheckable?: boolean;
70
+ isChecked?: boolean;
71
+ isEditable?: boolean;
72
+ isEnabled?: boolean;
73
+ isScrollable?: boolean;
74
+ isSelected?: boolean;
75
+ isVisibleToUser?: boolean;
76
+ isFocusable?: boolean;
77
+ isFocused?: boolean;
78
+ isLongClickable?: boolean;
79
+ isDismissable?: boolean;
80
+ children?: DeekeNodeInfo[];
7
81
  }
8
82
 
9
- export { }
83
+ export { };
@@ -127,6 +127,16 @@ interface System {
127
127
  * @param keepOn 是否保持屏幕常亮
128
128
  */
129
129
  public setKeepScreenOn(keepOn: boolean): void;
130
+
131
+ /**
132
+ * 获取当前系统区域与语言信息(配置中的首个 Locale)
133
+ * @returns language 为语言码;country 为国家/地区码;tag 为 BCP 47 标签(如 zh-CN)
134
+ */
135
+ public getLocaleInfo(): {
136
+ language: string;
137
+ country: string;
138
+ tag: string;
139
+ };
130
140
  }
131
141
 
132
142
  export { };
package/deekeScript.json CHANGED
@@ -622,6 +622,12 @@
622
622
  "description": "确定清理嘛?",
623
623
  "type": "clear"
624
624
  },
625
+ {
626
+ "title": "自定义js",
627
+ "icon": "images/test/notice.png",
628
+ "type": "execJs",
629
+ "jsFile": "script/task/exec_js.js"
630
+ },
625
631
  {
626
632
  "title": "举报中心",
627
633
  "icon": "images/test/jubao.png",
@@ -201,7 +201,8 @@
201
201
  "uploadLog",
202
202
  "updateApp",
203
203
  "clear",
204
- "qiwei"
204
+ "qiwei",
205
+ "execJs"
205
206
  ]
206
207
  },
207
208
  "description": {
package/jsconfig.json CHANGED
@@ -1,12 +1,26 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "target": "ES6",
4
- "lib": ["es6"], // 不包含 "dom"
5
- "checkJs": true
4
+ "lib": [
5
+ "es2016",
6
+ ],
7
+ "checkJs": true,
8
+ "allowJs": true,
9
+ "module": "commonjs",
10
+ "moduleResolution": "node10",
11
+ "types": [
12
+ "node"
13
+ ],
14
+ "ignoreDeprecations": "6.0",
15
+ "baseUrl": ".",
16
+ "paths": {
17
+ "app/*": [
18
+ "app/*"
19
+ ]
20
+ },
6
21
  },
7
22
  "include": [
8
- "src/**/*",
9
- "test/**/*",
23
+ "**/*",
10
24
  "@deekeScript/**/*"
11
25
  ]
12
26
  }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deeke-script-app",
3
- "version": "1.9.2",
3
+ "version": "1.9.4",
4
4
  "description": "DeekeScript应用",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
package/script/index.js CHANGED
@@ -0,0 +1 @@
1
+ //这个文件不用编写代码
@@ -1,38 +1,89 @@
1
- let e = {
2
- log() {
3
- Log.log(arguments), console.log(arguments);
1
+
2
+ let newTask = {
3
+ log(){
4
+ Log.log(arguments);
5
+ console.log(arguments);
4
6
  },
5
7
  comment() {
6
- var e = UiSelector().id("com.ss.android.ugc.aweme:id/comment_container").isVisibleToUser(!0).findOne(), e = (console.log(e),
7
- Gesture.click(e.bounds().left + Math.random() * e.bounds().width(), e.bounds().centerY()),
8
- console.log("打开评论窗口"), System.sleep(1200), UiSelector().className("android.widget.EditText").editable(!0).findOne()), e = (console.log(e),
9
- Gesture.click(e.bounds().left + Math.random() * e.bounds().width(), e.bounds().centerY()),
10
- console.log("开始输入评论"), System.sleep(500), UiSelector().className("android.widget.EditText").editable(!0).findOne()), e = (console.log(e),
11
- Log.log(e), e.setText("太棒了"), System.sleep(500), UiSelector().id("com.ss.android.ugc.aweme:id/dqq").text("发送").findOne());
12
- console.log(e), Gesture.click(e.bounds().centerX(), e.bounds().centerY()),
13
- System.sleep(500), Gesture.back(), System.sleep(500);
8
+ //注释
9
+ let tag = UiSelector().id('com.ss.android.ugc.aweme:id/comment_container').isVisibleToUser(true).findOne();
10
+ console.log(tag);
11
+ Gesture.click(tag.bounds().left + Math.random() * tag.bounds().width(), tag.bounds().centerY());
12
+ console.log('打开评论窗口');
13
+ System.sleep(1200);
14
+
15
+ let inputTag = UiSelector().className('android.widget.EditText').editable(true).findOne();
16
+ console.log(inputTag);
17
+ Gesture.click(inputTag.bounds().left + Math.random() * inputTag.bounds().width(), inputTag.bounds().centerY());
18
+ console.log('开始输入评论');
19
+ System.sleep(500);
20
+
21
+ let iptTag = UiSelector().className('android.widget.EditText').editable(true).findOne();
22
+ console.log(iptTag);
23
+ Log.log(iptTag);
24
+ iptTag.setText('太棒了');
25
+ System.sleep(500);
26
+
27
+ let sendTag = UiSelector().id('com.ss.android.ugc.aweme:id/dqq').text('发送').findOne();
28
+ console.log(sendTag);
29
+
30
+ Gesture.click(sendTag.bounds().centerX(), sendTag.bounds().centerY());
31
+ System.sleep(500);
32
+ Gesture.back();
33
+ System.sleep(500);
14
34
  },
35
+
15
36
  backHome() {
16
- var e;
17
- console.log("开始返回主页");
18
- let o = 5;
19
- for (;(e = UiSelector().id("com.ss.android.ugc.aweme:id/x_t").isVisibleToUser(!0).findOne()) && console.log("在首页"),
20
- Gesture.back(), console.log("返回"), System.sleep(1e3), !e && 0 <= --o; );
37
+ console.log('开始返回主页');
38
+ let homeTag;
39
+ let backMaxCount = 5;
40
+ do {
41
+ homeTag = UiSelector().id('com.ss.android.ugc.aweme:id/x_t').isVisibleToUser(true).findOne();
42
+ if (homeTag) {
43
+ console.log('在首页');
44
+ }
45
+ Gesture.back();
46
+ console.log('返回');
47
+ System.sleep(1000);
48
+ } while (!homeTag && --backMaxCount >= 0);
21
49
  },
50
+
22
51
  run() {
23
- console.log("开始进入应用"), App.launch("com.ss.android.ugc.aweme"), System.sleep(2e3);
24
- let e = Storage.getInteger("task_douyin_zan_count"), o = Storage.getInteger("task_douyin_zan_comment");
25
- for (console.log("配置:" + e + " 赞," + o + " 评论"); 0 < e || 0 < o; ) try {
26
- var s;
27
- console.log("zanCount: " + e + " commentCount: " + o), 0 <= --e && (s = UiSelector().id("com.ss.android.ugc.aweme:id/fd9").isVisibleToUser(!0).findOne(),
28
- console.log("点赞tag", s), Gesture.click(s.bounds().left + Math.random() * s.bounds().width(), s.bounds().centerY()),
29
- System.sleep(1e3), console.log("点赞完成")), 0 <= --o && (this.comment(),
30
- System.sleep(1e3)), UiSelector().id("com.ss.android.ugc.aweme:id/viewpager").desc("视频").scrollable(!0).findOne().scrollForward(),
31
- System.sleep(3e3);
32
- } catch (e) {
33
- console.log(e), this.backHome();
52
+ console.log('开始进入应用');
53
+ App.launch('com.ss.android.ugc.aweme');
54
+ System.sleep(2000);
55
+ let zanCount = Storage.getInteger('task_douyin_zan_count');
56
+ let commentCount = Storage.getInteger('task_douyin_zan_comment');
57
+
58
+ console.log('配置:' + zanCount + ' 赞,' + commentCount + ' 评论');
59
+ while (zanCount > 0 || commentCount > 0) {
60
+ try {
61
+ console.log('zanCount: ' + zanCount + ' commentCount: ' + commentCount);
62
+ if (--zanCount >= 0) {
63
+ let tag = UiSelector().id('com.ss.android.ugc.aweme:id/fd9').isVisibleToUser(true).findOne();
64
+ console.log('点赞tag', tag);
65
+ Gesture.click(tag.bounds().left + Math.random() * tag.bounds().width(), tag.bounds().centerY());
66
+ System.sleep(1000);
67
+ console.log('点赞完成');
68
+ }
69
+
70
+ if (--commentCount >= 0) {
71
+ this.comment();
72
+ System.sleep(1000);
73
+ }
74
+
75
+
76
+ let tag = UiSelector().id('com.ss.android.ugc.aweme:id/viewpager').desc('视频').scrollable(true).findOne();
77
+ tag.scrollForward();
78
+ System.sleep(3000);
79
+ } catch (e) {
80
+ console.log(e);
81
+ this.backHome();
82
+ }
34
83
  }
35
- }
36
- };
84
+ },
85
+ }
37
86
 
38
- Log.setFile("douyin_zan.js.log"), e.run(), FloatDialogs.show("抖音任务完成");
87
+ Log.setFile("douyin_zan.js.log");
88
+ newTask.run();
89
+ FloatDialogs.show('抖音任务完成');
package/script/task/dy.js CHANGED
@@ -1,7 +1,14 @@
1
- let e = require("./dyApp"), o = UiSelector().id("name").findOne(), r = {
2
- toker_view_video_keywords: Storage.get("toker_view_video_keywords"),
3
- toker_view_video_second: Storage.getInteger("toker_view_video_second"),
4
- toker_run_sex: Storage.getArray("toker_run_sex")
5
- };
1
+ let dyApp = require("./dyApp");
6
2
 
7
- console.log(r, e.getName()), FloatDialogs.show("提示", "请编写业务代码");
3
+ let tag = UiSelector().id('name').findOne();
4
+
5
+ // console.log(tag.click());
6
+ let config = {
7
+ toker_view_video_keywords: Storage.get('toker_view_video_keywords'),
8
+ toker_view_video_second: Storage.getInteger('toker_view_video_second'),
9
+ toker_run_sex: Storage.getArray('toker_run_sex'),
10
+ }
11
+
12
+ console.log(config, dyApp.getName());//获取json文件中的配置参数
13
+
14
+ FloatDialogs.show('提示', '请编写业务代码');
@@ -1,7 +1,7 @@
1
- let e = {
2
- getName() {
1
+ const dyApp = {
2
+ getName(){
3
3
  return "appName";
4
4
  }
5
- };
5
+ }
6
6
 
7
- module.exports = e;
7
+ module.exports = dyApp;
@@ -1 +1 @@
1
- FloatDialogs.show("提示", "请编写业务代码");
1
+ FloatDialogs.show('提示', '请编写业务代码');
@@ -0,0 +1,4 @@
1
+
2
+ console.log("开始执行");
3
+
4
+ Dialogs.show('执行了自定义的js代码');
@@ -1,10 +1,19 @@
1
- let a = {
2
- intoApp() {},
3
- backApp() {},
4
- task() {},
1
+ let myTask = {
2
+ intoApp() {
3
+ //打开并进入App
4
+ },
5
+
6
+ backApp() {
7
+ //退出当前App
8
+ },
9
+
10
+ task(){
11
+ //任务代码
12
+ },
13
+
5
14
  run() {
6
- FloatDialogs.show("提示", "请编写业务代码");
15
+ FloatDialogs.show('提示', '请编写业务代码');
7
16
  }
8
- };
17
+ }
9
18
 
10
- a.run();
19
+ myTask.run();
@@ -0,0 +1,4 @@
1
+
2
+ console.log("开始执行");
3
+
4
+ Dialogs.show('执行了自定义的js代码');