5
// Created by Evan Schoenberg on 7/6/06.
8
#import "SUStatusChecker.h"
10
#import "SUAppcastItem.h"
12
@interface SUStatusChecker (Private)
13
- (id)initForDelegate:(id<SUStatusCheckerDelegate>)inDelegate;
14
- (void)checkForUpdatesAndNotify:(BOOL)verbosity;
15
- (BOOL)newVersionAvailable;
18
@implementation SUStatusChecker
20
+ (SUStatusChecker *)statusCheckerForDelegate:(id<SUStatusCheckerDelegate>)inDelegate;
22
SUStatusChecker *statusChecker = [[self alloc] initForDelegate:inDelegate];
24
return [statusChecker autorelease];
27
- (id)initForDelegate:(id<SUStatusCheckerDelegate>)inDelegate
31
scDelegate = [inDelegate retain];
33
[self checkForUpdatesAndNotify:NO];
40
[scDelegate release]; scDelegate = nil;
45
- (void)applicationDidFinishLaunching:(NSNotification *)note
47
//Take no action when the application finishes launching
50
- (void)appcastDidFinishLoading:(SUAppcast *)ac
54
if (!ac) { [NSException raise:@"SUAppcastException" format:@"Couldn't get a valid appcast from the server."]; }
56
updateItem = [[ac newestItem] retain];
59
if (![updateItem fileVersion])
61
[NSException raise:@"SUAppcastException" format:@"Can't extract a version string from the appcast feed. The filenames should look like YourApp_1.5.tgz, where 1.5 is the version number."];
64
[scDelegate statusChecker:self
65
foundVersion:[updateItem fileVersion]
66
isNewVersion:[self newVersionAvailable]];
68
@catch (NSException *e)
72
[scDelegate statusChecker:self foundVersion:nil isNewVersion:NO];
75
updateInProgress = NO;