diff options
author | Alex Zolotarev <alex@maps.me> | 2015-06-16 21:17:43 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:51:50 +0300 |
commit | b0ab3dca2443ca1bb41cc12c9397484e8411955c (patch) | |
tree | a2baa257e77b7eebd2a08887a9816971f40b43de /3party/Alohalytics/src/apple/alohalytics_objc.mm | |
parent | 17768fd03ec60cfe10f16d4736702a63561a3f5a (diff) |
[alohalytics] Log User-Agent only on install and update events, not on every launch.
Diffstat (limited to '3party/Alohalytics/src/apple/alohalytics_objc.mm')
-rw-r--r-- | 3party/Alohalytics/src/apple/alohalytics_objc.mm | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/3party/Alohalytics/src/apple/alohalytics_objc.mm b/3party/Alohalytics/src/apple/alohalytics_objc.mm index 23356d4096..1f211f9a03 100644 --- a/3party/Alohalytics/src/apple/alohalytics_objc.mm +++ b/3party/Alohalytics/src/apple/alohalytics_objc.mm @@ -141,6 +141,13 @@ static std::string RectToString(CGRect const & rect) { // Logs some basic device's info. static void LogSystemInformation() { + // Initialize User Agent later, as it takes significant time at startup. + dispatch_async(dispatch_get_main_queue(), ^{ + gBrowserUserAgent = [[[UIWebView alloc] initWithFrame:CGRectZero] stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"]; + if (gBrowserUserAgent) { + Stats::Instance().LogEvent("$browserUserAgent", ToStdString(gBrowserUserAgent)); + } + }); UIDevice * device = [UIDevice currentDevice]; UIScreen * screen = [UIScreen mainScreen]; std::string preferredLanguages; @@ -348,13 +355,6 @@ bool IsConnectionActive() { serverUrl = [serverUrl stringByAppendingFormat:@"/mac/%@/%@", bundleIdentifier, version]; #endif #if (TARGET_OS_IPHONE > 0) - // Initialize User Agent later, as it takes significant time at startup. - dispatch_async(dispatch_get_main_queue(), ^{ - gBrowserUserAgent = [[[UIWebView alloc] initWithFrame:CGRectZero] stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"]; - if (gBrowserUserAgent) { - Stats::Instance().LogEvent("$browserUserAgent", ToStdString(gBrowserUserAgent)); - } - }); NSNotificationCenter * nc = [NSNotificationCenter defaultCenter]; Class cls = [Alohalytics class]; [nc addObserver:cls selector:@selector(applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil]; |