diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/app/MBXState.m | 17 | ||||
-rw-r--r-- | platform/ios/app/MBXStateManager.m | 11 |
2 files changed, 20 insertions, 8 deletions
diff --git a/platform/ios/app/MBXState.m b/platform/ios/app/MBXState.m index 49ccd67e8d..0365306637 100644 --- a/platform/ios/app/MBXState.m +++ b/platform/ios/app/MBXState.m @@ -21,9 +21,9 @@ NSString *const MBXReuseQueueStatsEnabled = @"MBXReuseQueueStatsEnabled"; - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeObject:_camera forKey:MBXCamera]; - [coder encodeObject:[NSNumber numberWithInt:_userTrackingMode] forKey:MBXUserTrackingMode]; + [coder encodeObject:[NSNumber numberWithUnsignedInteger:_userTrackingMode] forKey:MBXUserTrackingMode]; [coder encodeBool:_showsUserLocation forKey:MBXShowsUserLocation]; - [coder encodeObject:[NSNumber numberWithInt:_debugMask] forKey:MBXDebugMaskValue]; + [coder encodeObject:[NSNumber numberWithUnsignedInteger:_debugMask] forKey:MBXDebugMaskValue]; [coder encodeBool:_showsZoomLevelOrnament forKey:MBXShowsZoomLevelOrnament]; [coder encodeBool:_showsTimeFrameGraph forKey:MBXShowsTimeFrameGraph]; [coder encodeBool:_debugLoggingEnabled forKey:MBXDebugLoggingEnabled]; @@ -68,7 +68,18 @@ NSString *const MBXReuseQueueStatsEnabled = @"MBXReuseQueueStatsEnabled"; } - (NSString*) debugDescription { - return [NSString stringWithFormat:@"Camera: %@\nTracking mode: %lu\nShows user location: %@\nDebug mask value: %lu\nShows zoom level ornament: %@\nShows time frame graph: %@\nDebug logging enabled: %@\nShows map scale: %@\nShows user heading indicator: %@\nFramerate measurement enabled: %@", self.camera, (unsigned long)self.userTrackingMode, (self.showsUserLocation) ? @"YES" : @"NO", (unsigned long)self.debugMask, (self.showsZoomLevelOrnament) ? @"YES" : @"NO", (self.showsTimeFrameGraph) ? @"YES" : @"NO", (self.debugLoggingEnabled) ? @"YES" : @"NO", (self.showsMapScale) ? @"YES" : @"NO", (self.showsUserHeadingIndicator) ? @"YES" : @"NO", (self.framerateMeasurementEnabled) ? @"YES" : @"NO", (self.reuseQueueStatsEnabled) ? @"YES" : @"NO"]; + return [NSString stringWithFormat:@"Camera: %@\nTracking mode: %lu\nShows user location: %@\nDebug mask value: %lu\nShows zoom level ornament: %@\nShows time frame graph: %@\nDebug logging enabled: %@\nShows map scale: %@\nShows user heading indicator: %@\nFramerate measurement enabled: %@\nReuse queue stats enabled: %@", + self.camera, + (unsigned long)self.userTrackingMode, + self.showsUserLocation ? @"YES" : @"NO", + (unsigned long)self.debugMask, + self.showsZoomLevelOrnament ? @"YES" : @"NO", + self.showsTimeFrameGraph ? @"YES" : @"NO", + self.debugLoggingEnabled ? @"YES" : @"NO", + self.showsMapScale ? @"YES" : @"NO", + self.showsUserHeadingIndicator ? @"YES" : @"NO", + self.framerateMeasurementEnabled ? @"YES" : @"NO", + self.reuseQueueStatsEnabled ? @"YES" : @"NO"]; } @end diff --git a/platform/ios/app/MBXStateManager.m b/platform/ios/app/MBXStateManager.m index 679a4a075f..7203ae462d 100644 --- a/platform/ios/app/MBXStateManager.m +++ b/platform/ios/app/MBXStateManager.m @@ -3,6 +3,8 @@ #import "MBXState.h" #import "MBXViewController.h" +static NSString * const MBXStateManagerMapStateKey = @"mapStateKey"; + @interface MBXStateManager() @property (strong, nonatomic) MBXState *currentState; @@ -22,20 +24,19 @@ } - (MBXState*)currentState { - NSData *encodedMapState = [[NSUserDefaults standardUserDefaults] objectForKey:@"mapStateKey"]; - MBXState *currentState = (MBXState *)[NSKeyedUnarchiver unarchiveObjectWithData: encodedMapState]; + NSData *encodedMapState = [[NSUserDefaults standardUserDefaults] objectForKey:MBXStateManagerMapStateKey]; + MBXState *currentState = (MBXState *)[NSKeyedUnarchiver unarchiveObjectWithData:encodedMapState]; return currentState; } - (void)saveState:(MBXState*)mapState { NSData *encodedMapState = [NSKeyedArchiver archivedDataWithRootObject:mapState]; - [[NSUserDefaults standardUserDefaults] setObject:encodedMapState forKey:@"mapStateKey"]; - [[NSUserDefaults standardUserDefaults] synchronize]; + [[NSUserDefaults standardUserDefaults] setObject:encodedMapState forKey:MBXStateManagerMapStateKey]; } - (void)resetState { - [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"mapStateKey"]; + [[NSUserDefaults standardUserDefaults] removeObjectForKey:MBXStateManagerMapStateKey]; } |