mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-11-21 20:36:01 +03:00
feat: added rules approving dialog to the first run window
This commit is contained in:
parent
b7fe2ffb87
commit
aa5215533a
3 changed files with 37 additions and 5 deletions
|
@ -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!
|
||||
|
|
|
@ -22,6 +22,7 @@ continue = Continue
|
|||
exit = Exit
|
||||
check = Check
|
||||
restart = Restart
|
||||
agree = Agree
|
||||
|
||||
|
||||
loading-data = Loading data
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue