summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mbgl/ios/MGLMapboxEvents.h1
-rw-r--r--ios/app/app-info.plist2
-rw-r--r--platform/ios/MGLMapView.mm2
-rw-r--r--platform/ios/MGLMapboxEvents.m12
4 files changed, 14 insertions, 3 deletions
diff --git a/include/mbgl/ios/MGLMapboxEvents.h b/include/mbgl/ios/MGLMapboxEvents.h
index 7a4c45fe1f..c6cd133082 100644
--- a/include/mbgl/ios/MGLMapboxEvents.h
+++ b/include/mbgl/ios/MGLMapboxEvents.h
@@ -32,6 +32,7 @@ extern NSString *const MGLEventGestureRotateStart;
+ (void) setToken:(NSString *)token;
+ (void) setAppName:(NSString *)appName;
+ (void) setAppVersion:(NSString *)appVersion;
++ (void) setAppBuildNumber:(NSString *)appBuildNumber;
+ (void) pauseMetricsCollection;
+ (void) resumeMetricsCollection;
diff --git a/ios/app/app-info.plist b/ios/app/app-info.plist
index cd74f58390..fd03e73241 100644
--- a/ios/app/app-info.plist
+++ b/ios/app/app-info.plist
@@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>MBGL</string>
<key>CFBundleVersion</key>
- <string>0.0.2</string>
+ <string>0.0.3</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSHumanReadableCopyright</key>
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index f9ed77041a..b61679a7dd 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -223,8 +223,10 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
// metrics: initial setup
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
NSString *appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
+ NSString *appBuildNumber = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
if (appName != nil) [MGLMapboxEvents setAppName:appName];
if (appVersion != nil) [MGLMapboxEvents setAppVersion:appVersion];
+ if (appBuildNumber != nil) [MGLMapboxEvents setAppBuildNumber:appBuildNumber];
// create GL view
//
diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m
index b32e139889..b714c927db 100644
--- a/platform/ios/MGLMapboxEvents.m
+++ b/platform/ios/MGLMapboxEvents.m
@@ -62,6 +62,7 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
@property (atomic) NSString *token;
@property (atomic) NSString *appName;
@property (atomic) NSString *appVersion;
+@property (atomic) NSString *appBuildNumber;
@property (atomic) NSString *instanceID;
@property (atomic) NSString *advertiserId;
@property (atomic) NSString *vendorId;
@@ -249,6 +250,13 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
// Must be called from the main thread.
//
++ (void) setAppBuildNumber:(NSString *)appBuildNumber {
+ assert([[NSThread currentThread] isMainThread]);
+ [MGLMapboxEvents sharedManager].appBuildNumber = appBuildNumber;
+}
+
+// Must be called from the main thread.
+//
+ (void) pauseMetricsCollection {
assert([[NSThread currentThread] isMainThread]);
if ([MGLMapboxEvents sharedManager].isPaused) {
@@ -455,8 +463,8 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
// Can be called from any thread.
//
- (NSString *) getUserAgent {
- if (self.appName != nil && self.appVersion != nil && ([self.userAgent rangeOfString:self.appName].location == NSNotFound)) {
- self.userAgent = [NSString stringWithFormat:@"%@/%@ %@", self.appName, self.appVersion, self.userAgent];
+ if (self.appName != nil && self.appVersion != nil && self.appBuildNumber != nil && ([self.userAgent rangeOfString:self.appName].location == NSNotFound)) {
+ self.userAgent = [NSString stringWithFormat:@"%@/%@-%@ %@", self.appName, self.appVersion, self.appBuildNumber, self.userAgent];
}
return self.userAgent;
}