Skip to content

Commit

Permalink
Revert updater
Browse files Browse the repository at this point in the history
  • Loading branch information
vadi2 committed Nov 1, 2017
1 parent 7344b7f commit c196171
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 39 deletions.
43 changes: 6 additions & 37 deletions SparkleAutoUpdater.mm
Original file line number Diff line number Diff line change
@@ -1,60 +1,36 @@
/*
* sparkleautoupdater.mm
*
* Copyright (C) 2008 Remko Troncon.
* See https://github.com/remko/mixing-cocoa-and-qt
* https://el-tramo.be/blog/mixing-cocoa-and-qt
* License: BSD. Assuming 2-clause BSD reference by Sparke based on context:
* https://github.com/sparkle-project/Sparkle/blob/master/LICENSE
* Copyright (C) 2013 Marius Kintel.
* License: MIT License (http://opensource.org/licenses/MIT)
* Copyright (C) 2016 Thorbjørn Lindeijer <bjorn@lindeijer.nl>
* Copyright (C) 2008 Remko Troncon
*/

#include "sparkleautoupdater.h"
#include "SparkleAutoUpdater.h"

#include <Cocoa/Cocoa.h>
#include <Sparkle/Sparkle.h>

#ifdef TILED_SNAPSHOT
static const char appcastUrl[] = "http://update.mapeditor.org/appcast-osx-snapshots.xml";
#else
static const char appcastUrl[] = "https://feeds.dblsqd.com/MKMMR7HNSP65PquQQbiDIw/release/mac/x86_64/appcast";
#endif


class SparkleAutoUpdater::Private
{
public:
NSAutoreleasePool *autoReleasePool;
SUUpdater *updater;
SUUpdater* updater;
};


SparkleAutoUpdater::SparkleAutoUpdater()
: d(new Private)
SparkleAutoUpdater::SparkleAutoUpdater(const QString& aUrl)
{
NSApplicationLoad();
d->autoReleasePool = [[NSAutoreleasePool alloc] init];
d = new Private;

d->updater = [SUUpdater sharedUpdater];
[d->updater retain];

NSURL* url = [NSURL URLWithString:
[NSString stringWithUTF8String: appcastUrl]];
[NSString stringWithUTF8String: aUrl.toUtf8().data()]];
[d->updater setFeedURL: url];
}

SparkleAutoUpdater::~SparkleAutoUpdater()
{
[d->updater release];
[d->autoReleasePool release];
delete d;
}

/**
* Checks for updates using Sparkle.
*/
void SparkleAutoUpdater::checkForUpdates()
{
[d->updater checkForUpdates:nil];
Expand All @@ -79,10 +55,3 @@
{
return [d->updater automaticallyDownloadsUpdates];
}

QDateTime SparkleAutoUpdater::lastUpdateCheckDate()
{
NSDate *date = [d->updater lastUpdateCheckDate];
NSTimeInterval timeInterval = [date timeIntervalSince1970];
return QDateTime::fromMSecsSinceEpoch(timeInterval * 1000);
}
3 changes: 1 addition & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ int main(int argc, char* argv[])
updater = new SparkleAutoUpdater();
#endif
if (updater) {
// updater->checkForUpdates();
qDebug() << updater->lastUpdateCheckDate();
updater->checkForUpdates();
qDebug() << "automaticallyChecksForUpdates" << updater->automaticallyChecksForUpdates();
qDebug() << "automaticallyDownloadsUpdates" << updater->automaticallyDownloadsUpdates();
}
Expand Down

0 comments on commit c196171

Please sign in to comment.