mapbox-gl-native
mapbox-gl-native copied to clipboard
Merge MGLNetworkConfiguration into MGLAccountManager
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 https://github.com/mapbox/mapbox-gl-native/pull/6709#issuecomment-253942073 /cc @lloydsheng @m-stephen
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
I am working on this in https://github.com/mapbox/mapbox-gl-native/pull/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
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
We’ve extended MGLNetworkConfiguration
a tiny bit since the opening of this issue, but it seems like something that should still be considered.
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.