#1225 - Restoring MapboxGL.h as an Umbrella header file by splitting the singleton code into MGLAccountManager.h and .m

This commit is contained in:
Brad Leege
2015-05-04 16:13:18 -05:00
parent f96046103f
commit 0e36bf1c8d
7 changed files with 17 additions and 15 deletions

View File

@@ -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',

View File

@@ -0,0 +1,6 @@
@interface MGLAccountManager : NSObject
+ (instancetype) sharedInstanceWithAccessToken:(NSString *)token;
+ (NSString *) getAccessToken;
@end

View File

@@ -2,10 +2,4 @@
#import "MGLMapView.h"
#import "MGLTypes.h"
#import "MGLUserLocation.h"
@interface MapboxGL : NSObject
+ (instancetype) sharedInstanceWithAccessToken:(NSString *)token;
+ (NSString *) getAccessToken;
@end
#import "MGLAccountManager.h"

View File

@@ -1,6 +1,7 @@
#import "MBXAppDelegate.h"
#import "MBXViewController.h"
#import <mbgl/ios/MapboxGL.h>
#import <mbgl/ios/MGLAccountManager.h>
#import <mbgl/ios/MGLMapboxEvents.h>
@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]];

View File

@@ -1,19 +1,19 @@
#import <Foundation/Foundation.h>
#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.

View File

@@ -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;
}