Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
#1225 - Restoring MapboxGL.h as an Umbrella header file by splitting …
Browse files Browse the repository at this point in the history
…the singleton code into MGLAccountManager.h and .m
  • Loading branch information
bleege committed May 4, 2015
1 parent f960461 commit 0e36bf1
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 15 deletions.
3 changes: 2 additions & 1 deletion gyp/platform-ios.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions include/mbgl/ios/MGLAccountManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@interface MGLAccountManager : NSObject

+ (instancetype) sharedInstanceWithAccessToken:(NSString *)token;
+ (NSString *) getAccessToken;

@end
8 changes: 1 addition & 7 deletions include/mbgl/ios/MapboxGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 2 additions & 1 deletion ios/app/MBXAppDelegate.m
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -20,7 +21,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
}
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]];
Expand Down
8 changes: 4 additions & 4 deletions platform/ios/MapboxGL.m → platform/ios/MGLAccountManager.m
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion platform/ios/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ - (instancetype)initWithFrame:(CGRect)frame
if (self && [self commonInit])
{
self.styleURL = nil;
self.accessToken = [MapboxGL getAccessToken];
self.accessToken = [MGLAccountManager getAccessToken];
return self;
}

Expand Down
2 changes: 1 addition & 1 deletion test/ios/KIF
Submodule KIF updated from ab5a46 to 976aaf

0 comments on commit 0e36bf1

Please sign in to comment.