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

Commit

Permalink
[ios] Add enabled.telemetry key to turnstile event
Browse files Browse the repository at this point in the history
Supercedes #3496
  • Loading branch information
friedbunny committed Jan 23, 2016
1 parent ca02b64 commit 4815709
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions platform/ios/src/MGLMapboxEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

});
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4815709

Please sign in to comment.