void-packages/srcpkgs/imhex/patches/no-update-check.patch

91 lines
4.2 KiB
Diff
Raw Normal View History

running the internal update checker is pointless when updates are managed by xbps
--- a/ImHex/plugins/builtin/source/content/welcome_screen.cpp
+++ b/ImHex/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/ImHex/plugins/builtin/source/content/settings_entries.cpp
+++ b/ImHex/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/ImHex/main/source/init/tasks.cpp
+++ b/ImHex/main/source/init/tasks.cpp
@@ -24,30 +24,6 @@
using namespace std::literals::string_literals;
- static bool checkForUpdates() {
- // 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 == 1){
- hex::Net net;
-
- auto releases = net.getJson(GitHubApiURL + "/releases/latest"s, 2000).get();
- if (releases.code != 200)
- return false;
-
- if (!releases.body.contains("tag_name") || !releases.body["tag_name"].is_string())
- return false;
-
- auto versionString = std::string(IMHEX_VERSION);
- size_t versionLength = std::min(versionString.find_first_of('-'), versionString.length());
- auto currVersion = "v" + versionString.substr(0, versionLength);
- auto latestVersion = releases.body["tag_name"].get<std::string_view>();
-
- if (latestVersion != currVersion)
- ImHexApi::System::impl::addInitArgument("update-available", latestVersion.data());
-
- }
- return true;
- }
bool createDirectories() {
bool result = true;
@@ -283,7 +283,6 @@
{ "Creating directories", createDirectories, false },
{ "Loading settings", loadSettings, false },
{ "Loading plugins", loadPlugins, false },
- { "Checking for updates", checkForUpdates, true },
{ "Loading fonts", loadFonts, true },
};
}