Skip to content

Commit

Permalink
优化程序
Browse files Browse the repository at this point in the history
  • Loading branch information
L8426936 committed Nov 17, 2021
1 parent 0845ff9 commit 9440d2e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
39 changes: 19 additions & 20 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
</vertical>
);

let base_path = files.getSdcardPath() + "/Android/data/" + context.getPackageName() + "/";
let base_path = files.getSdcardPath() + "/Android/data/" + context.getPackageName() + "/CleanUpWeChatZombieFans/";
let base_url = "https://gitee.com/L8426936/CleanUpWeChatZombieFans/raw/master/";
// 本地测试使用
// let base_url = "http://192.168.123.105/auto.js-script/CleanUpWeChatZombieFans/";

/**
* 初始化配置
Expand Down Expand Up @@ -49,34 +51,31 @@
let response = http.get(base_url + key);
if (response["statusCode"] == 200) {
current_progress += files_md5[key]["size"];
ui.progressbar.setProgress(current_progress * 100 / max_progress);
files.ensureDir(key);
files.write(key, response.body.string());
ui.run(function () {
ui.progressbar.setProgress(current_progress * 100 / max_progress);
});
files.ensureDir(base_path + ".download_files/" + key);
files.write(base_path + ".download_files/" + key, response.body.string());
} else {
completed_all_file = false;
break;
}
}
if (completed_all_file) {
for (let key in files_md5) {
if (!files.copy(base_path + ".download_files/" + key, base_path + key)) {
completed_all_file = false;
break;
}
}
}
files.removeDir(base_path + ".download_files");
if (completed_all_file) {
ui.run(function () {
ui.download_message.setText("下载完成");
});
for (let key in files_md5) {
files.ensureDir(base_path + key);
completed_all_file = completed_all_file && files.copy(key, base_path + key);
}
if (completed_all_file) {
ui.run(function () {
ui.download_message.setText("复制完成");
});
engines.execScriptFile(base_path + "main.js", {path: base_path});
engines.myEngine().forceStop();
} else {
ui.run(function () {
ui.download_message.setText("复制失败");
ui.try_download.setEnabled(true);
});
}
engines.execScriptFile(base_path + "main.js", {path: base_path});
engines.myEngine().forceStop();
} else {
ui.run(function () {
ui.download_message.setText("下载失败");
Expand Down
4 changes: 2 additions & 2 deletions project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"name": "清理微信僵尸粉启动器",
"packageName": "com.l8426936.cleanupwechatzombiefanslauncher",
"scripts": {},
"versionCode": 1,
"versionName": "1.0.0"
"versionCode": 2,
"versionName": "1.0.1"
}

0 comments on commit 9440d2e

Please sign in to comment.