From 7a95b6829c333c6bac15beacb9a7a5e3a61f0624 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 15 Sep 2020 15:55:55 -0400 Subject: [PATCH] Add "checkAppUpdates" setting. --- include/settings.hpp | 1 + src/library.cpp | 10 ++++++---- src/settings.cpp | 7 +++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/settings.hpp b/include/settings.hpp index ed378eb9..73a96ac1 100644 --- a/include/settings.hpp +++ b/include/settings.hpp @@ -53,6 +53,7 @@ extern std::list recentPatchPaths; extern std::vector cableColors; // pluginSlug -> moduleSlugs extern std::map> moduleWhitelist; +extern bool checkAppUpdates; json_t* toJson(); void fromJson(json_t* rootJ); diff --git a/src/library.cpp b/src/library.cpp index 758d3d7c..1ec79561 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -23,10 +23,12 @@ void init() { if (settings::devMode) return; - std::thread t([&]() { - queryAppUpdate(); - }); - t.detach(); + if (settings::checkAppUpdates) { + std::thread t([&]() { + queryAppUpdate(); + }); + t.detach(); + } std::thread t2([&] { queryUpdates(); diff --git a/src/settings.cpp b/src/settings.cpp index 7c36ec5d..b3325d13 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -50,6 +50,7 @@ std::vector cableColors = { color::fromHexString("#8c1889ff"), // purple }; std::map> moduleWhitelist = {}; +bool checkAppUpdates = true; json_t* toJson() { @@ -119,6 +120,8 @@ json_t* toJson() { } json_object_set_new(rootJ, "moduleWhitelist", moduleWhitelistJ); + json_object_set_new(rootJ, "checkAppUpdates", json_boolean(checkAppUpdates)); + return rootJ; } @@ -242,6 +245,10 @@ void fromJson(json_t* rootJ) { } } } + + json_t* checkAppUpdatesJ = json_object_get(rootJ, "checkAppUpdates"); + if (checkAppUpdatesJ) + checkAppUpdates = json_boolean_value(checkAppUpdatesJ); } void save(const std::string& path) {