Created
August 8, 2016 14:21
-
-
Save Li-blog/ede08be14f8b2c6f015bb7004cead853 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)_preferencesChanged { | |
CFStringRef appID = CFSTR("com.wangjinli.weekcountpb"); | |
CFArrayRef keyList = CFPreferencesCopyKeyList(appID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); | |
if (!keyList) { | |
[self attemptSettingFallbackPrefs]; | |
return; | |
} | |
NSDictionary *preferences = (NSDictionary *)CFBridgingRelease(CFPreferencesCopyMultiple(keyList, appID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost)); | |
CFRelease(keyList); | |
if (!preferences) { | |
[self attemptSettingFallbackPrefs]; | |
} | |
_startDateStr = preferences[@"StartDateStr"] ? preferences[@"StartDateStr"] : @"19700101"; | |
_duration = preferences[@"Duration"] ? [(NSNumber*)preferences[@"Duration"] intValue] : 18; | |
_weekStartDay = preferences[@"WeekStartDay"] ? preferences[@"WeekStartDay"] : @"Monday"; | |
_lockScreenEnabled = preferences[@"LockScreenEnabled"] ? [(NSNumber*)preferences[@"LockScreenEnabled"] boolValue] : YES; | |
_nCEnabled = preferences[@"NCEnabled"] ? [(NSNumber*)preferences[@"NCEnabled"] boolValue] : YES; | |
_displayFormat = preferences[@"DisplayFormat"] ? preferences[@"DisplayFormat"] : @"Week \%W"; | |
[self parseDate]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment