|
|
@@ -24,6 +24,8 @@ static RASingleton *singleton;
|
|
|
return singleton;
|
|
|
}
|
|
|
|
|
|
+#pragma mark - User
|
|
|
+
|
|
|
- (NSString *)secretKey {
|
|
|
return _secretKey;
|
|
|
}
|
|
|
@@ -107,6 +109,35 @@ static RASingleton *singleton;
|
|
|
[defaults synchronize];
|
|
|
}
|
|
|
|
|
|
+#pragma mark - Location
|
|
|
+
|
|
|
+- (void)setRequiredLocation:(BOOL)requiredLocation {
|
|
|
+ _requiredLocation = requiredLocation;
|
|
|
+
|
|
|
+ NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
+ [defaults setBool:_requiredLocation forKey:@"requiredLocation"];
|
|
|
+ [defaults synchronize];
|
|
|
+
|
|
|
+ [self sendRequiredLocationNotification];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)loadSavedReuqiredLocation { // 启动的时候
|
|
|
+
|
|
|
+ NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
+ _requiredLocation = [defaults objectForKey:@"requiredLocation"];
|
|
|
+
|
|
|
+ [self sendRequiredLocationNotification];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)sendRequiredLocationNotification {
|
|
|
+
|
|
|
+ if (_requiredLocation) {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationStartLocation object:nil];
|
|
|
+ } else {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationStopLocation object:nil];
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
|
|
|
@end
|