Skip to content

Commit

Permalink
Respect skipAutoUpdateCheck in nextcloud.cfg with Sparkle on macOS
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
  • Loading branch information
claucambra committed Jul 15, 2022
1 parent bceae89 commit f2dbcea
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/gui/updater/sparkleupdater_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <AppKit/NSApplication.h>

#include "common/utility.h"
#include "configfile.h"
#include "updater/sparkleupdater.h"

@interface DelegateObject : NSObject <SUUpdaterDelegate>
Expand Down Expand Up @@ -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;
}


Expand Down

0 comments on commit f2dbcea

Please sign in to comment.