From c4097fff2de10a198270756e85618e188314963f Mon Sep 17 00:00:00 2001 From: Brad Leege Date: Fri, 20 Mar 2015 16:30:07 -0500 Subject: [PATCH] #1033 - Adding MGLMapboxEvents to MGLMapView --- platform/ios/MGLMapView.mm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 6136eeb3c..981007df2 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -21,9 +21,9 @@ #import "NSArray+MGLAdditions.h" #import "NSDictionary+MGLAdditions.h" +#import "MGLMapboxEvents.h" #import "MGLMetricsLocationManager.h" - // Returns the path to the default cache database on this system. const std::string &defaultCacheDatabase() { static const std::string path = []() -> std::string { @@ -170,6 +170,7 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr; if (accessToken) { mbglMap->setAccessToken((std::string)[accessToken cStringUsingEncoding:[NSString defaultCStringEncoding]]); + [[MGLMapboxEvents sharedManager] setAccessToken:accessToken]; } } @@ -210,6 +211,17 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr; // setup accessibility // self.accessibilityLabel = @"Map"; + + // setup Metrics + MGLMapboxEvents *events = [MGLMapboxEvents sharedManager]; + NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]; + NSString *appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; + if (appName != nil) { + events.appName = appName; + } + if (appVersion != nil) { + events.appVersion = appVersion; + } // create GL view //