Skip to content

Commit

Permalink
2.2.1 - 修复能量雨工具实例移除及连续运行/a11yx无阻塞方法/内存工具任务残余
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperMonster003 committed Oct 27, 2021
1 parent 2e9aec1 commit 18ed4bd
Show file tree
Hide file tree
Showing 20 changed files with 347 additions and 289 deletions.
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/SuperMonster003/Ant-Forest/find/master"><img alt="GitHub Code Lines" src="https://img.shields.io/tokei/lines/github/SuperMonster003/Ant-Forest?color=37474F"/></a>
<a href="https://github.com/SuperMonster003/Ant-Forest/blob/master/LICENSE"><img alt="GitHub License" src="https://img.shields.io/github/license/SuperMonster003/Ant-Forest?color=534BAE"/></a>
<a href="https://www.jetbrains.com/?from=Ant-Forest"><img alt="JetBrains supporter" src="https://img.shields.io/badge/supporter-JetBrains-ee4677"/></a>
<a href="https://github.com/SuperMonster003/Ant-Forest/blob/master/assets/docs/TODO.md"><img alt="Todo list" src="https://img.shields.io/badge/todo-55-C63F17"/></a>
<a href="https://github.com/SuperMonster003/Ant-Forest/blob/master/assets/docs/TODO.md"><img alt="Todo list" src="https://img.shields.io/badge/todo-53-C63F17"/></a>
</p>
</div>

Expand All @@ -33,15 +33,18 @@

