-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] [android] - configurable API endpoint #6309
Conversation
@@ -152,30 +152,34 @@ OnlineFileSource::~OnlineFileSource() = default; | |||
|
|||
std::unique_ptr<AsyncRequest> OnlineFileSource::request(const Resource& resource, Callback callback) { | |||
Resource res = resource; | |||
|
|||
if(apiBaseURL.empty()){ |
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.
Set the default value to mbgl::util::API_BASE_URL
instead of checking for the empty string.
Thanks @jfirebaugh for 👀 , the remarks have been fixed in ad5f363. |
@@ -957,6 +978,8 @@ public boolean equals(Object o) { | |||
if (!Arrays.equals(myLocationBackgroundPadding, options.myLocationBackgroundPadding)) | |||
return false; | |||
if (style != null ? !style.equals(options.style) : options.style != null) return false; | |||
if (apiBaseUrl != null ? !apiBaseUrl.equals(options.apiBaseUrl) : options.apiBaseUrl != null) |
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.
@tobrun This is very hard to read, could you split it up?
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.
This is generated code from intelij or actually it's copied code from intelij. The correct way should be to regenerate the hashcode/equals method.. Will pick this up with other remarks but I'm not taking readability into account with generated code.
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.
@tobrun Sorry, I missed this was generated code. Scratch my comment.
This PR is missing unit tests for a new core API. ;-) |
011ef9e
to
4db1f6d
Compare
@tmpsantos I fixed up the comments and added a tests in 4db1f6d. |
4db1f6d
to
a65b937
Compare
Tracking the necessary iOS/macOS SDK changes in #6346. |
a65b937
to
ee14d3b
Compare
Need to fix the tests for glfw, the tests are missing runloop |
@tmpsantos thanks for the hint on RunLoop. |
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.
Thanks for this and thanks for also adding new tests!
@@ -409,10 +409,9 @@ TEST(OnlineFileSource, ChangeAPIBaseURL){ | |||
util::RunLoop loop; | |||
OnlineFileSource fs; | |||
|
|||
loop.run(); |
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.
Would be great if you could split the PR in two or three commits:
- One adding the API to core
- One adding the API to android
- One adding the tests
This makes reviewing a lot easier, since reviewing is usually done "per commit". You can do this next time, but for now I'm fine squashing everything into a single commit. The last two are fixing something on the first one, so they don't really add value to the PR.
5825a6c
to
02d8e0e
Compare
@@ -10,85 +11,85 @@ using namespace mbgl; | |||
TEST(Mapbox, SourceURL) { | |||
EXPECT_EQ( | |||
"https://api.mapbox.com/v4/user.map.json?access_token=key&secure", | |||
mbgl::util::mapbox::normalizeSourceURL("mapbox://user.map", "key")); | |||
mbgl::util::mapbox::normalizeSourceURL(util::API_BASE_URL, "mapbox://user.map", "key")); |
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.
Nit, extra tab
add runloop to test
02d8e0e
to
57665c7
Compare
This PR enables configuration of a custom URL base endpoint.
Review c++: @jfirebaugh @tmpsantos
Review java: @zugaldia
Side notes vs GL-JS implementation: