From 0e36bf1c8d620b55db1171a1575350e7e4ac699f Mon Sep 17 00:00:00 2001 From: Brad Leege Date: Mon, 4 May 2015 16:13:18 -0500 Subject: [PATCH] #1225 - Restoring MapboxGL.h as an Umbrella header file by splitting the singleton code into MGLAccountManager.h and .m --- gyp/platform-ios.gypi | 3 ++- include/mbgl/ios/MGLAccountManager.h | 6 ++++++ include/mbgl/ios/MapboxGL.h | 8 +------- ios/app/MBXAppDelegate.m | 3 ++- platform/ios/{MapboxGL.m => MGLAccountManager.m} | 8 ++++---- platform/ios/MGLMapView.mm | 2 +- test/ios/KIF | 2 +- 7 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 include/mbgl/ios/MGLAccountManager.h rename platform/ios/{MapboxGL.m => MGLAccountManager.m} (89%) diff --git a/gyp/platform-ios.gypi b/gyp/platform-ios.gypi index 142896c4e..305fd5284 100644 --- a/gyp/platform-ios.gypi +++ b/gyp/platform-ios.gypi @@ -17,12 +17,13 @@ '../platform/darwin/image.mm', '../platform/darwin/reachability.m', '../include/mbgl/ios/MapboxGL.h', - '../platform/ios/MapboxGL.m', '../include/mbgl/ios/MGLMapboxEvents.h', '../platform/ios/MGLMapboxEvents.m', '../include/mbgl/ios/MGLMapView.h', '../include/mbgl/ios/MGLMapView+IBAdditions.h', '../platform/ios/MGLMapView.mm', + '../include/mbgl/ios/MGLAccountManager.h', + '../platform/ios/MGLAccountManager.m', '../include/mbgl/ios/MGLAnnotation.h', '../include/mbgl/ios/MGLUserLocation.h', '../platform/ios/MGLUserLocation_Private.h', diff --git a/include/mbgl/ios/MGLAccountManager.h b/include/mbgl/ios/MGLAccountManager.h new file mode 100644 index 000000000..aed2536a3 --- /dev/null +++ b/include/mbgl/ios/MGLAccountManager.h @@ -0,0 +1,6 @@ +@interface MGLAccountManager : NSObject + ++ (instancetype) sharedInstanceWithAccessToken:(NSString *)token; ++ (NSString *) getAccessToken; + +@end \ No newline at end of file diff --git a/include/mbgl/ios/MapboxGL.h b/include/mbgl/ios/MapboxGL.h index 8470591d5..34e080a51 100644 --- a/include/mbgl/ios/MapboxGL.h +++ b/include/mbgl/ios/MapboxGL.h @@ -2,10 +2,4 @@ #import "MGLMapView.h" #import "MGLTypes.h" #import "MGLUserLocation.h" - -@interface MapboxGL : NSObject - -+ (instancetype) sharedInstanceWithAccessToken:(NSString *)token; -+ (NSString *) getAccessToken; - -@end \ No newline at end of file +#import "MGLAccountManager.h" \ No newline at end of file diff --git a/ios/app/MBXAppDelegate.m b/ios/app/MBXAppDelegate.m index 4d314483a..0a81e83fb 100644 --- a/ios/app/MBXAppDelegate.m +++ b/ios/app/MBXAppDelegate.m @@ -1,6 +1,7 @@ #import "MBXAppDelegate.h" #import "MBXViewController.h" #import +#import #import @implementation MBXAppDelegate @@ -20,7 +21,7 @@ } if ( ! accessToken) NSLog(@"No access token set. Mapbox vector tiles won't work."); - [MapboxGL sharedInstanceWithAccessToken:accessToken]; + [MGLAccountManager sharedInstanceWithAccessToken:accessToken]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[MBXViewController new]]; diff --git a/platform/ios/MapboxGL.m b/platform/ios/MGLAccountManager.m similarity index 89% rename from platform/ios/MapboxGL.m rename to platform/ios/MGLAccountManager.m index 7c542cb36..d408ba8d4 100644 --- a/platform/ios/MapboxGL.m +++ b/platform/ios/MGLAccountManager.m @@ -1,19 +1,19 @@ #import -#import "MapboxGL.h" +#import "MGLAccountManager.h" #import "NSProcessInfo+MGLAdditions.h" #import "MGLMapboxEvents.h" -@interface MapboxGL() +@interface MGLAccountManager() @property (atomic) NSString *accessToken; @end -@implementation MapboxGL +@implementation MGLAccountManager -static MapboxGL *_sharedManager; +static MGLAccountManager *_sharedManager; // Can be called from any thread. Called implicitly from any // public class convenience methods. diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index e48b3d82d..b915fa01f 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -123,7 +123,7 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr; if (self && [self commonInit]) { self.styleURL = nil; - self.accessToken = [MapboxGL getAccessToken]; + self.accessToken = [MGLAccountManager getAccessToken]; return self; } diff --git a/test/ios/KIF b/test/ios/KIF index ab5a46ff7..976aafa2e 160000 --- a/test/ios/KIF +++ b/test/ios/KIF @@ -1 +1 @@ -Subproject commit ab5a46ff7e970de5578df48a1e1f013bd5e1bd4e +Subproject commit 976aafa2e211dd095411bfef09da6c0919d70476