Skip to content

Commit

Permalink
2.1.2 - 修复能量雨工具/主账户登录失败 部分模块独立及优化 截图权限申请方法优化
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperMonster003 committed May 19, 2021
1 parent 6dfeabb commit b1ed0b4
Show file tree
Hide file tree
Showing 19 changed files with 1,342 additions and 1,156 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@

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

# v2.1.2
###### 2021/05/19
* `修复` 能量雨收集工具高概率出现截图权限申请失败的问题 _[`issue #467`](https://github.com/SuperMonster003/Ant-Forest/issues/467)_
* `修复` 支付宝应用控件变更导致主账户登录失败的问题
* `优化` 独立无障碍服务模块(a11y)及本地存储扩展模块(storage)
* `优化` 截图权限申请扩展方法在多线程等极端条件下的适应性

# v2.1.1
###### 2021/05/17
* `新增` 能量雨收集工具 (简易) (/tools/energy-rain-harvesting.js)
Expand All @@ -135,13 +142,6 @@
* `优化` 清除好友森林页面统计能量数据时对于用户昵称的依赖 _[`issue #228`](https://github.com/SuperMonster003/Ant-Forest/issues/228)_ _[`#223`](https://github.com/SuperMonster003/Ant-Forest/issues/223)_ _[`#218`](https://github.com/SuperMonster003/Ant-Forest/issues/218)_
* `优化` 增加支付宝手势锁监听器并在触发后适时结束脚本 _[`issue #452`](https://github.com/SuperMonster003/Ant-Forest/issues/452)_

# v2.0.5
###### 2021/03/16
* `修复` 解锁功能配置参数无法获取默认值的问题 _[`issue #444`](https://github.com/SuperMonster003/Ant-Forest/issues/444)_
* `修复` 排行榜可点击样本位于屏幕底部区域时可能出现的点击偏移问题 _[`issue #443`](https://github.com/SuperMonster003/Ant-Forest/issues/443)_
* `优化` 运行提示对话框放弃任务时增加不再提示选项 _[`issue #445`](https://github.com/SuperMonster003/Ant-Forest/issues/445)_
* `优化` 清除配置工具参数文件中混入的非必要参数数据

##### 更多版本历史可参阅
* [CHANGELOG-2.md](https://github.com/SuperMonster003/Ant-Forest/blob/master/documents/CHANGELOG-2.md) ( 2.x 版本 )
* [CHANGELOG-1.md](https://github.com/SuperMonster003/Ant-Forest/blob/master/documents/CHANGELOG-1.md) ( 1.x 版本 )
Expand Down
53 changes: 27 additions & 26 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 May 17, 2021
* @version 2.1.1
* @since May 19, 2021
* @version 2.1.2
* @author SuperMonster003
* @see https://github.com/SuperMonster003/Ant-Forest
*/
Expand All @@ -23,8 +23,8 @@ let $$init = {
check() {
this.appx().load();
appx.checkModules([
'mod-default-config', 'mod-pwmap', 'mod-storage',
'mod-treasury-vault', 'mod-database', 'mod-monster-func',
'mod-default-config', 'mod-pwmap', 'mod-monster-func',
'mod-treasury-vault', 'mod-database', 'ext-storages',
'ext-engines', 'ext-images', 'ext-timers', 'ext-dialogs',
'ext-threads', 'ext-global', 'ext-device', 'ext-ui', 'ext-app',
], {is_load: true});
Expand Down Expand Up @@ -62,9 +62,9 @@ let $$init = {
function setGlobalFunctions() {
require('./modules/mod-monster-func').load([
'messageAction', 'debugInfo', 'timeRecorder', 'clickActionsPipeline',
'getSelector', 'equalObjects', 'waitForAndClickAction', 'stabilizer',
'clickAction', 'swipeAndShow', 'setIntervalBySetTimeout', 'keycode',
'waitForAction', 'baiduOcr', 'observeToastMessage', 'showSplitLine',
'waitForAction', 'observeToastMessage', 'showSplitLine',
'equalObjects', 'waitForAndClickAction', 'stabilizer',
]);
global.messageAct = function () {
return $$flag.msg_details
Expand All @@ -83,12 +83,12 @@ let $$init = {
};

global.$$sto = {
af: require('./modules/mod-storage').create('af'),
af_next: require('./modules/mod-storage').create('af_auto'),
af_ins: require('./modules/mod-storage').create('af_ins'),
af_cfg: require('./modules/mod-storage').create('af_cfg'),
af_blist: require('./modules/mod-storage').create('af_blist'),
af_flist: require('./modules/mod-storage').create('af_flist'),
af: storagesx.create('af'),
af_next: storagesx.create('af_auto'),
af_ins: storagesx.create('af_ins'),
af_cfg: storagesx.create('af_cfg'),
af_blist: storagesx.create('af_blist'),
af_flist: storagesx.create('af_flist'),
};

global.$$cfg = Object.assign({},
Expand Down Expand Up @@ -1880,7 +1880,7 @@ let $$init = {
.add('login_next_step', /下一步|Next|.*nextButton/)
.add('input_lbl_acc', /账号|Account/)
.add('input_lbl_code', /密码|Password/)
.add('acc_sw_pg_ident', /账号切换|Accounts/)
.add('switch_to_other_acc', idMatches(/.+_item_account/))
.add('login_err_ensure', idMatches(/.*ensure/))
.add('login_err_msg', (type) => {
let _t = type || 'txt';
Expand Down Expand Up @@ -1935,12 +1935,12 @@ let $$init = {
messageAction('当前非账户切换页面', 8, 0, 1, 1);
}

let _sltr = idMatches(/.*list_arrow/);
waitForAction(_sltr, 2e3); // just in case
sleep(300);
let _sltr = idMatches(/.+_item_current/);
waitForAction(_sltr, 2e3, 80); // just in case
sleep(240);

// current logged in user abbr (with a list arrow)
let _cur_abbr = $$sel.pickup([_sltr, 's<1c0>0'], 'txt');
let _cur_abbr = $$sel.pickup([_sltr, 's-1'], 'txt');
// abbr of param 'name_str'
let _name_abbr = this.getAbbrFromList(name_str);
// let _is_logged_in = $$acc.isMatchAbbr(name_str, _cur_abbr);
Expand All @@ -1955,12 +1955,13 @@ let $$init = {
};
},
isInList(name_str) {
return $$sel.pickup(/.+\*{3,}.+/, 'wc').some((w) => {
let _abbr_name = $$sel.pickup(w, 'txt');
if ($$acc.isMatchAbbr(name_str, _abbr_name)) {
return this.abbr_name_in_list = _abbr_name;
}
});
return $$sel.pickup([/.+\*{3,}.+/, {cn$: 'TextView'}], 'wc')
.some((w) => {
let _abbr_name = $$sel.pickup(w, 'txt');
if ($$acc.isMatchAbbr(name_str, _abbr_name)) {
return this.abbr_name_in_list = _abbr_name;
}
});
},
isInPage() {
return $$acc.isInSwAccPg();
Expand Down Expand Up @@ -2041,7 +2042,7 @@ let $$init = {
},
isInSwAccPg() {
return $$sel.get('login_new_acc')
|| $$sel.get('acc_sw_pg_ident');
|| $$sel.get('switch_to_other_acc');
},
isMatchAbbr(name_str, abbr) {
name_str = name_str.toString();
Expand Down Expand Up @@ -4669,7 +4670,7 @@ let $$af = {
return _img;
})();

let _raw_data = baiduOcr(_stitched, {
let _raw_data = imagesx.baiduOcr(_stitched, {
fetch_times: 3,
fetch_interval: 500,
no_toast_msg_flag: true,
Expand Down Expand Up @@ -5365,7 +5366,7 @@ let $$af = {
if (!waitForAction(() => _w = $$sel.pickup(/.*加载更多\s*/), 3e3)) {
return debugInfo('定位"加载更多"按钮超时', 3);
}
debugInfo('成功定位"' + $$sel.pickup(_w, 'txt') + '"按钮');
debugInfo('成功定位' + $$sel.pickup(_w, 'txt').surround('"') + '按钮');

while (_ctr++ < 50) {
waitForAndClickAction(_w, 3e3, 120, {click_strategy: 'w'});
Expand Down
51 changes: 19 additions & 32 deletions ant-forest-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ let $$init = {
check() {
this.appx().load();
appx.checkModules([
'mod-pwmap', 'mod-treasury-vault', 'mod-database',
'mod-monster-func', 'mod-storage', 'mod-default-config',
'mod-pwmap', 'mod-treasury-vault', 'mod-default-config',
'mod-monster-func', 'mod-database', 'ext-storages', 'ext-a11y',
'ext-app', 'ext-files', 'ext-dialogs', 'ext-timers', 'ext-colors',
'ext-device', 'ext-global', 'ext-threads', 'ext-ui', 'ext-images',
], {is_load: true});
Expand Down Expand Up @@ -117,12 +117,12 @@ let $$init = {
};

global.$$sto = {
af: require('./modules/mod-storage').create('af'),
af_cfg: require('./modules/mod-storage').create('af_cfg'),
af_blist: require('./modules/mod-storage').create('af_blist'),
af_flist: require('./modules/mod-storage').create('af_flist'),
af_bak: require('./modules/mod-storage').create('af_bak'),
unlock: require('./modules/mod-storage').create('unlock'),
af: storagesx.create('af'),
af_cfg: storagesx.create('af_cfg'),
af_blist: storagesx.create('af_blist'),
af_flist: storagesx.create('af_flist'),
af_bak: storagesx.create('af_bak'),
unlock: storagesx.create('unlock'),
def: require('./modules/mod-default-config'),
vault: require('./modules/mod-treasury-vault'),
};
Expand Down Expand Up @@ -5665,9 +5665,9 @@ $$view.page.new('本地日志', 'global_log_page', (t) => {
// tool function(s) //

function _buildContent(input) {
return '支持相对路径\n' +
'如"./log/"等同于"' + files.cwd() + '/log/"\n\n' +
'当前输入的目录状态:\n' + _checkInput(input) + '\n';
return '支持相对路径\n如' + './log/'.surround('"') +
'等同于' + (files.cwd() + '/log/').surround('"') + '\n\n' +
'当前输入的目录状态:' + _checkInput(input).surround('\n');

// tool function(s) //

Expand Down Expand Up @@ -7329,34 +7329,21 @@ $$view.page.new('运行与安全', 'script_security_page', (t) => {
dialogsx
.builds([
'关于自动开启无障碍服务', 'about_auto_enable_a11y_svc',
['复制授权指令', 'hint'],
['测试权限', 'hint'],
'C', 1,
['复制授权指令', 'hint'], ['测试权限', 'hint'], 'C', 1,
])
.on('neutral', () => {
let _pkg = context.packageName;
let _perm = 'android.permission.WRITE_SECURE_SETTINGS';
let _shell_sc = 'adb shell pm grant ' + _pkg + ' ' + _perm;
setClip(_shell_sc);
setClip('adb shell pm grant ' + _pkg + ' ' + _perm);
toast('授权指令已复制到剪切板');
})
.on('negative', () => {
let _a11y = require('./modules/ext-device').a11y;
let _ts = Date.now();
let _par = ['%test%' + _ts, true];
_a11y.enable.apply(_a11y, _par);
let _res = _a11y.disable.apply(_a11y, _par);
dialogsx
.builds([
'权限测试结果', '测试' + (_res ? '' : '未') + '通过\n\n' +
'此设备' + (_res ? '拥有' : '没有') + '以下权限:\n' +
'WRITE_SECURE_SETTINGS',
0, 0, 'C', 1,
])
.on('positive', (d) => {
d.dismiss();
})
.show();
let _res = $$a11y.test();
dialogsx.builds([
'权限测试结果', '测试' + (_res ? '' : '未') + '通过\n\n' +
'此设备' + (_res ? '拥有' : '没有') + '以下权限:\n' +
'WRITE_SECURE_SETTINGS', 0, 0, 'C', 1,
]).on('positive', d => d.dismiss()).show();
})
.on('positive', (d) => {
d.dismiss();
Expand Down
7 changes: 7 additions & 0 deletions documents/CHANGELOG-2.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
******
### 版本历史 - 2.x
******
# v2.1.2
###### 2021/05/19
* `修复` 能量雨收集工具高概率出现截图权限申请失败的问题 _[`issue #467`](https://github.com/SuperMonster003/Ant-Forest/issues/467)_
* `修复` 支付宝应用控件变更导致主账户登录失败的问题
* `优化` 独立无障碍服务模块(a11y)及本地存储扩展模块(storage)
* `优化` 截图权限申请扩展方法在多线程等极端条件下的适应性

# v2.1.1
###### 2021/05/17
* `新增` 能量雨收集工具 (简易) (/tools/energy-rain-harvesting.js)
Expand Down
Loading

0 comments on commit b1ed0b4

Please sign in to comment.