Merge pull request #83 from nevack/nevack/broken-feed-urls-set

Use NSSet for broken feed URL lookup.
CQTexperiment
Christopher Snowhill 2021-01-24 19:30:31 -08:00 committed by GitHub
commit 891576365b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 11 deletions

View File

@ -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];