Fix the default updates feed URL setting, and override the current setting if it matches the former default

CQTexperiment
Chris Moeller 2013-10-22 17:46:33 -07:00
parent 64149aa8c5
commit 591730eea3
1 changed files with 7 additions and 1 deletions

View File

@ -478,7 +478,9 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
[userDefaultsValuesDict setObject:[NSNumber numberWithBool:YES] forKey:@"remoteEnabled"];
[userDefaultsValuesDict setObject:[NSNumber numberWithBool:YES] forKey:@"remoteOnlyOnActive"];
[userDefaultsValuesDict setObject:@"https://kode54.net/cog/stable.xml" forKey:@"SUFeedURL"];
NSString * feedURLdefault = @"https://kode54.net/cog/mercury.xml";
NSString * feedURLbroken = @"https://kode54.net/cog/stable.xml";
[userDefaultsValuesDict setObject:feedURLdefault forKey:@"SUFeedURL"];
[userDefaultsValuesDict setObject:@"clearAndPlay" forKey:@"openingFilesBehavior"];
@ -493,6 +495,10 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
//Register and sync defaults
[[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsValuesDict];
[[NSUserDefaults standardUserDefaults] synchronize];
//And if the existing feed URL is broken due to my ineptitude with the above defaults, fix it
if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"SUFeedURL"] isEqualToString:feedURLbroken])
[[NSUserDefaults standardUserDefaults] setValue:feedURLdefault forKey:@"SUFeedURL"];
//Add observers
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyPlayKeyCode" options:0 context:nil];