107 lines
4.7 KiB
Diff
107 lines
4.7 KiB
Diff
running the internal update checker is pointless when updates are managed by xbps
|
|
|
|
--- a/plugins/builtin/source/content/welcome_screen.cpp
|
|
+++ b/plugins/builtin/source/content/welcome_screen.cpp
|
|
@@ -517,20 +517,6 @@
|
|
loadDefaultLayout();
|
|
});
|
|
|
|
- EventManager::subscribe<EventWindowInitialized>([] {
|
|
- // documentation of the value above the setting definition
|
|
- int showCheckForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2);
|
|
- if (showCheckForUpdates == 2) {
|
|
- ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 0);
|
|
- View::showYesNoQuestionPopup("hex.builtin.welcome.check_for_updates_text"_lang,
|
|
- [] { // yes
|
|
- ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 1);
|
|
- ImGui::CloseCurrentPopup();
|
|
- }, [] { // no
|
|
- ImGui::CloseCurrentPopup();
|
|
- });
|
|
- }
|
|
- });
|
|
|
|
ContentRegistry::Interface::addMenuItem("hex.builtin.menu.file", 1075, [&] {
|
|
if (ImGui::BeginMenu("hex.builtin.menu.file.open_recent"_lang, !s_recentProvidersUpdating && !s_recentProviders.empty())) {
|
|
--- a/plugins/builtin/source/content/settings_entries.cpp
|
|
+++ b/plugins/builtin/source/content/settings_entries.cpp
|
|
@@ -35,21 +35,6 @@
|
|
|
|
/* General */
|
|
|
|
- /* Values of this setting :
|
|
- 0 - do not check for updates on startup
|
|
- 1 - check for updates on startup
|
|
- 2 - default value - ask the user if he wants to check for updates. This value should only be encountered on the first startup.
|
|
- */
|
|
- ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2, [](auto name, nlohmann::json &setting) {
|
|
- static bool enabled = static_cast<int>(setting) == 1;
|
|
-
|
|
- if (ImGui::Checkbox(name.data(), &enabled)) {
|
|
- setting = static_cast<int>(enabled);
|
|
- return true;
|
|
- }
|
|
-
|
|
- return false;
|
|
- });
|
|
|
|
ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.show_tips", 1, [](auto name, nlohmann::json &setting) {
|
|
static bool enabled = static_cast<int>(setting);
|
|
--- a/main/source/init/tasks.cpp
|
|
+++ b/main/source/init/tasks.cpp
|
|
@@ -29,46 +29,6 @@
|
|
|
|
using namespace std::literals::string_literals;
|
|
|
|
- static bool checkForUpdates() {
|
|
- int showCheckForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2);
|
|
-
|
|
- // Check if we should check for updates
|
|
- if (showCheckForUpdates == 1){
|
|
- HttpRequest request("GET", GitHubApiURL + "/releases/latest"s);
|
|
- request.setTimeout(2000);
|
|
-
|
|
- // Query the GitHub API for the latest release version
|
|
- auto response = request.execute().get();
|
|
- if (response.getStatusCode() != 200)
|
|
- return false;
|
|
-
|
|
- nlohmann::json releases;
|
|
- try {
|
|
- releases = nlohmann::json::parse(response.getData());
|
|
- } catch (std::exception &e) {
|
|
- return false;
|
|
- }
|
|
-
|
|
- // Check if the response is valid
|
|
- if (!releases.contains("tag_name") || !releases["tag_name"].is_string())
|
|
- return false;
|
|
-
|
|
- // Convert the current version string to a format that can be compared to the latest release
|
|
- auto versionString = std::string(IMHEX_VERSION);
|
|
- size_t versionLength = std::min(versionString.find_first_of('-'), versionString.length());
|
|
- auto currVersion = "v" + versionString.substr(0, versionLength);
|
|
-
|
|
- // Get the latest release version string
|
|
- auto latestVersion = releases["tag_name"].get<std::string_view>();
|
|
-
|
|
- // Check if the latest release is different from the current version
|
|
- if (latestVersion != currVersion)
|
|
- ImHexApi::System::impl::addInitArgument("update-available", latestVersion.data());
|
|
-
|
|
- }
|
|
- return true;
|
|
- }
|
|
-
|
|
bool setupEnvironment() {
|
|
hex::log::debug("Using romfs: '{}'", romfs::name());
|
|
|
|
@@ -479,7 +439,6 @@
|
|
#endif
|
|
{ "Loading settings", loadSettings, false },
|
|
{ "Loading plugins", loadPlugins, false },
|
|
- { "Checking for updates", checkForUpdates, true },
|
|
{ "Loading fonts", loadFonts, true },
|
|
};
|
|
}
|