From b7fc4a1843853be9129560601a2048c02bcdf093 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Sat, 9 Jan 2016 14:47:42 -0500 Subject: [PATCH] [ios] Add enabled.telemetry key to turnstile event Supercedes #3496 --- platform/ios/src/MGLMapboxEvents.m | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/platform/ios/src/MGLMapboxEvents.m b/platform/ios/src/MGLMapboxEvents.m index 80ea49593e7..ba3a794195c 100644 --- a/platform/ios/src/MGLMapboxEvents.m +++ b/platform/ios/src/MGLMapboxEvents.m @@ -417,37 +417,33 @@ - (void)startUpdatingLocation { } - (void) pushTurnstileEvent { - __weak MGLMapboxEvents *weakSelf = self; dispatch_async(_serialQueue, ^{ - MGLMapboxEvents *strongSelf = weakSelf; if ( ! strongSelf) return; - // Build only IDFV event - NSString *vid = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; + NSString *idfv = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; - if (!vid) return; + if ( ! idfv) return; - NSDictionary *vevt = @{ - @"event" : MGLEventTypeAppUserTurnstile, - @"created" : [strongSelf.rfc3339DateFormatter stringFromDate:[NSDate date]], - @"vendorId": vid, - @"version": @(version) - }; + NSDictionary *vevt = @{ + @"event" : MGLEventTypeAppUserTurnstile, + @"created" : [strongSelf.rfc3339DateFormatter stringFromDate:[NSDate date]], + @"vendorId": idfv, + @"version": @(version), + @"enabled.telemetry": @([[strongSelf class] isEnabled]) + }; - // Add to Queue - [_eventQueue addObject:vevt]; + [_eventQueue addObject:vevt]; - // Flush - [strongSelf flush]; + // Flush + [strongSelf flush]; if ([strongSelf debugLoggingEnabled]) { [strongSelf writeEventToLocalDebugLog:vevt]; } - }); } @@ -477,7 +473,7 @@ - (void) pushEvent:(NSString *)event withAttributes:(MGLMapboxEventAttributes *) return; } - if (!event) return; + if ( ! event) return; MGLMutableMapboxEventAttributes *evt = [MGLMutableMapboxEventAttributes dictionaryWithDictionary:attributeDictionary]; // Send these keys with every event