-
Notifications
You must be signed in to change notification settings - Fork 1.3k
DefaultFileSource has responsibility for handling mapbox:// URLs #1607
Conversation
Nice! |
At a glance, it looks like this will fix #1334 as well. 👍 |
Liking the direction here 👍 Thinking that breaking out separate |
I also like that the access token is no longer part of the style URL, so if the access token changes at some point during the lifetime of the file source, we don’t have to go updating other fields. This turns out to jive nicely with the last bit of refactoring I’m doing for #1553, where I’m also removing |
The singleton `MGLAccountManager` wants to be the sole arbiter of the access token, but each instance of `mbgl::Map` (`mbgl::DefaultFileSource` in #1607) has its own copy of the access token. Now `MGLMapView` observes for changes to the `MGLAccountManager`’s access token and synchronizes `mbgl::Map` with it.
@@ -148,12 +148,12 @@ - (instancetype)initWithCoder:(NSCoder *)decoder | |||
|
|||
- (NSString *)accessToken | |||
{ | |||
return @(_mbglMap->getAccessToken().c_str()).mgl_stringOrNilIfEmpty; | |||
return @(_mbglFileSource->getAccessToken().c_str()).mgl_stringOrNilIfEmpty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With #1553, MGLMapView
no longer calls getAccessToken()
anywhere.
c7afc7b
to
e5d659a
Compare
Looks good on Android side |
e5d659a
to
87b1da7
Compare
We can revisit this in another pull request. Any particular reason for doing so? We don't actually use these enums anywhere (except as a hint for compressing responses), so we could do away with them as well? |
I would like to avoid interface churn for node-mbgl or whatever the downstream consumer that implements the FileSource interface in node is nowadays. Maybe we can avoid updating it until the FileSource interface is finalized? |
^ This concern will eventually be irrelevant, as the pluggable |
- Document Node.js v0.12.x and io.js support - Document map.release functionality. - Add notes on garbage collection and request handling. - Update binary platforms and build instructions. - Document API token FileSource implementation from mapbox/mapbox-gl-native#1607
- Document Node.js v0.12.x and io.js support - Document map.release functionality. - Add notes on garbage collection and request handling. - Update binary platforms and build instructions. - Document API token FileSource implementation from mapbox/mapbox-gl-native#1607 - Update Kind enum values.
- Document Node.js v0.12.x and io.js support - Document map.release functionality. - Add notes on garbage collection and request handling. - Update binary platforms and build instructions. - Document API token FileSource implementation from mapbox/mapbox-gl-native#1607 - Update Kind enum values.
-> #3374 |
This moves
Map::setAccessToken
toDefaultFileSource::setAccessToken
and passesmapbox://
URLs through theFileSource
interface. No change to the iOS or Android SDK public API. The node bindings will need the following changes (cc @mikemorris):kind
enum.FileSource
implementations need to handlemapbox://
URLs.setAccessToken
fromMap
interface. node-mapbox-gl-native itself no longer needs to concern itself with access tokens. This is a task forFileSource
implementations now.Before merging this I'm planning to make another change to the interface, removing the
kind
enum in favor of specificFileSource
methods likerequestStyle
,requestTile
, etc.