diff options
Diffstat (limited to 'platform/darwin/src/MGLAccountManager.m')
-rw-r--r-- | platform/darwin/src/MGLAccountManager.m | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLAccountManager.m b/platform/darwin/src/MGLAccountManager.m index 4a3f698427..d914867628 100644 --- a/platform/darwin/src/MGLAccountManager.m +++ b/platform/darwin/src/MGLAccountManager.m @@ -8,12 +8,14 @@ @interface MGLAccountManager () @property (atomic) NSString *accessToken; +@property (nonatomic) NSURL *apiBaseURL; @end #else @interface MGLAccountManager () @property (atomic) NSString *accessToken; +@property (nonatomic) NSURL *apiBaseURL; @end #endif @@ -28,6 +30,13 @@ if (accessToken.length) { self.accessToken = accessToken; } + + NSString *apiBaseURL = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"MGLMapboxAPIBaseURL"]; + + // If apiBaseURL is not a valid URL, [NSURL URLWithString:] will be `nil`. + if (apiBaseURL.length && [NSURL URLWithString:apiBaseURL]) { + [self setAPIBaseURL:[NSURL URLWithString:apiBaseURL]]; + } } + (instancetype)sharedManager { @@ -71,4 +80,12 @@ return [MGLAccountManager sharedManager].accessToken; } ++ (void)setAPIBaseURL:(NSURL *)apiBaseURL { + [MGLAccountManager sharedManager].apiBaseURL = apiBaseURL; +} + ++ (NSURL *)apiBaseURL { + return [MGLAccountManager sharedManager].apiBaseURL; +} + @end |