[android] Updating HttpRequestUrl to separate offline requests from Maps SKU (#15363)

This commit is contained in:
Langston Smith
2019-08-21 09:48:36 -07:00
committed by Chloe Krawczyk
parent baa7086570
commit 9263cdd856
3 changed files with 13 additions and 6 deletions

View File

@@ -32,6 +32,9 @@ Mapbox welcomes participation and contributions from everyone. If you'd like to
- Fixed an issue where animated camera transitions zoomed in or out too dramatically [#15281](https://github.com/mapbox/mapbox-gl-native/pull/15281)
- Enable variable label placement when `text-allow-overlap` property is set to true [#15354](https://github.com/mapbox/mapbox-gl-native/pull/15354)
## 8.3.0
This release changes how offline tile requests are billed — they are now billed on a pay-as-you-go basis and all developers are able raise the offline tile limit for their users. Offline requests were previously exempt from monthly active user (MAU) billing and increasing the offline per-user tile limit to more than 6,000 tiles required the purchase of an enterprise license. By upgrading to this release, you are opting into the changes outlined in [this blog post](https://blog.mapbox.com/offline-maps-for-all-bb0fc51827be) and [#15380](https://github.com/mapbox/mapbox-gl-native/pull/15380).
## 8.3.0-alpha.2 - August 7, 2019
[Changes](https://github.com/mapbox/mapbox-gl-native/compare/android-v8.3.0-alpha.1...android-v8.3.0-alpha.2) since [Mapbox Maps SDK for Android v8.3.0-alpha.1](https://github.com/mapbox/mapbox-gl-native/releases/tag/android-v8.3.0-alpha.1):

View File

@@ -10,7 +10,10 @@ public class HttpRequestUrl {
}
/**
* Adapts a resource request url based on the host and query size.
* Adapts a resource request url based on the host, query size, and offline requirement.
* Mapbox resources downloaded for offline use are subject to separate Vector Tile and
* Raster Tile API pricing and are not included in the Maps SDK’s “unlimited” requests.
* See <a href="https://www.mapbox.com/pricing">our pricing page</a> for more information.
*
* @param host the host used as endpoint
* @param resourceUrl the resource to download
@@ -25,10 +28,11 @@ public class HttpRequestUrl {
} else {
resourceUrl = resourceUrl + "&";
}
resourceUrl = resourceUrl + "sku=" + Mapbox.getSkuToken();
// Only add SKU token to requests not tagged as "offline" usage.
if (offline) {
resourceUrl = resourceUrl + "&offline=true";
resourceUrl = resourceUrl + "offline=true";
} else {
resourceUrl = resourceUrl + "sku=" + Mapbox.getSkuToken();
}
}
return resourceUrl;

View File

@@ -20,14 +20,14 @@ class HttpRequestUrlTest {
@Test
fun testOfflineFlagMapboxCom() {
val expected = "http://mapbox.com/path/of/no/return.pbf?sku=foobar&offline=true"
val expected = "http://mapbox.com/path/of/no/return.pbf?offline=true"
val actual = HttpRequestUrl.buildResourceUrl("mapbox.com", "http://mapbox.com/path/of/no/return.pbf", 0, true)
assertEquals(expected, actual)
}
@Test
fun testOfflineFlagMapboxCn() {
val expected = "http://mapbox.cn/path/of/no/return.pbf?sku=foobar&offline=true"
val expected = "http://mapbox.cn/path/of/no/return.pbf?offline=true"
val actual = HttpRequestUrl.buildResourceUrl("mapbox.cn", "http://mapbox.cn/path/of/no/return.pbf", 0, true)
assertEquals(expected, actual)
}