diff --git a/scripts/project_update.py b/scripts/project_update.py index b6dc6f1..8e548d1 100644 --- a/scripts/project_update.py +++ b/scripts/project_update.py @@ -96,6 +96,7 @@ def update_gradle_property(content, key, new_value): GAME_ACTIVITY_PATH = f"LauncherCode/src/com/launchercode/GameActivity.kt".replace("/", os.sep) ANDROID_MANIFEST_PATH = f"lawnchair/AndroidManifest.xml".replace("/", os.sep) +STRING_PATH = f"LauncherCode/res/values/strings.xml".replace("/", os.sep) class ProjectUpdate(Task): @@ -314,6 +315,23 @@ storePassword=123456 open(build_gradle_path, "w", encoding="UTF-8").write(text) pass + def update_string(self): + privacy = self.context.get_config("TkA_Url_Privacy") + if not privacy or privacy == "": + raise Exception("配置文件中没有配置 TkA_Url_Privacy") + + tkg_custom = self.context.get_config("tkg_custom") + if not tkg_custom or tkg_custom == "": + raise Exception("配置文件中没有配置 tkg_custom") + + text = open(os.path.join(self.context.temp_project_path, STRING_PATH), "r", encoding="utf-8").read() + text = text.replace("https://harmonitun.com/privacy.html", privacy) + text = text.replace("https://harmonitun.com/TermsOfUse.html", + privacy.replace("privacy.html", "TermsOfUse.html")) + text = text.replace("harmounitun@outlook.com", tkg_custom) + open(os.path.join(self.context.temp_project_path, STRING_PATH), "w", encoding="utf-8").write(text) + pass + def execute(self): self.build_gradle_path = os.path.join(self.context.temp_project_path, "build.gradle") self.init_sdk_version() @@ -324,6 +342,7 @@ storePassword=123456 self.update_image() self.update_game_result() self.update_gradle_config() + self.update_string() pass def get_sdk_version(self) -> str: