feat: added rules approving dialog to the first run window

This commit is contained in:
Observer KRypt0n_ 2023-04-22 18:06:41 +02:00
parent b7fe2ffb87
commit aa5215533a
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
3 changed files with 37 additions and 5 deletions

View file

@ -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!

View file

@ -22,6 +22,7 @@ continue = Continue
exit = Exit
check = Check
restart = Restart
agree = Agree
loading-data = Loading data

View file

@ -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,6 +88,22 @@ impl SimpleAsyncComponent for TosWarningApp {
match msg {
#[allow(unused_must_use)]
TosWarningAppMsg::Continue => {
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 {
@ -93,6 +111,13 @@ impl SimpleAsyncComponent for TosWarningApp {
}
}
_ => unreachable!()
}
});
dialog.show();
}
TosWarningAppMsg::Exit => relm4::main_application().quit()
}
}