Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "sparkleautoupdater.h"
- #include "SparkleAutoUpdaterDelegate.h"
- #include <Cocoa/Cocoa.h>
- #include <Sparkle/Sparkle.h>
- namespace app
- {
- const QString SparkleAutoUpdater::APPCAST_URL = "https://botsapp.io/updates/appcast.xml";
- SparkleAutoUpdaterDelegate *__updaterDelegate = nullptr;
- class SparkleAutoUpdater::Private
- {
- public:
- SUUpdater* updater;
- };
- SparkleAutoUpdater::SparkleAutoUpdater()
- {
- __updaterDelegate = [SparkleAutoUpdaterDelegate new];
- d = new Private;
- d->updater = [SUUpdater sharedUpdater];
- [d->updater retain];
- d->updater.delegate = __updaterDelegate;
- NSURL* url = [NSURL URLWithString:
- [NSString stringWithUTF8String: APPCAST_URL.toUtf8().data()]];
- [d->updater setFeedURL: url];
- }
- SparkleAutoUpdater::~SparkleAutoUpdater()
- {
- [d->updater release];
- delete d;
- }
- void SparkleAutoUpdater::checkForUpdates()
- {
- [d->updater setAutomaticallyChecksForUpdates: true];
- [d->updater setAutomaticallyDownloadsUpdates: true];
- [d->updater installUpdatesIfAvailable];
- [d->updater checkForUpdatesInBackground];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement