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

Commit

Permalink
[ios] Add pluggedIn telemetry key
Browse files Browse the repository at this point in the history
  • Loading branch information
friedbunny committed Jan 21, 2016
1 parent daf4081 commit 8484887
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions platform/ios/src/MGLMapboxEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,11 @@ - (void) pushEvent:(NSString *)event withAttributes:(MGLMapboxEventAttributes *)

[evt setValue:@((int)(100 * [UIDevice currentDevice].batteryLevel)) forKey:@"batteryLevel"];

UIDeviceBatteryState batteryState = [[UIDevice currentDevice] batteryState];
if (batteryState != UIDeviceBatteryStateUnknown) {
[evt setValue:(batteryState == UIDeviceBatteryStateUnplugged ? @NO : @YES) forKey:@"pluggedIn"];
}

MGLReachability *reachability = [MGLReachability reachabilityForLocalWiFi];
[evt setValue:([reachability isReachableViaWiFi] ? @YES : @NO) forKey:@"wifi"];
}
Expand Down

0 comments on commit 8484887

Please sign in to comment.