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"];
|
||||
|
||||
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:@"clearAndPlay" forKey:@"openingFilesBehavior"];
|
||||
[userDefaultsValuesDict setObject:@"enqueue" forKey:@"openingFilesAlteredBehavior"];
|
||||
|
||||
|
@ -401,10 +397,15 @@
|
|||
[[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] stringForKey:@"SUFeedURL"] isEqualToString:feedURLbroken2] ||
|
||||
[[[NSUserDefaults standardUserDefaults] stringForKey:@"SUFeedURL"] isEqualToString:feedURLbroken3])
|
||||
NSSet<NSString *> *brokenFeedURLs = [NSSet setWithObjects:
|
||||
@"https://kode54.net/cog/stable.xml",
|
||||
@"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"];
|
||||
}
|
||||
|
||||
//Add observers
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyPlayKeyCode" options:0 context:nil];
|
||||
|
|
Loading…
Reference in New Issue