summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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