From 2739006b5201322e9e978c98693ce4850713ecfc Mon Sep 17 00:00:00 2001 From: xstraok <89219595+xstraok@users.noreply.github.com> Date: Mon, 17 Apr 2023 13:14:03 -0400 Subject: [PATCH 01/12] Update fluentscan.py added: initial error checking support, detecting of unused entries --- fluentscan.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/fluentscan.py b/fluentscan.py index cf05b5e..85ad790 100644 --- a/fluentscan.py +++ b/fluentscan.py @@ -5,6 +5,17 @@ import os import sys +import glob + +valid_args=["diff","unused"] + +if len(sys.argv)<3 or len(sys.argv) == 0: + print("missing arguments") + sys.exit() + +if sys.argv[2] not in valid_args: + print(f"invalid argument:{sys.argv[2]}") + sys.exit() path = "assets/locales/" + sys.argv[1] + "/" @@ -48,8 +59,27 @@ for filename in os.listdir("assets/locales/en"): # TODO: why modified is not used? added, removed, modified, same = dict_compare(expected, expected2) + if sys.argv[2] == "unused" or sys.argv[2] == "missing": + files = glob.glob("src/" + '/**/*.rs', recursive=True) + used=[] + for i in files: + with open(i,"r") as script: + text=script.read() + if sys.argv[2] == "unused": + for j in expected: + if '"'+j+'"' in text: + used.append(j) + #elif sys.argv[2] == "missing": + #for j in text.split(): + #find all cases of tr( + + for i in expected: + if i not in used: + print(f"{i} is not used ({locale_file.name})") - if added or removed or same: + continue + + if (added or removed or same) and sys.argv[2] == "diff": print(f"[{created_locale.name[15:]}]") if added: @@ -72,3 +102,5 @@ for filename in os.listdir("assets/locales/en"): print(f" {i} = {expected[i]}") print("") + + From 3cea26c072dc47b1f8a6b8f648d240d6f6deff00 Mon Sep 17 00:00:00 2001 From: xstraok <89219595+xstraok@users.noreply.github.com> Date: Mon, 17 Apr 2023 19:52:56 -0400 Subject: [PATCH 02/12] add detection of missing entries --- fluentscan.py | 105 +++++++++++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 43 deletions(-) diff --git a/fluentscan.py b/fluentscan.py index 85ad790..d6e0b31 100644 --- a/fluentscan.py +++ b/fluentscan.py @@ -6,62 +6,69 @@ import os import sys import glob +import re -valid_args=["diff","unused"] +valid_args=["diff","unused","missing"] if len(sys.argv)<3 or len(sys.argv) == 0: print("missing arguments") sys.exit() if sys.argv[2] not in valid_args: - print(f"invalid argument:{sys.argv[2]}") + print(f"invalid argument:{sys.argv[2]}\n Valid arguments: {valid_args}") sys.exit() path = "assets/locales/" + sys.argv[1] + "/" +all_entries={} + +def dict_compare(d1, d2): + d1_keys = set(d1.keys()) + d2_keys = set(d2.keys()) + shared_keys = d1_keys.intersection(d2_keys) + + added = d1_keys - d2_keys + removed = d2_keys - d1_keys + + same = set(o for o in shared_keys if d1[o] == d2[o]) + + return added, removed, same + +def to_dict(text): + result={} + + for i in text: + if " =" in i: + try: + result[i.split()[0]] = ' '.join(i.split()[2:]) + + except: + pass + + elif i: + result[list(result.keys())[-1]] += i + + return result + +def get_line_num(text,pattern): + line=1 + for i in text.split("\n"): + if pattern in i: + return line + line += 1 for filename in os.listdir("assets/locales/en"): with open(os.path.join("assets/locales/en", filename), 'r') as locale_file: created_locale = open(path + filename) - def to_dict(text): - result={} - - for i in text: - if " = " in i: - try: - result[i.split()[0]] = ' '.join(i.split()[2:]) - - except: - pass - - elif i: - result[list(result.keys())[-1]] += i - - return result - - def dict_compare(d1, d2): - d1_keys = set(d1.keys()) - d2_keys = set(d2.keys()) - - shared_keys = d1_keys.intersection(d2_keys) - - added = d1_keys - d2_keys - removed = d2_keys - d1_keys - - modified = {o : (d1[o], d2[o]) for o in shared_keys if d1[o] != d2[o]} - - same = set(o for o in shared_keys if d1[o] == d2[o]) - - return added, removed, modified, same - expected=to_dict(locale_file) + all_entries.update(expected) expected2=to_dict(created_locale) - # TODO: why modified is not used? - added, removed, modified, same = dict_compare(expected, expected2) + added, removed, same = dict_compare(expected, expected2) if sys.argv[2] == "unused" or sys.argv[2] == "missing": files = glob.glob("src/" + '/**/*.rs', recursive=True) used=[] + vars={} for i in files: with open(i,"r") as script: text=script.read() @@ -69,13 +76,20 @@ for filename in os.listdir("assets/locales/en"): for j in expected: if '"'+j+'"' in text: used.append(j) - #elif sys.argv[2] == "missing": - #for j in text.split(): - #find all cases of tr( - - for i in expected: - if i not in used: - print(f"{i} is not used ({locale_file.name})") + elif sys.argv[2] == "missing": + for j in text.split(): + if 'tr("' in j: + index=j.find('tr("') + var_name=re.sub('[^\\w-]+', '', + j[index:].replace('tr("','') + .replace("Some","")) + # TODO: search multiple lines + vars[var_name] = [script.name, get_line_num(text,var_name)] + + if sys.argv[2] == "unused": + for i in expected: + if i not in used: + print(f"{i} is not used ({locale_file.name})") continue @@ -102,5 +116,10 @@ for filename in os.listdir("assets/locales/en"): print(f" {i} = {expected[i]}") print("") - +if sys.argv[2] == "missing": + added, removed, same = dict_compare(vars, all_entries) + if not added: + print("nothing is missing") + for i in added: + print(f"missing entry: {i} ({vars[i][0]}), line {vars[i][1]}") From c82fbcfef4e060008d92d10e423ae90622d13a55 Mon Sep 17 00:00:00 2001 From: xstraok <89219595+xstraok@users.noreply.github.com> Date: Mon, 17 Apr 2023 20:20:37 -0400 Subject: [PATCH 03/12] finalize error checking and format printing formatted printing when "missing" or "unused" argument was used --- fluentscan.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/fluentscan.py b/fluentscan.py index d6e0b31..91d76c2 100644 --- a/fluentscan.py +++ b/fluentscan.py @@ -19,6 +19,13 @@ if sys.argv[2] not in valid_args: sys.exit() path = "assets/locales/" + sys.argv[1] + "/" +try: + x=open(path+"/main.ftl","r") + x.close() +except: + print(f"{path} does not exist") + sys.exit() + all_entries={} def dict_compare(d1, d2): @@ -78,18 +85,22 @@ for filename in os.listdir("assets/locales/en"): used.append(j) elif sys.argv[2] == "missing": for j in text.split(): + # TODO: ignore comments if 'tr("' in j: index=j.find('tr("') var_name=re.sub('[^\\w-]+', '', j[index:].replace('tr("','') .replace("Some","")) - # TODO: search multiple lines + # TODO: index multiple matches vars[var_name] = [script.name, get_line_num(text,var_name)] if sys.argv[2] == "unused": for i in expected: if i not in used: - print(f"{i} is not used ({locale_file.name})") + print(f"[{locale_file.name}]\n" + " [Unused]\n" + f" {i}") + continue @@ -122,4 +133,6 @@ if sys.argv[2] == "missing": if not added: print("nothing is missing") for i in added: - print(f"missing entry: {i} ({vars[i][0]}), line {vars[i][1]}") + print(f"[{vars[i][0]}, line {vars[i][1]}]\n" + " [Missing]\n" + f" {i}") From 2ec976c8ca81103a43ecc76b9fd24b5f0957d7bf Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Mon, 17 Apr 2023 19:15:56 +0200 Subject: [PATCH 04/12] 3.5.2 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 92cb0dc..7d51a4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,7 +65,7 @@ dependencies = [ [[package]] name = "anime-game-launcher" -version = "3.5.1" +version = "3.5.2" dependencies = [ "anime-launcher-sdk", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 9247270..61d37f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "anime-game-launcher" -version = "3.5.1" +version = "3.5.2" description = "Anime Game launcher" authors = ["Nikita Podvirnyy "] license = "GPL-3.0" From f475b025425968bebadd2a89d20a080a242ce4b4 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Mon, 17 Apr 2023 19:37:33 +0200 Subject: [PATCH 05/12] docs: updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9307eb..9a05611 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [3.5.2] - 17.04.2023 + ### Added - Added arguments and symlinks editor to sandbox settings From c2bbde85b33b7678821ca4a1d219573cb66b642a Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Tue, 18 Apr 2023 16:43:05 +0200 Subject: [PATCH 06/12] feat: fixed wine tools running using proton builds --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- src/ui/preferences/general.rs | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d51a4c..a201cc9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,8 +40,8 @@ dependencies = [ [[package]] name = "anime-game-core" -version = "1.7.1" -source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.7.1#8978728ce5d94aec5c6aecfe470e45fc43d5b522" +version = "1.7.2" +source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.7.2#b367ea1303c9687217024902e37dbb4e24b05f37" dependencies = [ "anyhow", "bzip2", @@ -87,8 +87,8 @@ dependencies = [ [[package]] name = "anime-launcher-sdk" -version = "1.0.6" -source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.0.6#2a8272c1afdd006925c150ac480a82be645f4b52" +version = "1.0.10" +source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.0.10#204369158e57056dfc64fbff62fbe6a571034913" dependencies = [ "anime-game-core", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 61d37f4..2fc6345 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ glib-build-tools = "0.17" [dependencies.anime-launcher-sdk] git = "https://github.com/an-anime-team/anime-launcher-sdk" -tag = "1.0.6" +tag = "1.0.10" features = ["all", "genshin"] # path = "../anime-launcher-sdk" # ! for dev purposes only diff --git a/src/ui/preferences/general.rs b/src/ui/preferences/general.rs index 9376a68..6c09ff2 100644 --- a/src/ui/preferences/general.rs +++ b/src/ui/preferences/general.rs @@ -1035,7 +1035,8 @@ impl SimpleAsyncComponent for GeneralApp { let config = Config::get().unwrap_or_else(|_| CONFIG.clone()); if let Ok(Some(wine)) = config.get_selected_wine() { - let result = wine.to_wine(config.components.path, Some(config.game.wine.builds.join(&wine.name))) + let result = wine + .to_wine(config.components.path, Some(config.game.wine.builds.join(&wine.name))) .with_prefix(config.game.wine.prefix) .with_loader(WineLoader::Current) .with_arch(WineArch::Win64) From 4d1ed70e5bfe9185beae5d4111ad76408ac79fec Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Tue, 18 Apr 2023 16:55:06 +0200 Subject: [PATCH 07/12] build(fluentscan): style changes --- fluentscan.py | 76 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 31 deletions(-) mode change 100644 => 100755 fluentscan.py diff --git a/fluentscan.py b/fluentscan.py old mode 100644 new mode 100755 index 91d76c2..1f3e632 --- a/fluentscan.py +++ b/fluentscan.py @@ -8,29 +8,34 @@ import sys import glob import re -valid_args=["diff","unused","missing"] +valid_commands = ["diff", "unused", "missing"] + +if len(sys.argv) < 3: + print(f"Command format: ./fluentscan.py [command] [locale]\nAvailable commands: {valid_commands}") -if len(sys.argv)<3 or len(sys.argv) == 0: - print("missing arguments") sys.exit() -if sys.argv[2] not in valid_args: - print(f"invalid argument:{sys.argv[2]}\n Valid arguments: {valid_args}") +if sys.argv[1] not in valid_commands: + print(f"Invalid command \"{sys.argv[1]}\". Available commands: {valid_commands}") + sys.exit() -path = "assets/locales/" + sys.argv[1] + "/" +path = "assets/locales/" + sys.argv[2] + "/" + try: - x=open(path+"/main.ftl","r") - x.close() + open(path + "/main.ftl", "r").close() + except: print(f"{path} does not exist") + sys.exit() -all_entries={} +all_entries = {} def dict_compare(d1, d2): d1_keys = set(d1.keys()) d2_keys = set(d2.keys()) + shared_keys = d1_keys.intersection(d2_keys) added = d1_keys - d2_keys @@ -57,54 +62,61 @@ def to_dict(text): return result def get_line_num(text,pattern): - line=1 + line = 1 + for i in text.split("\n"): if pattern in i: return line + line += 1 for filename in os.listdir("assets/locales/en"): with open(os.path.join("assets/locales/en", filename), 'r') as locale_file: created_locale = open(path + filename) - expected=to_dict(locale_file) + expected = to_dict(locale_file) + expected2 = to_dict(created_locale) + all_entries.update(expected) - expected2=to_dict(created_locale) added, removed, same = dict_compare(expected, expected2) - if sys.argv[2] == "unused" or sys.argv[2] == "missing": - files = glob.glob("src/" + '/**/*.rs', recursive=True) - used=[] - vars={} + + if sys.argv[1] == "unused" or sys.argv[1] == "missing": + files = glob.glob("src/**/*.rs", recursive=True) + + used = [] + vars = {} + for i in files: - with open(i,"r") as script: - text=script.read() - if sys.argv[2] == "unused": + with open(i, "r") as script: + text = script.read() + + if sys.argv[1] == "unused": for j in expected: - if '"'+j+'"' in text: + if f"\"{j}\"" in text: used.append(j) - elif sys.argv[2] == "missing": + + elif sys.argv[1] == "missing": for j in text.split(): # TODO: ignore comments if 'tr("' in j: - index=j.find('tr("') - var_name=re.sub('[^\\w-]+', '', - j[index:].replace('tr("','') - .replace("Some","")) + index = j.find('tr("') + + var_name = re.sub('[^\\w-]+', '', j[index:].replace('tr("', '').replace("Some", "")) + # TODO: index multiple matches vars[var_name] = [script.name, get_line_num(text,var_name)] - if sys.argv[2] == "unused": + if sys.argv[1] == "unused": for i in expected: if i not in used: print(f"[{locale_file.name}]\n" - " [Unused]\n" + " [Unused]\n" f" {i}") - continue - if (added or removed or same) and sys.argv[2] == "diff": + if (added or removed or same) and sys.argv[1] == "diff": print(f"[{created_locale.name[15:]}]") if added: @@ -128,10 +140,12 @@ for filename in os.listdir("assets/locales/en"): print("") -if sys.argv[2] == "missing": +if sys.argv[1] == "missing": added, removed, same = dict_compare(vars, all_entries) + if not added: - print("nothing is missing") + print("Nothing is missing") + for i in added: print(f"[{vars[i][0]}, line {vars[i][1]}]\n" " [Missing]\n" From 3d281e8ad11ae250365ae5aa7bc112528336d76e Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Tue, 18 Apr 2023 18:05:23 +0200 Subject: [PATCH 08/12] feat(i18n): updated Chinese and Spanish --- assets/locales/es/sandbox.ftl | 6 +++--- assets/locales/zh-cn/sandbox.ftl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/locales/es/sandbox.ftl b/assets/locales/es/sandbox.ftl index e6a241e..530e1fe 100644 --- a/assets/locales/es/sandbox.ftl +++ b/assets/locales/es/sandbox.ftl @@ -8,7 +8,7 @@ hide-home-directory = Esconder el directorio home hide-home-directory-description = Aisla las carpetas /home, /var/home/$USER, y $HOME del juego hostname = Nombre del host -additional-arguments = Additional arguments +additional-arguments = Argumentos adicionales private-directories = Directorios privados private-directories-description = Estas carpetas serán reemplazadas por un sistema de archivos virtual (tmpfs) vacío, y su contenido real no será accesible al juego aislado @@ -24,5 +24,5 @@ new-path = Nueva ruta read-only = Sólo lectura read-only-description = Le prohibe al juego escribir datos en este directorio -symlinks = Symlinks -symlinks-description = Symlink original path to the new one inside of your sandbox +symlinks = Enlaces simbólicos +symlinks-description = Enlaza la ruta original a la nueva dentro de tu entorno aislado diff --git a/assets/locales/zh-cn/sandbox.ftl b/assets/locales/zh-cn/sandbox.ftl index 11a9617..9714308 100644 --- a/assets/locales/zh-cn/sandbox.ftl +++ b/assets/locales/zh-cn/sandbox.ftl @@ -8,7 +8,7 @@ hide-home-directory = 隐藏家目录 hide-home-directory-description = 将 /home、 /var/home/$USER 和 $HOME 目录与游戏隔离 hostname = 主机名 -additional-arguments = Additional arguments +additional-arguments = 额外参数 private-directories = 隐私目录 private-directories-description = 这些目录将会被空的虚拟文件系统(tmpfs)替代,其中的原始内容不可被沙盒中的游戏访问 @@ -24,5 +24,5 @@ new-path = 新路径 read-only = 只读 read-only-description = 禁止游戏向此目录写入任何数据 -symlinks = Symlinks -symlinks-description = Symlink original path to the new one inside of your sandbox +symlinks = 软链接 +symlinks-description = 软链接原始路径到沙盒里的新路径 From 58e69bf73fd43a7873a3cea6612da5ef90391bee Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Fri, 21 Apr 2023 21:11:40 +0200 Subject: [PATCH 09/12] feat: updated readme --- README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 310e945..8e12881 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@
-# Please don't link to this repository +# ⚠️ Please don't link to this repository We understand you want to help people run An Anime Game on Linux. The issue is, the more people know of the tools involved in it, the higher the chances The Anime Game Company will notice them, and then @@ -32,11 +32,19 @@ Or share them and ruin it for the dozens of Linux players. It's up to you. Do what you must, but we would respectfully request that you try to label the game as "An Anime Game" instead of the actual name of the game, to avoid search engine parsing. -# Documentation +
-Documentation for the launcher can be found in the [repository wiki](https://github.com/an-anime-team/an-anime-game-launcher/wiki). +# ♥️ Useful links and thanks -# Download +* Original patch project without which this project wouldn't be possible. Link is omitted for "privacy" purposes +* [macOS launcher](https://github.com/3Shain/yet-another-anime-game-launcher) which contains some additional compatibility components +* [Wiki](https://github.com/an-anime-team/an-anime-game-launcher/wiki) contains some basic FAQ, installation instructions and more +* [Releases page](https://github.com/an-anime-team/an-anime-game-launcher/releases) where you can find latest available version +* [Changelog](CHANGELOG.md) with chronology of the project + +
+ +# ⬇️ Download Currently there are 5 options available: 1. Flatpak @@ -49,9 +57,9 @@ To see the installation guides, [Please visit the wiki page here](https://github ## Chinese version support -This should be automatically enabled if you're using zh_cn (Chinese) as your system language. If you're not using it - you'll need to set `China` as your `launcher.edition` in the `config.json` file +This should be automatically enabled if you're using zh_cn (Chinese) as your system language. If you're not using it - you can change the game edition in the launcher settings -# Development +# 💻 Development | Folder | Description | | - | - | From be1df2321a6aab650de6a9f7e09c2fbf37081d15 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Fri, 21 Apr 2023 21:20:36 +0200 Subject: [PATCH 10/12] docs: updated download section in readme --- README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8e12881..22b95db 100644 --- a/README.md +++ b/README.md @@ -46,19 +46,23 @@ instead of the actual name of the game, to avoid search engine parsing. # ⬇️ Download -Currently there are 5 options available: -1. Flatpak -2. AUR -3. RPM -4. Gentoo/ebuild -5. NixOS +| Format | Wiki | Source | +| - | - | - | +| Flatpak | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-any-distribution-flatpak) | - | +| AUR | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-arch-linux-aur) | [an-anime-game-launcher-bin](https://aur.archlinux.org/packages/an-anime-game-launcher-bin) | +| RPM | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-fedora-rpm) | [AAGL](https://build.opensuse.org/repositories/home:Maroxy:AAT-Apps/AAGL) | +| Ubuntu (pacstall) | - | [an-anime-game-launcher-bin](https://pacstall.dev/packages/an-anime-game-launcher-bin) | +| Gentoo (ebuild) | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-gentoo-linux-ebuild) | [aagl-ebuilds](https://github.com/an-anime-team/aagl-ebuilds) | +| NixOS (nixpkg) | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-nixos-nixpkg) | [aagl-gtk-on-nix](https://github.com/ezKEa/aagl-gtk-on-nix) | -To see the installation guides, [Please visit the wiki page here](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation) +To see the installation guides, please visit the wiki page [here](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation) ## Chinese version support This should be automatically enabled if you're using zh_cn (Chinese) as your system language. If you're not using it - you can change the game edition in the launcher settings +
+ # 💻 Development | Folder | Description | From b7fe2ffb87bf1b71bd9b3cb8c194ea51baaaa667 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Sat, 22 Apr 2023 14:24:28 +0200 Subject: [PATCH 11/12] docs: added distribution names in download section --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 22b95db..f7e36fd 100644 --- a/README.md +++ b/README.md @@ -46,14 +46,14 @@ instead of the actual name of the game, to avoid search engine parsing. # ⬇️ Download -| Format | Wiki | Source | -| - | - | - | -| Flatpak | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-any-distribution-flatpak) | - | -| AUR | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-arch-linux-aur) | [an-anime-game-launcher-bin](https://aur.archlinux.org/packages/an-anime-game-launcher-bin) | -| RPM | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-fedora-rpm) | [AAGL](https://build.opensuse.org/repositories/home:Maroxy:AAT-Apps/AAGL) | -| Ubuntu (pacstall) | - | [an-anime-game-launcher-bin](https://pacstall.dev/packages/an-anime-game-launcher-bin) | -| Gentoo (ebuild) | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-gentoo-linux-ebuild) | [aagl-ebuilds](https://github.com/an-anime-team/aagl-ebuilds) | -| NixOS (nixpkg) | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-nixos-nixpkg) | [aagl-gtk-on-nix](https://github.com/ezKEa/aagl-gtk-on-nix) | +| Distribution | Format | Wiki | Source | +| - | - | - | - | +| Fedora | Flatpak | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-any-distribution-flatpak) | - | +| Arch Linux, Manjaro | AUR | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-arch-linux-aur) | [an-anime-game-launcher-bin](https://aur.archlinux.org/packages/an-anime-game-launcher-bin) | +| Fedora, OpenSUSE | RPM | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-fedora-rpm) | [AAGL](https://build.opensuse.org/repositories/home:Maroxy:AAT-Apps/AAGL) | +| Ubuntu | pacstall | - | [an-anime-game-launcher-bin](https://pacstall.dev/packages/an-anime-game-launcher-bin) | +| Gentoo | ebuild | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-gentoo-linux-ebuild) | [aagl-ebuilds](https://github.com/an-anime-team/aagl-ebuilds) | +| NixOS | nixpkg | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-nixos-nixpkg) | [aagl-gtk-on-nix](https://github.com/ezKEa/aagl-gtk-on-nix) | To see the installation guides, please visit the wiki page [here](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation) From aa5215533ad0249e8729f4e549f5b793d6554459 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Sat, 22 Apr 2023 18:06:41 +0200 Subject: [PATCH 12/12] feat: added rules approving dialog to the first run window --- assets/locales/en/first_run.ftl | 6 ++++++ assets/locales/en/main.ftl | 1 + src/ui/first_run/tos_warning.rs | 35 ++++++++++++++++++++++++++++----- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/assets/locales/en/first_run.ftl b/assets/locales/en/first_run.ftl index 9ab26c6..9432dcf 100644 --- a/assets/locales/en/first_run.ftl +++ b/assets/locales/en/first_run.ftl @@ -23,6 +23,12 @@ tos-violation-warning-message = If you understand the risk of trying to play the game in an unofficial capacity, press OK and let's go researching the world of Teyvat! +tos-dialog-title = Are you sure you understand what we want to say? +tos-dialog-message = + 1. Don't publish any information about this project + 2. Don't abuse it by using some modded clients and so + 3. Ask questions exceptionally in our discord or matrix server + dependencies = Dependencies missing-dependencies-title = You're missing some dependencies! diff --git a/assets/locales/en/main.ftl b/assets/locales/en/main.ftl index f36da46..f448ac1 100644 --- a/assets/locales/en/main.ftl +++ b/assets/locales/en/main.ftl @@ -22,6 +22,7 @@ continue = Continue exit = Exit check = Check restart = Restart +agree = Agree loading-data = Loading data diff --git a/src/ui/first_run/tos_warning.rs b/src/ui/first_run/tos_warning.rs index 08ae5b1..364632b 100644 --- a/src/ui/first_run/tos_warning.rs +++ b/src/ui/first_run/tos_warning.rs @@ -8,6 +8,8 @@ use anime_launcher_sdk::is_available; use crate::i18n::*; use super::main::FirstRunAppMsg; +use super::main::MAIN_WINDOW; + pub struct TosWarningApp; #[derive(Debug, Clone)] @@ -86,11 +88,34 @@ impl SimpleAsyncComponent for TosWarningApp { match msg { #[allow(unused_must_use)] TosWarningAppMsg::Continue => { - if is_available("git") && is_available("xdelta3") { - sender.output(Self::Output::ScrollToDefaultPaths); - } else { - sender.output(Self::Output::ScrollToDependencies); - } + let dialog = adw::MessageDialog::new( + unsafe { MAIN_WINDOW.as_ref() }, + Some(&tr("tos-dialog-title")), + Some(&tr("tos-dialog-message")) + ); + + dialog.add_responses(&[ + ("exit", &tr("exit")), + ("continue", &tr("agree")) + ]); + + dialog.connect_response(None, move |_, response| { + match response { + "exit" => relm4::main_application().quit(), + + "continue" => { + if is_available("git") && is_available("xdelta3") { + sender.output(Self::Output::ScrollToDefaultPaths); + } else { + sender.output(Self::Output::ScrollToDependencies); + } + } + + _ => unreachable!() + } + }); + + dialog.show(); } TosWarningAppMsg::Exit => relm4::main_application().quit()