From dd85f1b6d3186e05a2ee8867277929d43d70e006 Mon Sep 17 00:00:00 2001 From: Nikita Podvirnyi Date: Thu, 29 Aug 2024 18:05:48 +0200 Subject: [PATCH] fix: (potentially) fixed a bug with pre-download button --- Cargo.lock | 6 ++++-- src/ui/main/mod.rs | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d72ed8..23c89bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -57,7 +57,8 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "anime-game-core" -version = "1.22.2" +version = "1.23.0" +source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.23.0#9db1b598418c8c973b4e3afbdc17dcacc8511f3f" dependencies = [ "anyhow", "bzip2", @@ -106,7 +107,8 @@ dependencies = [ [[package]] name = "anime-launcher-sdk" -version = "1.18.0" +version = "1.19.0" +source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.19.0#18bbd738c9e941b76c1883a969cf9de87e724646" dependencies = [ "anime-game-core", "anyhow", diff --git a/src/ui/main/mod.rs b/src/ui/main/mod.rs index ab2379f..b56a5b7 100644 --- a/src/ui/main/mod.rs +++ b/src/ui/main/mod.rs @@ -330,16 +330,16 @@ impl SimpleComponent for App { let temp = config.launcher.temp.unwrap_or_else(std::env::temp_dir); let mut downloaded = temp.join(game.file_name().unwrap()).metadata() - .map(|metadata| Some(metadata.len()) == game.downloaded_size()) + .map(|metadata| Some(metadata.len()) >= game.downloaded_size()) .unwrap_or(false); if downloaded { for voice in voices { - downloaded = !temp.join(voice.file_name().unwrap()).metadata() - .map(|metadata| Some(metadata.len()) == voice.downloaded_size()) + downloaded = temp.join(voice.file_name().unwrap()).metadata() + .map(|metadata| Some(metadata.len()) >= voice.downloaded_size()) .unwrap_or(false); - if downloaded { + if !downloaded { break; } } @@ -358,16 +358,16 @@ impl SimpleComponent for App { let temp = config.launcher.temp.unwrap_or_else(std::env::temp_dir); let mut downloaded = temp.join(game.file_name().unwrap()).metadata() - .map(|metadata| Some(metadata.len()) == game.downloaded_size()) + .map(|metadata| Some(metadata.len()) >= game.downloaded_size()) .unwrap_or(false); if downloaded { for voice in voices { - downloaded = !temp.join(voice.file_name().unwrap()).metadata() - .map(|metadata| Some(metadata.len()) == voice.downloaded_size()) + downloaded = temp.join(voice.file_name().unwrap()).metadata() + .map(|metadata| Some(metadata.len()) >= voice.downloaded_size()) .unwrap_or(false); - if downloaded { + if !downloaded { break; } } @@ -541,11 +541,11 @@ impl SimpleComponent for App { } // Old warning message which I don't really understand now: - // + // // Doesn't work on all the systems // e.g. won't work if you didn't install wine system-wide // there's some reasons for it - // + // // UPD: I've tried this, and the problem is that it's completely pointless // For whatever reason it just doesn't work @@ -1015,7 +1015,7 @@ impl SimpleComponent for App { tracing::error!("Failed to update launcher state: {err}"); self.toast(tr!("launcher-state-updating-error"), Some(err.to_string())); - + None } }; @@ -1027,7 +1027,7 @@ impl SimpleComponent for App { } else { self.disabled_buttons = false; } - + if let Some(state) = state { match state { LauncherState::GameUpdateAvailable(_) |