| Status | Task | Date | Cost | Progress |
| :---: | --- | :---: | :---: | :---: |
| ✒️ | 推迟任务加入下次关屏选项 <!-- run-af-on-screen-off.js --> | 2021-10-26 11:18:43 | 5 | 0.30 <!-- est --> |
| ✔️ | 能量雨加入近似区域点击检测 | 2021-10-27 14:48:18 | 3 | 1 |
| ✔️ | v2.2.0 发布后检查 documents 相关的链接 | 2021-10-26 23:07:16 | 1 | 1 |
| ✒️ | 推迟任务加入下次关屏选项 <!-- run-af-on-screen-off.js --> | 2021-10-26 11:18:43 | 5 | 0.95 <!-- est --> |
| ✒️ | 启动器模块化 | 2021-10-26 08:25:42 | 10 | 0.01 <!-- 1 - 6915 / 6998 --> |
| ✒️ | 配置工具模块化 | 2021-10-26 08:24:34 | 10 | 0.00 <!-- 1 - 8141 / 8138 --> |
| ✒️ | 扩展模块及插件重构 | 2021-10-26 14:37:07 | ! 8 | 0.33 <!-- 9 / 27 --> |
| ✒️ | 将 tool functions 转换为 OOP | 2021-10-25 22:24:13 | 10 | 0.11 <!-- 1 - 227 / 256 --> |
| ✒️ | 保护地巡护工具 | 2021-10-26 10:34:25 | 9 | 0.20 <!-- est --> |
| ✒️ | 提取 JSDoc@typedef 到 TS 声明文件 | 2021-10-25 22:25:18 | 10 | 0.94 <!-- 1 - 5 / 86 --> |
| ✒️ | 自动关闭屏幕配置 (#476) <!-- REM#4 --> | 2021-10-26 11:15:11 | ! 6 | 0.00 |

> 全部待办事项可参阅 [TODO.md](https://github.com/SuperMonster003/Ant-Forest/blob/master/assets/docs/TODO.md) (共计 55 项)
> 全部待办事项可参阅 [TODO.md](https://github.com/SuperMonster003/Ant-Forest/blob/master/assets/docs/TODO.md) (共计 53 项)
******

Expand Down Expand Up @@ -133,7 +136,7 @@
· 本地或服务器还原项目
· 项目更新提示/版本忽略
* 信息加密存储
· 自动生成密文字典文件
· 自动生成密 _[`#528`](https://github.com/SuperMonster003/Ant-Forest/issues/528)_文字典文件
· 使用密文存储账户信息/解锁密码等敏感信息
* 账户功能
· 防止其他账户意外收取 (需录入主账户信息)
Expand All @@ -154,6 +157,16 @@

[comment]: <> (Version history only shows last 3 versions)

# v2.2.1

###### 2021/10/27

* `修复` 能量雨工具运行时旧窗口实例没有按预期移除的问题
* `修复` 能量雨工具增加近似区域点击检测避免错误的结束条件检测 _[`issue #527`](https://github.com/SuperMonster003/Ant-Forest/issues/527#issuecomment-952476244)_ _[`#530`](https://github.com/SuperMonster003/Ant-Forest/issues/530)_
* `修复` imagesx.concat()潜在的内存泄漏问题 _[`issue #527`](https://github.com/SuperMonster003/Ant-Forest/issues/527#issuecomment-952084434)_
* `修复` a11yx扩展模块无阻塞方法内部arguments的语法错误 _[`issue #527`](https://github.com/SuperMonster003/Ant-Forest/issues/527)_ _[`#530`](https://github.com/SuperMonster003/Ant-Forest/issues/530)_
* `修复` Pro版本Auto.js内存管理工具重启进程后的任务残余 (试修) _[`issue #528`](https://github.com/SuperMonster003/Ant-Forest/issues/528)_

# v2.2.0

###### 2021/10/26 - 代码重构 API变更 项目结构变更 谨慎升级
Expand Down Expand Up @@ -203,15 +216,6 @@
* `优化` Pro版本增加对话框按钮自定义颜色设置的支持
* `优化` Pro版本移除获取控件信息对currentPackage()的依赖

# v2.1.9

###### 2021/08/20

* `修复` 配置工具无法设置排行榜滑动距离等相关配置项的问题
* `修复` 获取能量球数据缓存时逻辑错误导致效率提升无效的问题
* `修复` OCR方案获取倒计时耗时过久未能按预期及时停止的问题
* `优化` 霍夫变换覆盖检测方法优化以提高成熟能量球识别率 _[`issue #508`](https://github.com/SuperMonster003/Ant-Forest/issues/508#issuecomment-900102913)_

##### 更多版本历史可参阅

* [CHANGELOG-2.md](https://github.com/SuperMonster003/Ant-Forest/blob/master/assets/docs/CHANGELOG-2.md) ( 2.x 版本 )
Expand Down
139 changes: 69 additions & 70 deletions ant-forest-launcher.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Alipay ant forest intelligent collection script launcher
* @since Oct 26, 2021
* @version 2.2.0
* @since Oct 27, 2021
* @version 2.2.1
* @author SuperMonster003
* @see https://github.com/SuperMonster003/Ant-Forest
*/
Expand Down Expand Up @@ -154,50 +154,54 @@ let $$init = {
},
};

$$sel.add('af', '蚂蚁森林')
.add('alipay_home', [/首页|Homepage/, {bi$: [0, cY(0.7), W, H]}])
.add('af_title', [/蚂蚁森林|Ant Forest/, {bi$: [0, 0, cX(0.4), cY(0.2)]}])
.add('af_home', /合种|背包|通知|攻略|任务|.*大树养成.*/)
.add('energy_amt', /^\s*\d+(\.\d+)?(k?g|t)\s*$/)
.add('rl_title', $$app.rl_title)
.add('rl_ent', /查看更多好友|View more friends/)
.add('rl_end_idt', /.*没有更多.*/)
.add('list', className('ListView'))
.add('fri_tt', [/.+的蚂蚁森林/, {bi$: [0, 0, cX(0.95), cY(0.2)]}])
.add('cover_used', /.*使用了.*保护罩.*/)
.add('wait_awhile', /.*稍等片刻.*/)
.add('reload_frst_page', '重新加载')
.add('close_btn', /关闭|Close/)
.add('login_btn', /登录|Log in|.*loginButton/)
.add('login_new_acc', /换个新账号登录|[Aa]dd [Aa]ccount/)
.add('login_other_acc', /换个账号登录|.*switchAccount/)
.add('login_other_mthd_init_pg', /其他登录方式|Other accounts/)
.add('login_other_mthd', /换个方式登录|.*[Ss]w.+[Ll]og.+thod/)
.add('login_by_code', /密码登录|Log ?in with password/)
.add('login_next_step', /下一步|Next|.*nextButton/)
.add('input_lbl_acc', /账号|Account/)
.add('input_lbl_code', /密码|Password/)
$$sel.add('af', ['蚂蚁森林', {isAlipay: true}])
.add('alipay_home', [/首页|Homepage/, {bi$: [0, cY(0.7), W, H], isAlipay: true}])
.add('af_title', [/蚂蚁森林|Ant Forest/, {bi$: [0, 0, cX(0.4), cY(0.2)], isAlipay: true}])
.add('af_home', [/合种|背包|通知|攻略|任务|.*大树养成.*/, {isAlipay: true}])
.add('energy_amt', [/^\s*\d+(\.\d+)?(k?g|t)\s*$/, {isAlipay: true}])
.add('rl_title', [$$app.rl_title, {isAlipay: true}])
.add('rl_ent', [/查看更多好友|View more friends/, {isAlipay: true}])
.add('rl_end_idt', [/.*没有更多.*/, {isAlipay: true}])
.add('list', [className('ListView'), {isAlipay: true}])
.add('fri_tt', [/.+的蚂蚁森林/, {bi$: [0, 0, cX(0.95), cY(0.2)], isAlipay: true}])
.add('cover_used', [/.*使用了.*保护罩.*/, {isAlipay: true}])
.add('wait_awhile', [/.*稍等片刻.*/, {isAlipay: true}])
.add('reload_frst_page', ['重新加载', {isAlipay: true}])
.add('close_btn', [/关闭|Close/, {isAlipay: true}])
.add('login_btn', [/登录|Log in|.*loginButton/, {isAlipay: true}])
.add('login_new_acc', [/换个新账号登录|[Aa]dd [Aa]ccount/, {isAlipay: true}])
.add('login_other_acc', [/换个账号登录|.*switchAccount/, {isAlipay: true}])
.add('login_other_mthd_init_pg', [/其他登录方式|Other accounts/, {isAlipay: true}])
.add('login_other_mthd', [/换个方式登录|.*[Ss]w.+[Ll]og.+thod/, {isAlipay: true}])
.add('login_by_code', [/密码登录|Log ?in with password/, {isAlipay: true}])
.add('login_next_step', [/下一步|Next|.*nextButton/, {isAlipay: true}])
.add('input_username', {
className: 'EditText',
filter: w => /(会员|用户)名|手机|邮箱/.test($$sel.pickup(w, 'txt')),
isAlipay: true,
})
.add('input_password', () => {
if ($$sel.pickup(/.*(忘记密码|输入.*密码).*/)) {
let wc = $$sel.pickup({className: 'EditText'}, 'wc');
let wc = $$sel.pickup({className: 'EditText', isAlipay: true}, 'wc');
return wc.length ? wc[wc.length - 1] : null;
}
return null;
})
.add('switch_to_other_acc', idMatches(/.+_item_account/))
.add('switch_to_other_acc', {
idMatches: /.+_item_account/,
isAlipay: true,
})
.add('login_err_ensure', idMatches(/.*ensure/))
.add('login_err_msg', (type) => {
let _t = type || 'txt';
return $$sel.pickup(id('com.alipay.mobile.antui:id/message'), _t)
|| $$sel.pickup([$$sel.get('login_err_ensure'), 'p2c0>0>0'], _t);
return $$sel.pickup([id('com.alipay.mobile.antui:id/message'), {isAlipay: true}], _t)
|| $$sel.pickup([$$sel.get('login_err_ensure'), {isAlipay: true}, 'p2c0>0>0'], _t);
})
.add('acc_logged_out', new RegExp('.*('
.add('acc_logged_out', [new RegExp('.*('
+ /在其他设备登录|logged +in +on +another/.source + '|'
+ /.*账号于.*通过.*登录.*|account +logged +on +to/.source + ').*'));
+ /.*账号于.*通过.*登录.*|account +logged +on +to/.source + ').*'), {
isAlipay: true,
}]);
}

function setGlobalFlags() {
Expand Down Expand Up @@ -3015,7 +3019,7 @@ let $$init = {

// instant and private monitors
let _ist = instantMonSetter();
_ist.maxRun().volKeys().globEvt().logOut().newestVer();
_ist.maxRun().volKeys().globEvt().newestVer();

// monitors put on standby for $$app invoking
$$app.monitor = standbyMonSetter();
Expand Down Expand Up @@ -3124,7 +3128,7 @@ let $$init = {
this._thd = threadsx.start(() => setInterval(() => {
if (this.task) {
this.task.setMillis(this._next_task_time);
timersx.updateTimedTask(this.task);
timersx.updateTask(this.task);
}
}, 10e3));
return this;
Expand Down Expand Up @@ -3511,39 +3515,6 @@ let $$init = {
}
}
},
logOut() {
threadsx.start(function () {
consolex._('已开启账户登出监测线程');

delete $$flag.acc_logged_out;
while (1) {
if ($$sel.getAndCache('acc_logged_out')) {
break;
}
if ($$acc.isInLoginPg()) {
break;
}
sleep(500);
}
$$flag.acc_logged_out = true;

consolex.$('检测到账户登出状态', 1, 0, 0, -1);
if ($$sel.cache.load('acc_logged_out')) {
consolex.$('账户在其他地方登录');
} else {
consolex.$('需要登录账户');
}

$$acc.main.ensureAvail();

consolex.$('尝试自动登录主账户', 1, 0, 0, 1);
if (!$$acc.main.login({direct: true})) {
consolex.$('主账户登录未成功', 8, 4, 0, 2);
}
});

return this;
},
newestVer() {
projectx.getNewestReleaseCared({
min_version_name: 'v2.0.1',
Expand Down Expand Up @@ -3807,6 +3778,33 @@ let $$init = {
while (!a11yx.wait(() => !_sel(), 600, _itv));
}
}),
log_out: new Monitor('账户登出', function () {
delete $$flag.acc_logged_out;
while (1) {
if ($$sel.getAndCache('acc_logged_out')) {
break;
}
if ($$acc.isInLoginPg()) {
break;
}
sleep(500);
}
$$flag.acc_logged_out = true;

consolex.$('检测到账户登出状态', 1, 0, 0, -1);
if ($$sel.cache.load('acc_logged_out')) {
consolex.$('账户在其他地方登录');
} else {
consolex.$('需要登录账户');
}

$$acc.main.ensureAvail();

consolex.$('尝试自动登录主账户', 1, 0, 0, 1);
if (!$$acc.main.login({direct: true})) {
consolex.$('主账户登录未成功', 8, 4, 0, 2);
}
}),
};

// constructor(s) //
Expand Down Expand Up @@ -4330,11 +4328,13 @@ let $$af = {
return this;
},
home() {
$$app.monitor.log_out.start();
$$app.monitor.unregistered.start();
$$app.monitor.pattern_lock.start();

$$app.page.af.launch();

$$app.monitor.log_out.disable();
$$app.monitor.unregistered.disable();
$$app.monitor.pattern_lock.disable();

Expand All @@ -4361,7 +4361,7 @@ let $$af = {
let _tt = '';
let _sel = () => _tt = $$sel.get('af_title', 'txt');

const _chs = '简体中文';
let _chs = '简体中文';

if (a11yx.wait(_sel, 10e3, 100)) {
if (_tt.match(/蚂蚁森林/)) {
Expand Down Expand Up @@ -4391,7 +4391,6 @@ let $$af = {

// appx.startActivity($$app.intent.general);

let _chs = '简体中文';
return a11yx.pipeline(_chs + '语言切换', [[
'Me', 'k2',
], {
Expand Down Expand Up @@ -5428,7 +5427,7 @@ let $$af = {
let _gt2 = w => /\d{2}.\d{2}/.test($$sel.pickup(w, 'txt'));
while (!_w_cvr && _max--) {
for (let w of _getFeedLegends()) {
if (_selCover() || _gt2()) {
if (_selCover() || _gt2(w)) {
consolex._('能量罩信息已定位');
break;
}
Expand Down Expand Up @@ -6426,7 +6425,7 @@ let $$af = {
consolex._('开始更新自动定时任务');
task.setMillis(_next_ts);
return $$app.setStoAutoTask({
task: timersx.updateTimedTask(task),
task: timersx.updateTask(task),
next_ts: _next_ts,
next_type: _type.name,
}, () => {
Expand Down
2 changes: 1 addition & 1 deletion ant-forest-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -6514,7 +6514,7 @@ $$view.page.new('定时任务控制面板', 'timers_control_panel_page', (t) =>
} else {
return;
}
return timersx.updateTimedTask(current_task);
return timersx.updateTask(current_task);
}
}

Expand Down
10 changes: 10 additions & 0 deletions assets/docs/CHANGELOG-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

******

# v2.2.1

###### 2021/10/27

* `修复` 能量雨工具运行时旧窗口实例没有按预期移除的问题
* `修复` 能量雨工具增加近似区域点击检测避免错误的结束条件检测 _[`issue #527`](https://github.com/SuperMonster003/Ant-Forest/issues/527#issuecomment-952476244)_ _[`#530`](https://github.com/SuperMonster003/Ant-Forest/issues/530)_
* `修复` imagesx.concat()潜在的内存泄漏问题 _[`issue #527`](https://github.com/SuperMonster003/Ant-Forest/issues/527#issuecomment-952084434)_
* `修复` a11yx扩展模块无阻塞方法内部arguments的语法错误 _[`issue #527`](https://github.com/SuperMonster003/Ant-Forest/issues/527)_ _[`#530`](https://github.com/SuperMonster003/Ant-Forest/issues/530)_
* `修复` Pro版本Auto.js内存管理工具重启进程后的任务残余 (试修) _[`issue #528`](https://github.com/SuperMonster003/Ant-Forest/issues/528)_

# v2.2.0

###### 2021/10/26 - 代码重构 API变更 项目结构变更 谨慎升级
Expand Down

0 comments on commit 18ed4bd

Please sign in to comment.