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

Merge MGLNetworkConfiguration into MGLAccountManager #12417

Open
1ec5 opened this issue Jul 18, 2018 · 5 comments
Open

Merge MGLNetworkConfiguration into MGLAccountManager #12417

1ec5 opened this issue Jul 18, 2018 · 5 comments
Assignees
Labels
gl-ios iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS navigation For the Mapbox Navigation SDK for Android or iOS or navigation use cases in general

Comments

@1ec5
Copy link
Contributor

1ec5 commented Jul 18, 2018

MGLNetworkConfiguration is a singleton that currently does nothing but store the result of looking up the Info.plist’s MGLMapboxAPIBaseURL value. But calling -[NSBundle objectForInfoDictionaryKey:] is really fast, so fast that we could inline the call to -[MGLNetworkConfiguration apiBaseURL:] without affecting performance in an appreciable way.

That said, there is an unused -setAPIBaseURL: method. The ability to set the API base URL on the fly at runtime could be useful for the same reason that the -[MGLMapboxAccountManager setAccessToken:] method is sometimes useful. We don’t guarantee that the developer can swap access tokens out from under an existing map view, but the method does give the developer some flexibility in choosing when to initialize the SDK.

An access token is meaningless without an accompanying API base URL, so we could merge MGLNetworkConfiguration into MGLAccountManager and make the apiBaseURL property public. The Info.plist key would remain as the preferred way to set the API base URL.

/ref #6709 (comment)
/cc @lloydsheng @m-stephen

@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS navigation For the Mapbox Navigation SDK for Android or iOS or navigation use cases in general labels Jul 18, 2018
@stale stale bot added the archived Archived because of inactivity label Jan 14, 2019
@stale
Copy link

stale bot commented Jan 14, 2019

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@jmkiley
Copy link
Contributor

jmkiley commented Jan 18, 2019

I am working on this in #13754.

Because the events library reads the API base URL from the Info.plist, it may not be aware if users do set the API base URL programmatically.

cc @rclee

@stale stale bot added the archived Archived because of inactivity label Jul 17, 2019
@stale
Copy link

stale bot commented Jul 17, 2019

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Jul 17, 2019
@friedbunny
Copy link
Contributor

We’ve extended MGLNetworkConfiguration a tiny bit since the opening of this issue, but it seems like something that should still be considered.

@friedbunny friedbunny reopened this Jul 17, 2019
@stale stale bot removed the archived Archived because of inactivity label Jul 17, 2019
@1ec5
Copy link
Contributor Author

1ec5 commented Oct 28, 2021

By way of an update, #13754 moved the code that reads MGLMapboxAPIBaseURL from the Info.plist from MGLNetworkConfiguration to MGLAccountManager. However, MGLAccountManager.apiBaseURL remains private, and MGLNetworkConfiguration remains and has taken on additional functionality.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
gl-ios iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS navigation For the Mapbox Navigation SDK for Android or iOS or navigation use cases in general
Projects
None yet
Development

No branches or pull requests

4 participants