deeke-script-app 1.7.4 → 1.7.5

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.
@@ -99,6 +99,43 @@ interface access {
99
99
  * @return true 如果权限被永久拒绝
100
100
  */
101
101
  public isMediaPermissionPermanentlyDenied(): boolean;
102
+
103
+ /**
104
+ * 检查是否有文件存储权限(适配Android 8及以上版本)
105
+ *
106
+ * 权限说明:
107
+ * - Android 11+: 检查 MANAGE_EXTERNAL_STORAGE 权限(需要用户手动在设置中开启)
108
+ * - Android 8-10: 检查 READ_EXTERNAL_STORAGE 和 WRITE_EXTERNAL_STORAGE 权限
109
+ *
110
+ * @return true 如果有权限
111
+ */
112
+ public hasStoragePermission(): boolean;
113
+
114
+ /**
115
+ * 申请文件存储权限(适配Android 8及以上版本)
116
+ *
117
+ * 权限说明:
118
+ * - Android 11+: 引导用户去设置页面手动开启 MANAGE_EXTERNAL_STORAGE 权限
119
+ * - Android 8-10: 请求 READ_EXTERNAL_STORAGE 和 WRITE_EXTERNAL_STORAGE 权限
120
+ *
121
+ * 注意:这是异步操作,不会阻塞
122
+ * 如果用户禁用了权限,需要调用 isStoragePermissionPermanentlyDenied() 检查是否被永久拒绝
123
+ */
124
+ public requestStoragePermission(): void;
125
+
126
+ /**
127
+ * 检查文件存储权限是否被永久拒绝(用户选择了"不再询问"或禁用了权限)
128
+ *
129
+ * 权限说明:
130
+ * - Android 11+: 检查 MANAGE_EXTERNAL_STORAGE 权限状态
131
+ * - Android 8-10: 检查 READ_EXTERNAL_STORAGE 和 WRITE_EXTERNAL_STORAGE 是否被永久拒绝
132
+ *
133
+ * 如果返回true,说明用户之前拒绝过权限并选择了"不再询问",
134
+ * 或者用户禁用了权限,系统不会再弹出权限对话框,需要引导用户去设置页面手动开启
135
+ *
136
+ * @return true 如果权限被永久拒绝或禁用
137
+ */
138
+ public isStoragePermissionPermanentlyDenied(): boolean;
102
139
  }
103
140
 
104
141
  export { };
@@ -44,7 +44,7 @@ interface Encrypt {
44
44
  * @param iv
45
45
  * @param input
46
46
  */
47
- public aesCbcEncrypt(key: string, iv: string, input: string): string;
47
+ public aesCbcEncode(key: string, iv: string, input: string): string;
48
48
 
49
49
  /**
50
50
  * aescbc解密
@@ -52,7 +52,7 @@ interface Encrypt {
52
52
  * @param iv
53
53
  * @param input
54
54
  */
55
- public aesCbcDecrypt(key: string, iv: string, input: string): string;
55
+ public aesCbcDecode(key: string, iv: string, input: string): string;
56
56
  }
57
57
 
58
58
  export { };
@@ -36,6 +36,12 @@ interface FloatDialogs {
36
36
  * 关闭FloatDialogs开启的所有弹窗
37
37
  */
38
38
  public closeAll(): void;
39
+
40
+ /**
41
+ * 设置悬浮窗显示/隐藏
42
+ * @param visible 是否显示
43
+ */
44
+ public setFloatWindowVisible(visible: boolean): void;
39
45
  }
40
46
 
41
47
  export { };
@@ -109,6 +109,12 @@ interface System {
109
109
  * @param mode 快速模式mode为fast,非快速模式为!fast
110
110
  */
111
111
  public setAccessibilityMode(mode: string): void;
112
+
113
+ /**
114
+ * 设置屏幕是否保持常亮
115
+ * @param keepOn 是否保持屏幕常亮
116
+ */
117
+ public setKeepScreenOn(keepOn: boolean): void;
112
118
  }
113
119
 
114
120
  export { };
@@ -41,6 +41,11 @@ declare global {
41
41
  */
42
42
  public cut(): boolean;
43
43
 
44
+ /**
45
+ * 粘贴内容到文本框
46
+ */
47
+ public paste(): boolean;
48
+
44
49
  /**
45
50
  * 让控件获取焦点
46
51
  */
@@ -110,11 +115,6 @@ declare global {
110
115
  */
111
116
  public parent(): UiObject;
112
117
 
113
- /**
114
- * 获取控件的层级
115
- */
116
- public depth(): number;
117
-
118
118
  /**
119
119
  * 获取控件的绘制顺序
120
120
  */
@@ -192,6 +192,11 @@ declare global {
192
192
  * 获取控件的包名
193
193
  */
194
194
  public getPackageName(): string;
195
+
196
+ /**
197
+ * 获取控件的提示文本
198
+ */
199
+ public getHintText(): string;
195
200
  }
196
201
  }
197
202
  export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deeke-script-app",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "description": "DeekeScript应用",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
package/script/index.js CHANGED
@@ -1 +0,0 @@
1
- //这个文件不用编写代码
@@ -1,89 +1,38 @@
1
-
2
- let newTask = {
3
- log(){
4
- Log.log(arguments);
5
- console.log(arguments);
1
+ let e = {
2
+ log() {
3
+ Log.log(arguments), console.log(arguments);
6
4
  },
7
5
  comment() {
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);
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);
34
14
  },
35
-
36
15
  backHome() {
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);
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; );
49
21
  },
50
-
51
22
  run() {
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
- }
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();
83
34
  }
84
- },
85
- }
35
+ }
36
+ };
86
37
 
87
- Log.setFile("douyin_zan.js.log");
88
- newTask.run();
89
- FloatDialogs.show('抖音任务完成');
38
+ Log.setFile("douyin_zan.js.log"), e.run(), FloatDialogs.show("抖音任务完成");
package/script/task/dy.js CHANGED
@@ -1,14 +1,7 @@
1
- let dyApp = require("./dyApp");
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
+ };
2
6
 
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('提示', '请编写业务代码');
7
+ console.log(r, e.getName()), FloatDialogs.show("提示", "请编写业务代码");
@@ -1,7 +1,7 @@
1
- const dyApp = {
2
- getName(){
1
+ let e = {
2
+ getName() {
3
3
  return "appName";
4
4
  }
5
- }
5
+ };
6
6
 
7
- module.exports = dyApp;
7
+ module.exports = e;
@@ -1 +1 @@
1
- FloatDialogs.show('提示', '请编写业务代码');
1
+ FloatDialogs.show("提示", "请编写业务代码");
@@ -1,19 +1,10 @@
1
- let myTask = {
2
- intoApp() {
3
- //打开并进入App
4
- },
5
-
6
- backApp() {
7
- //退出当前App
8
- },
9
-
10
- task(){
11
- //任务代码
12
- },
13
-
1
+ let a = {
2
+ intoApp() {},
3
+ backApp() {},
4
+ task() {},
14
5
  run() {
15
- FloatDialogs.show('提示', '请编写业务代码');
6
+ FloatDialogs.show("提示", "请编写业务代码");
16
7
  }
17
- }
8
+ };
18
9
 
19
- myTask.run();
10
+ a.run();