mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Only instantiate sparkle updater if autoupdating is available
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
5f9837b2b2
commit
c9275743d1
@ -36,6 +36,8 @@ public:
|
||||
SparkleUpdater(const QUrl &appCastUrl);
|
||||
~SparkleUpdater();
|
||||
|
||||
static bool autoUpdaterAllowed();
|
||||
|
||||
void setUpdateUrl(const QUrl &url);
|
||||
|
||||
// unused in this updater
|
||||
|
||||
@ -260,8 +260,7 @@ void SparkleUpdater::setUpdateUrl(const QUrl &url)
|
||||
[_interface->updater setFeedURL: nsurl];
|
||||
}
|
||||
|
||||
// FIXME: Should be changed to not instantiate the SparkleUpdater at all in this case
|
||||
bool autoUpdaterAllowed()
|
||||
bool SparkleUpdater::autoUpdaterAllowed()
|
||||
{
|
||||
// See https://github.com/owncloud/client/issues/2931
|
||||
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
|
||||
|
||||
@ -57,7 +57,9 @@ QUrl Updater::updateUrl()
|
||||
auto urlQuery = getQueryParams();
|
||||
|
||||
#if defined(Q_OS_MAC) && defined(HAVE_SPARKLE)
|
||||
urlQuery.addQueryItem(QLatin1String("sparkle"), QLatin1String("true"));
|
||||
if (SparkleUpdater::autoUpdaterAllowed()) {
|
||||
urlQuery.addQueryItem(QLatin1String("sparkle"), QLatin1String("true"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
@ -142,7 +144,11 @@ Updater *Updater::create()
|
||||
}
|
||||
|
||||
#if defined(Q_OS_MACOS) && defined(HAVE_SPARKLE) && defined(BUILD_OWNCLOUD_OSX_BUNDLE)
|
||||
return new SparkleUpdater(url);
|
||||
if (SparkleUpdater::autoUpdaterAllowed()) {
|
||||
return new SparkleUpdater(url);
|
||||
}
|
||||
|
||||
return new PassiveUpdateNotifier(url);
|
||||
#elif defined(Q_OS_WIN32)
|
||||
// Also for MSI
|
||||
return new NSISUpdater(url);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user