Skip to content

Commit

Permalink
修复安卓10及以上版本无法运行
Browse files Browse the repository at this point in the history
  • Loading branch information
L8426936 committed May 1, 2022
1 parent d60db82 commit b96bb49
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
24 changes: 13 additions & 11 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
);

let keep = true;
let base_path = files.getSdcardPath() + "/Android/data/" + context.getPackageName() + "/CleanUpWeChatZombieFans/";
let base_path = context.getExternalFilesDir("CleanUpWeChatZombieFans").getAbsolutePath() + "/";
let base_url = "https://gitee.com/L8426936/CleanUpWeChatZombieFans/raw/master/";
// 本地测试使用
// let base_url = "http://192.168.123.105/auto.js-script/CleanUpWeChatZombieFans/";
Expand All @@ -20,7 +20,16 @@
*/
function init() {
ui.try_download.setEnabled(false);
if (files.exists(base_path + "main.js")) {
let complete = files.exists(base_path + "config/files_md5.json");
if (complete) {
for (let key in JSON.parse(files.read(base_path + "config/files_md5.json"))) {
if (!files.exists(base_path + key)) {
complete = false;
break;
}
}
}
if (complete) {
engines.execScriptFile(base_path + "main.js", {path: base_path});
engines.myEngine().forceStop();
} else {
Expand Down Expand Up @@ -63,18 +72,12 @@
ui.run(function () {
ui.progressbar.setProgress(current_progress * 100 / max_progress);
});
files.ensureDir(base_path + ".cache/" + key);
files.write(base_path + ".cache/" + key, response.body.string());
files.ensureDir(base_path + key);
files.write(base_path + key, response.body.string());
} else {
throw new Error("下载失败");
}
}
for (let key in files_md5) {
files.ensureDir(base_path + key);
if (!files.copy(base_path + ".cache/" + key, base_path + key)) {
throw new Error("复制失败");
}
}
ui.run(function () {
ui.download_message.setText("下载完成");
});
Expand All @@ -89,7 +92,6 @@
ui.try_download.setEnabled(true);
});
}
files.removeDir(base_path + ".cache");
});
}
})();
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": 4,
"versionName": "1.0.3"
"versionCode": 5,
"versionName": "1.0.4"
}

0 comments on commit b96bb49

Please sign in to comment.