summaryrefslogtreecommitdiff
path: root/ios
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-09-08 14:21:03 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-09-16 13:22:16 -0700
commit79dc20808fd4ed72922742fa650a0dd1bbdc9038 (patch)
tree59857a0f2fdb50a5f4b9f0a3a6c80d2e40f4007b /ios
parent4dce45ffc660fc41220c1d2cbb94962ed114e633 (diff)
downloadqtlocation-mapboxgl-79dc20808fd4ed72922742fa650a0dd1bbdc9038.tar.gz
Prefix user defaults in iosapp
We technically don’t need to, but the demo app should practice good hygiene since we expect developers to copy from it.
Diffstat (limited to 'ios')
-rw-r--r--ios/app/MBXViewController.mm22
1 files changed, 11 insertions, 11 deletions
diff --git a/ios/app/MBXViewController.mm b/ios/app/MBXViewController.mm
index d94e41b5f9..bb35a07910 100644
--- a/ios/app/MBXViewController.mm
+++ b/ios/app/MBXViewController.mm
@@ -31,9 +31,9 @@ static NSUInteger const kStyleVersion = 8;
if (self == [MBXViewController class])
{
[[NSUserDefaults standardUserDefaults] registerDefaults:@{
- @"userTrackingMode": @(MGLUserTrackingModeNone),
- @"showsUserLocation": @NO,
- @"debug": @NO,
+ @"MBXUserTrackingMode": @(MGLUserTrackingModeNone),
+ @"MBXShowsUserLocation": @NO,
+ @"MBXDebug": @NO,
}];
}
}
@@ -91,10 +91,10 @@ static NSUInteger const kStyleVersion = 8;
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSData *archivedCamera = [NSKeyedArchiver archivedDataWithRootObject:self.mapView.camera];
- [defaults setObject:archivedCamera forKey:@"camera"];
- [defaults setInteger:self.mapView.userTrackingMode forKey:@"userTrackingMode"];
- [defaults setBool:self.mapView.showsUserLocation forKey:@"showsUserLocation"];
- [defaults setBool:self.mapView.debugActive forKey:@"debug"];
+ [defaults setObject:archivedCamera forKey:@"MBXCamera"];
+ [defaults setInteger:self.mapView.userTrackingMode forKey:@"MBXUserTrackingMode"];
+ [defaults setBool:self.mapView.showsUserLocation forKey:@"MBXShowsUserLocation"];
+ [defaults setBool:self.mapView.debugActive forKey:@"MBXDebug"];
[defaults synchronize];
}
}
@@ -103,21 +103,21 @@ static NSUInteger const kStyleVersion = 8;
{
if (self.mapView) {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- NSData *archivedCamera = [defaults objectForKey:@"camera"];
+ NSData *archivedCamera = [defaults objectForKey:@"MBXCamera"];
MGLMapCamera *camera = archivedCamera ? [NSKeyedUnarchiver unarchiveObjectWithData:archivedCamera] : nil;
if (camera)
{
self.mapView.camera = camera;
}
- NSInteger uncheckedTrackingMode = [defaults integerForKey:@"userTrackingMode"];
+ NSInteger uncheckedTrackingMode = [defaults integerForKey:@"MBXUserTrackingMode"];
if (uncheckedTrackingMode >= 0 &&
(NSUInteger)uncheckedTrackingMode >= MGLUserTrackingModeNone &&
(NSUInteger)uncheckedTrackingMode <= MGLUserTrackingModeFollowWithCourse)
{
self.mapView.userTrackingMode = (MGLUserTrackingMode)uncheckedTrackingMode;
}
- self.mapView.showsUserLocation = [defaults boolForKey:@"showsUserLocation"];
- self.mapView.debugActive = [defaults boolForKey:@"debug"];
+ self.mapView.showsUserLocation = [defaults boolForKey:@"MBXShowsUserLocation"];
+ self.mapView.debugActive = [defaults boolForKey:@"MBXDebug"];
}
}