summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2016-01-09 14:22:39 -0500
committerJason Wray <jason@mapbox.com>2016-01-14 18:30:51 -0500
commitb57e237b142ee6c74c02f5e22a1c6e2b4f2d0be8 (patch)
treeee75ed17d6c099e2fd1f8ca2a2c04f40f715d3e4 /platform
parent75ed155f4f25f9b295bc1ca7755cd7b3c7491e78 (diff)
downloadqtlocation-mapboxgl-b57e237b142ee6c74c02f5e22a1c6e2b4f2d0be8.tar.gz
[ios] send turnstile event when telemetry is paused
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/src/MGLMapboxEvents.m16
1 files changed, 14 insertions, 2 deletions
diff --git a/platform/ios/src/MGLMapboxEvents.m b/platform/ios/src/MGLMapboxEvents.m
index 5fc062a2a2..8490c03195 100644
--- a/platform/ios/src/MGLMapboxEvents.m
+++ b/platform/ios/src/MGLMapboxEvents.m
@@ -543,7 +543,19 @@ const NSTimeInterval MGLFlushInterval = 60;
[request setHTTPBody:jsonData];
// Send non blocking HTTP Request to server
- [[_session dataTaskWithRequest:request] resume];
+ if ( ! strongSelf.paused) {
+ [[strongSelf.session dataTaskWithRequest:request] resume];
+ } else {
+ for (MGLMapboxEventAttributes *event in events) {
+ if ([event[@"event"] isEqualToString:MGLEventTypeAppUserTurnstile]) {
+ NSURLSession *temporarySession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]
+ delegate:strongSelf
+ delegateQueue:nil];
+ [[temporarySession dataTaskWithRequest:request] resume];
+ [temporarySession finishTasksAndInvalidate];
+ }
+ }
+ }
}
});
}
@@ -880,7 +892,7 @@ const NSTimeInterval MGLFlushInterval = 60;
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
}
}
-
+
}
@end