blob: a515a79a3cfc77b8757644f777d34427f6b9faf2 [file] [log] [blame]
Alexander Afanasyev749f0652013-09-22 13:03:21 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * @copyright See LICENCE for copyright and license information.
4 *
5 * @author Zhenkai Zhu <zhenkai@cs.ucla.edu>
6 * @author Alexander Afanasyev <alexander.afanasyev@ucla.edu>
7 */
8
9#include "sparkle-auto-update.h"
10
11#import <Foundation/Foundation.h>
12#import <AppKit/AppKit.h>
13#import <Sparkle/Sparkle.h>
14
15class SparkleAutoUpdate::Private
16{
17public:
18 SUUpdater *updater;
19};
20
21SparkleAutoUpdate::SparkleAutoUpdate(const char *updateUrl)
22{
23 d = new Private;
Alexander Afanasyev88f0b3a2013-09-24 23:52:08 -070024 d->updater = [SUUpdater sharedUpdater];
Alexander Afanasyev749f0652013-09-22 13:03:21 -070025 NSURL *url = [NSURL URLWithString: [NSString stringWithCString:updateUrl encoding:NSASCIIStringEncoding]];
26 [d->updater setFeedURL: url];
27 [d->updater setAutomaticallyChecksForUpdates: YES];
28 [d->updater setUpdateCheckInterval: 86400];
29}
30
31SparkleAutoUpdate::~SparkleAutoUpdate()
32{
Alexander Afanasyev88f0b3a2013-09-24 23:52:08 -070033 // [d->updater release];
Alexander Afanasyev749f0652013-09-22 13:03:21 -070034 delete d;
35 // presummably SUUpdater handles garbage collection
36}
37
38void SparkleAutoUpdate::checkForUpdates()
39{
40 //[d->updater checkForUpdatesInBackground];
41 [d->updater checkForUpdates : nil];
42}