Skip to content

Commit

Permalink
feat: do not make splash screen wait for checkForUpdates task (WerWol…
Browse files Browse the repository at this point in the history
  • Loading branch information
iTrooz authored Oct 26, 2023
1 parent a0178eb commit 80ca6bf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions main/gui/source/init/tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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 },
};
}
Expand Down

0 comments on commit 80ca6bf

Please sign in to comment.