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

Add telemetry on/off status to turnstile event #3496

Closed
wants to merge 1 commit into from
Closed
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
32 changes: 14 additions & 18 deletions platform/ios/src/MGLMapboxEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -391,31 +391,27 @@ - (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];
NSDictionary *vevt = @{
@"event" : MGLEventTypeAppUserTurnstile,
@"created" : [strongSelf.rfc3339DateFormatter stringFromDate:[NSDate date]],
@"appBundleId" : strongSelf.appBundleId,
@"vendorId": vid,
@"version": @(version),
@"instance": strongSelf.instanceID
};

// Add to Queue
[_eventQueue addObject:vevt];

// Flush
[strongSelf flush];
NSString *idfv = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
NSDictionary *vevt = @{
@"event" : MGLEventTypeAppUserTurnstile,
@"created" : [strongSelf.rfc3339DateFormatter stringFromDate:[NSDate date]],
@"appBundleId" : strongSelf.appBundleId,
@"vendorId": idfv,
@"version": @(version),
@"instance": strongSelf.instanceID,
@"telemetry": @([[strongSelf class] isEnabled])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a more descriptive key like telemetryEnabled would be more future-proof.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enabled.telemetry would fit with similar key names. 🤔

};

[_eventQueue addObject:vevt];

[strongSelf flush];
});
}

Expand Down