Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[ios, macos] Include SKU token for offline requests (#16130) (#16133)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmkiley authored and Julian Rex committed Jan 22, 2020
1 parent 6dc435f commit d85ce77
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ jobs:
- install-ios-packaging-dependencies
- run:
name: Build dynamic framework for device and simulator
command: make iframework
command: make iframework BUILD_DOCS=false
no_output_timeout: 5m
- deploy:
name: Upload snapshot build to s3
Expand Down
5 changes: 2 additions & 3 deletions platform/darwin/src/http_file_source.mm
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,9 @@ BOOL isValidMapboxEndpoint(NSURL *url) {

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:MGLNativeNetworkManager.sharedManager.skuToken]];
}

[queryItems addObject:[NSURLQueryItem queryItemWithName:@"sku" value:MGLNativeNetworkManager.sharedManager.skuToken]];

if (components.queryItems) {
[queryItems addObjectsFromArray:components.queryItems];
Expand Down
5 changes: 2 additions & 3 deletions platform/darwin/test/MGLResourceTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@ - (void)testOfflineQueryParameterIsAddedForOfflineResource {
for (NSURLQueryItem *item in components.queryItems) {
if (([item.name isEqualToString:@"offline"] && [item.value isEqualToString:@"true"]) ||
([item.name isEqualToString:@"a"] && [item.value isEqualToString:@"one"]) ||
([item.name isEqualToString:@"b"] && [item.value isEqualToString:@"two"])) {
([item.name isEqualToString:@"b"] && [item.value isEqualToString:@"two"]) || [item.name isEqualToString:@"sku"]) {
foundCount++;
}
XCTAssertFalse([item.name isEqualToString:@"sku"]);
}

XCTAssert(foundCount == 3);
XCTAssert(foundCount == 4);
#else
// NOTE: Currently the macOS SDK does not supply the sku or offline query parameters
for (NSURLQueryItem *item in components.queryItems) {
Expand Down

0 comments on commit d85ce77

Please sign in to comment.