1
0
mirror of synced 2024-11-28 09:30:51 +01:00

feat: do not make splash screen wait for checkForUpdates task (#1390)

This commit is contained in:
iTrooz 2023-10-26 23:45:43 +02:00 committed by GitHub
parent a0178ebab9
commit 80ca6bf177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,13 +34,12 @@ namespace hex::init {
using namespace std::literals::string_literals; 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); int checkForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.server_contact", 2);
// Check if we should check for updates // Check if we should check for updates
if (checkForUpdates == 1){ if (checkForUpdates == 1){
HttpRequest request("GET", GitHubApiURL + "/releases/latest"s); HttpRequest request("GET", GitHubApiURL + "/releases/latest"s);
request.setTimeout(500);
// Query the GitHub API for the latest release version // Query the GitHub API for the latest release version
auto response = request.execute().get(); auto response = request.execute().get();
@ -112,6 +111,11 @@ namespace hex::init {
} }
return true; return true;
} }
static bool checkForUpdates() {
TaskManager::createBackgroundTask("Checking for updates", [](auto&) { checkForUpdatesSync(); });
return true;
}
bool setupEnvironment() { bool setupEnvironment() {
hex::log::debug("Using romfs: '{}'", romfs::name()); hex::log::debug("Using romfs: '{}'", romfs::name());
@ -608,7 +612,7 @@ namespace hex::init {
{ "Loading settings", loadSettings, false }, { "Loading settings", loadSettings, false },
{ "Configuring UI scale", configureUIScale, false }, { "Configuring UI scale", configureUIScale, false },
{ "Loading plugins", loadPlugins, true }, { "Loading plugins", loadPlugins, true },
{ "Checking for updates", checkForUpdates, true }, { "Checking for updates", checkForUpdates, false },
{ "Loading fonts", loadFonts, true }, { "Loading fonts", loadFonts, true },
}; };
} }