feat: don't make requests to the Codeberg releases API unless absolutely necessary

This commit is contained in:
mkrsym1 2023-07-18 16:58:17 +03:00
parent 4a317fcc82
commit 7ba793c09a

View file

@ -771,14 +771,13 @@ impl SimpleComponent for App {
tasks.push(std::thread::spawn(clone!(@strong sender => move || {
// Get main patch status
sender.input(AppMsg::SetMainPatch(match jadeite::get_latest() {
Ok(latest) => match jadeite::get_metadata() {
sender.input(AppMsg::SetMainPatch(match jadeite::get_metadata() {
Ok(metadata) => {
let status = GAME.get_version()
.map(|version| metadata.games.hsr.global.get_status(version))
.unwrap_or(metadata.games.hsr.global.status);
Some((latest.version, status))
Some((metadata.jadeite.version, status))
}
Err(err) => {
@ -789,18 +788,6 @@ impl SimpleComponent for App {
description: Some(err.to_string())
});
None
}
},
Err(err) => {
tracing::error!("Failed to fetch latest patch version: {err}");
sender.input(AppMsg::Toast {
title: tr("patch-info-fetching-error"),
description: Some(err.to_string())
});
None
}
}));