diff options
author | Jason Wray <friedbunny@users.noreply.github.com> | 2019-08-20 17:21:55 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-20 17:21:55 -0700 |
commit | 2f43a7b87b7d12298318cb6611ac9a7ef8868b09 (patch) | |
tree | 7344345ae5e93ded64814f63f33667a3df38ae82 /platform/darwin/src | |
parent | 5d1ed5d94194bcbd8c0a66e43e1f10eee0d5f278 (diff) | |
download | qtlocation-mapboxgl-2f43a7b87b7d12298318cb6611ac9a7ef8868b09.tar.gz |
[ios] Updates for offline pricing
Diffstat (limited to 'platform/darwin/src')
-rw-r--r-- | platform/darwin/src/MGLOfflineStorage.h | 10 | ||||
-rw-r--r-- | platform/darwin/src/http_file_source.mm | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/platform/darwin/src/MGLOfflineStorage.h b/platform/darwin/src/MGLOfflineStorage.h index 1ed364ddf3..d093bb938a 100644 --- a/platform/darwin/src/MGLOfflineStorage.h +++ b/platform/darwin/src/MGLOfflineStorage.h @@ -173,6 +173,11 @@ typedef NS_ENUM(NSUInteger, MGLResourceKind) { packs and ambient caching. All of this class’s instance methods are asynchronous, reflecting the fact that offline resources are stored in a database. The shared object maintains a canonical collection of offline packs in its `packs` property. + + Mapbox resources downloaded via this API 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. #### Related examples See the <a href="https://docs.mapbox.com/ios/maps/examples/offline-pack/"> @@ -341,8 +346,7 @@ MGL_EXPORT attempt to download additional tiles until already downloaded tiles are removed by calling the `-removePack:withCompletionHandler:` method. - @note The <a href="https://www.mapbox.com/tos/">Mapbox Terms of Service</a> - prohibits changing or bypassing this limit without permission from Mapbox. + @param maximumCount The maximum number of tiles allowed to be downloaded. */ - (void)setMaximumAllowedMapboxTiles:(uint64_t)maximumCount; @@ -420,7 +424,7 @@ MGL_EXPORT - (void)resetDatabaseWithCompletionHandler:(void (^)(NSError *_Nullable error))completion; -/* +/** Inserts the provided resource into the ambient cache. This method mimics the caching that would take place if the equivalent resource diff --git a/platform/darwin/src/http_file_source.mm b/platform/darwin/src/http_file_source.mm index 5737d8b999..c2ed065ed8 100644 --- a/platform/darwin/src/http_file_source.mm +++ b/platform/darwin/src/http_file_source.mm @@ -205,13 +205,13 @@ NSURL *resourceURLWithAccountType(const Resource& resource, NSInteger accountTyp if (accountType == 0 && ([url.host isEqualToString:@"mapbox.com"] || [url.host hasSuffix:@".mapbox.com"])) { NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO]; - NSURLQueryItem *accountsQueryItem = [NSURLQueryItem queryItemWithName:@"sku" value:MGLAccountManager.skuToken]; - - NSMutableArray *queryItems = [NSMutableArray arrayWithObject:accountsQueryItem]; - - // offline here + NSMutableArray *queryItems = [NSMutableArray array]; + if (resource.usage == Resource::Usage::Offline) { [queryItems addObject:[NSURLQueryItem queryItemWithName:@"offline" value:@"true"]]; + } else { + // Only add SKU token to requests not tagged as "offline" usage. + [queryItems addObject:[NSURLQueryItem queryItemWithName:@"sku" value:MGLAccountManager.skuToken]]; } if (components.queryItems) { |