From f2dbceaee04951529c66515f238538832c246dcd Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 11 Jul 2022 12:09:12 +0200 Subject: [PATCH] Respect skipAutoUpdateCheck in nextcloud.cfg with Sparkle on macOS Signed-off-by: Claudio Cambra --- src/gui/updater/sparkleupdater_mac.mm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gui/updater/sparkleupdater_mac.mm b/src/gui/updater/sparkleupdater_mac.mm index 718a1e5e9c341..a4e7104247893 100644 --- a/src/gui/updater/sparkleupdater_mac.mm +++ b/src/gui/updater/sparkleupdater_mac.mm @@ -19,6 +19,7 @@ #include #include "common/utility.h" +#include "configfile.h" #include "updater/sparkleupdater.h" @interface DelegateObject : NSObject @@ -119,17 +120,23 @@ - (void)updater:(SUUpdater *)updater didFinishLoadingAppcast:(SUAppcast *)appcas [d->updater setFeedURL: nsurl]; } -// FIXME: Should be changed to not instanicate the SparkleUpdater at all in this case +// FIXME: Should be changed to not instantiate the SparkleUpdater at all in this case bool autoUpdaterAllowed() { // See https://github.com/owncloud/client/issues/2931 NSString *bundlePath = [[NSBundle mainBundle] bundlePath]; NSString *expectedPath = [NSString stringWithFormat:@"/Applications/%@", [bundlePath lastPathComponent]]; - if ([expectedPath isEqualTo:bundlePath]) { - return true; + if (![expectedPath isEqualTo:bundlePath]) { + qCWarning(lcUpdater) << "We are not in /Applications, won't check for update!"; + return false; } - qCWarning(lcUpdater) << "We are not in /Applications, won't check for update!"; - return false; + + if(ConfigFile().skipUpdateCheck()) { + qCWarning(lcUpdater) << "Auto-updating has been set to skip in nextcloud.cfg, won't check for update."; + return false; + } + + return true; }