Initialize Sparkle on application launch and add delegate methods

This commit is contained in:
Corey Johnson & Nathan Sobo
2013-01-23 15:18:18 -08:00
parent d7137c980f
commit ed532e552e

View File

@@ -4,6 +4,7 @@
#import "native/atom_window_controller.h"
#import "native/atom_cef_app.h"
#import <getopt.h>
#import <Sparkle/Sparkle.h>
@implementation AtomApplication
@@ -221,6 +222,11 @@
}
- (void)applicationWillFinishLaunching:(NSNotification *)notification {
SUUpdater.sharedUpdater.delegate = self;
SUUpdater.sharedUpdater.automaticallyChecksForUpdates = YES;
SUUpdater.sharedUpdater.automaticallyDownloadsUpdates = YES;
[SUUpdater.sharedUpdater checkForUpdatesInBackground];
_backgroundWindowController = [[AtomWindowController alloc] initInBackground];
if ([self.arguments objectForKey:@"benchmark"]) {
[self runBenchmarksThenExit:true];
@@ -260,4 +266,26 @@
}
}
#pragma mark SUUpdaterDelegate
- (void)updaterDidNotFindUpdate:(SUUpdater *)update {
NSLog(@"No update found");
}
- (void)updater:(SUUpdater *)updater didFindValidUpdate:(SUAppcastItem *)update {
NSLog(@"Found Update");
}
- (void)updater:(SUUpdater *)updater willExtractUpdate:(SUAppcastItem *)update {
NSLog(@"Extract update");
}
- (void)updater:(SUUpdater *)updater willInstallUpdateOnQuit:(SUAppcastItem *)update immediateInstallationInvocation:(NSInvocation *)invocation {
NSLog(@"Install Update");
}
- (void)updater:(SUUpdater *)updater didCancelInstallUpdateOnQuit:(SUAppcastItem *)update {
NSLog(@"Cancel Update Install");
}
@end