From 80ca6bf1777da59c678a58512a1c7d422985115d Mon Sep 17 00:00:00 2001 From: iTrooz Date: Thu, 26 Oct 2023 23:45:43 +0200 Subject: [PATCH] feat: do not make splash screen wait for checkForUpdates task (#1390) --- main/gui/source/init/tasks.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main/gui/source/init/tasks.cpp b/main/gui/source/init/tasks.cpp index ae45425fd..267c7f0f9 100644 --- a/main/gui/source/init/tasks.cpp +++ b/main/gui/source/init/tasks.cpp @@ -34,13 +34,12 @@ namespace hex::init { using namespace std::literals::string_literals; - static bool checkForUpdates() { + static bool checkForUpdatesSync() { int checkForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.server_contact", 2); // Check if we should check for updates if (checkForUpdates == 1){ HttpRequest request("GET", GitHubApiURL + "/releases/latest"s); - request.setTimeout(500); // Query the GitHub API for the latest release version auto response = request.execute().get(); @@ -112,6 +111,11 @@ namespace hex::init { } return true; } + + static bool checkForUpdates() { + TaskManager::createBackgroundTask("Checking for updates", [](auto&) { checkForUpdatesSync(); }); + return true; + } bool setupEnvironment() { hex::log::debug("Using romfs: '{}'", romfs::name()); @@ -608,7 +612,7 @@ namespace hex::init { { "Loading settings", loadSettings, false }, { "Configuring UI scale", configureUIScale, false }, { "Loading plugins", loadPlugins, true }, - { "Checking for updates", checkForUpdates, true }, + { "Checking for updates", checkForUpdates, false }, { "Loading fonts", loadFonts, true }, }; }