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

[ios, macos] Include SKU token for offline requests #16130

Merged
merged 5 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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