From 5cfd0db4a5e656d383f980c7bb57eac72fbfc606 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 14 Jan 2011 23:43:48 -0500 Subject: [PATCH] Add code to the AppDelegate to record if a user has ever used an unstable VersionCast feed --- Source/AppDelegate.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Source/AppDelegate.m b/Source/AppDelegate.m index 6de017d..e48636f 100644 --- a/Source/AppDelegate.m +++ b/Source/AppDelegate.m @@ -16,6 +16,8 @@ #import "AppDelegate.h" +#import + @implementation AppDelegate @synthesize debugger; @@ -52,6 +54,22 @@ return (AppDelegate*)[NSApp delegate]; } +- (void)applicationDidFinishLaunching:(NSNotification*)notification +{ + // Record whether this user ever used the beta VersionCast feed. In the + // future, we will use this bit to query for unstable releases after the user + // has upgraded to a stable version. + NSString* const kUsesUnstableVersionCast = @"UnstableVersionCast"; + NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; + + BOOL usesUnstable = [defaults boolForKey:kUsesUnstableVersionCast]; + NSURL* feedURL = [[SUUpdater sharedUpdater] feedURL]; + usesUnstable = usesUnstable || + [[feedURL absoluteString] rangeOfString:@"?unstable"].location != NSNotFound; + NSLog(@"usesUnstable = %d", usesUnstable); + [defaults setBool:usesUnstable forKey:kUsesUnstableVersionCast]; +} + - (void)applicationWillTerminate:(NSNotification*)notification { [[NSUserDefaults standardUserDefaults] setBool:self.debugger.connection.attached -- 2.43.5