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

Send turnstile event when telemetry is paused #3495

Merged
merged 1 commit into from
Jan 14, 2016
Merged
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
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