Merge pull request #83 from nevack/nevack/broken-feed-urls-set
Use NSSet for broken feed URL lookup.CQTexperiment
commit
891576365b
|
@ -373,12 +373,8 @@
|
||||||
[userDefaultsValuesDict setObject:[NSNumber numberWithInt:(NSEventModifierFlagControl|NSEventModifierFlagCommand)] forKey:@"hotKeySpamModifiers"];
|
[userDefaultsValuesDict setObject:[NSNumber numberWithInt:(NSEventModifierFlagControl|NSEventModifierFlagCommand)] forKey:@"hotKeySpamModifiers"];
|
||||||
|
|
||||||
NSString *feedURLdefault = @"https://f.losno.co/cog/mercury.xml";
|
NSString *feedURLdefault = @"https://f.losno.co/cog/mercury.xml";
|
||||||
NSString * feedURLbroken = @"https://kode54.net/cog/stable.xml";
|
|
||||||
NSString * feedURLbroken2 = @"https://kode54.net/cog/mercury.xml";
|
|
||||||
NSString * feedURLbroken3 = @"https://www.kode54.net/cog/mercury.xml";
|
|
||||||
[userDefaultsValuesDict setObject:feedURLdefault forKey:@"SUFeedURL"];
|
[userDefaultsValuesDict setObject:feedURLdefault forKey:@"SUFeedURL"];
|
||||||
|
|
||||||
|
|
||||||
[userDefaultsValuesDict setObject:@"clearAndPlay" forKey:@"openingFilesBehavior"];
|
[userDefaultsValuesDict setObject:@"clearAndPlay" forKey:@"openingFilesBehavior"];
|
||||||
[userDefaultsValuesDict setObject:@"enqueue" forKey:@"openingFilesAlteredBehavior"];
|
[userDefaultsValuesDict setObject:@"enqueue" forKey:@"openingFilesAlteredBehavior"];
|
||||||
|
|
||||||
|
@ -401,10 +397,15 @@
|
||||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||||
|
|
||||||
//And if the existing feed URL is broken due to my ineptitude with the above defaults, fix it
|
//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] ||
|
NSSet<NSString *> *brokenFeedURLs = [NSSet setWithObjects:
|
||||||
[[[NSUserDefaults standardUserDefaults] stringForKey:@"SUFeedURL"] isEqualToString:feedURLbroken2] ||
|
@"https://kode54.net/cog/stable.xml",
|
||||||
[[[NSUserDefaults standardUserDefaults] stringForKey:@"SUFeedURL"] isEqualToString:feedURLbroken3])
|
@"https://kode54.net/cog/mercury.xml"
|
||||||
|
@"https://www.kode54.net/cog/mercury.xml",
|
||||||
|
nil];
|
||||||
|
NSString *feedURL = [[NSUserDefaults standardUserDefaults] stringForKey:@"SUFeedURL"];
|
||||||
|
if ([brokenFeedURLs containsObject:feedURL]) {
|
||||||
[[NSUserDefaults standardUserDefaults] setValue:feedURLdefault forKey:@"SUFeedURL"];
|
[[NSUserDefaults standardUserDefaults] setValue:feedURLdefault forKey:@"SUFeedURL"];
|
||||||
|
}
|
||||||
|
|
||||||
//Add observers
|
//Add observers
|
||||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyPlayKeyCode" options:0 context:nil];
|
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyPlayKeyCode" options:0 context:nil];
|
||||||
|
|
Loading…
Reference in New Issue