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

Commit

Permalink
[ios] send turnstile event when telemetry is paused
Browse files Browse the repository at this point in the history
  • Loading branch information
friedbunny committed Jan 14, 2016
1 parent 75ed155 commit b57e237
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions platform/ios/src/MGLMapboxEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,19 @@ - (void) postEvents:(NS_ARRAY_OF(MGLMapboxEventAttributes *) *)events {
[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];
}
}
}
}
});
}
Expand Down Expand Up @@ -880,7 +892,7 @@ - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticat
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
}
}

}

@end

0 comments on commit b57e237

Please sign in to comment.