From 3ca0d08598a2c6e59181145bf8d3669e41e847b3 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Thu, 8 Jun 2023 10:52:54 +0200 Subject: [PATCH] feat: removed toasts when failed to get main/xlua patch status in repairer Not like it was really necessary, and sometimes could cause misunderstandings --- src/ui/main/repair_game.rs | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/src/ui/main/repair_game.rs b/src/ui/main/repair_game.rs index 0c71173..1b4b7cc 100644 --- a/src/ui/main/repair_game.rs +++ b/src/ui/main/repair_game.rs @@ -108,42 +108,22 @@ pub fn repair_game(sender: ComponentSender, progress_bar_input: Sender patch, - Err(err) => { - // TODO: do we really need this toast message here? Perhaps it's not an error but a warning? - sender.input(AppMsg::Toast { - title: tr("patch-info-fetching-error"), - description: Some(err.to_string()) - }); - - tracing::error!("Failed to get player patch status: {err}. Used config value instead: {}", config.patch.apply_main); + .and_then(|patch| patch.is_applied(&game_path)) + .unwrap_or_else(|err| { + tracing::warn!("Failed to get player patch status: {err}. Used config value instead: {}", config.patch.apply_main); config.patch.apply_main - } - }; + }); // Get xlua patch status let xlua_patch = XluaPatch::from_folder(&config.patch.path, config.launcher.edition) - .and_then(|patch| patch.is_applied(&game_path)); - - let xlua_patch = match xlua_patch { - Ok(patch) => patch, - Err(err) => { - // TODO: do we really need this toast message here? Perhaps it's not an error but a warning? - sender.input(AppMsg::Toast { - title: tr("patch-info-fetching-error"), - description: Some(err.to_string()) - }); - - tracing::error!("Failed to get xlua patch status: {err}. Used config value instead: {}", config.patch.apply_xlua); + .and_then(|patch| patch.is_applied(&game_path)) + .unwrap_or_else(|err| { + tracing::warn!("Failed to get xlua patch status: {err}. Used config value instead: {}", config.patch.apply_xlua); config.patch.apply_xlua - } - }; + }); tracing::debug!("Patches status: player({player_patch}), xlua({xlua_patch})");