diff options
author | Alex Zolotarev <alex@maps.me> | 2015-06-05 14:07:46 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:50:04 +0300 |
commit | 2f03f8b944af82b4650fdadc7a51d60bc7d8641b (patch) | |
tree | 5ad07ed6523a1eee9b0525430d09f3c99cac830d /3party/Alohalytics/src/apple/alohalytics_objc.mm | |
parent | 38071e3768528e238b9bbf3039a98c9586b93161 (diff) |
[alohalytics][ios] Minor fix to reuse the same variable.
Diffstat (limited to '3party/Alohalytics/src/apple/alohalytics_objc.mm')
-rw-r--r-- | 3party/Alohalytics/src/apple/alohalytics_objc.mm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/3party/Alohalytics/src/apple/alohalytics_objc.mm b/3party/Alohalytics/src/apple/alohalytics_objc.mm index 66c81fafd3..e7073e40d7 100644 --- a/3party/Alohalytics/src/apple/alohalytics_objc.mm +++ b/3party/Alohalytics/src/apple/alohalytics_objc.mm @@ -317,13 +317,14 @@ static UIBackgroundTaskIdentifier sBackgroundTaskId = UIBackgroundTaskInvalid; NSUserDefaults * userDataBase = [NSUserDefaults standardUserDefaults]; NSString * installedVersion = [userDataBase objectForKey:@"AlohalyticsInstalledVersion"]; bool forceUpload = false; + NSBundle * bundle = [NSBundle mainBundle]; if (installationId.second && isFirstLaunch && installedVersion == nil) { - NSString * version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; + NSString * version = [[bundle infoDictionary] objectForKey:@"CFBundleShortVersionString"]; // Documents folder modification time can be interpreted as a "first app launch time" or an approx. "app install time". // App bundle modification time can be interpreted as an "app update time". instance.LogEvent("$install", {{"CFBundleShortVersionString", [version UTF8String]}, {"documentsTimestampMillis", PathTimestampMillis([NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject])}, - {"bundleTimestampMillis", PathTimestampMillis([[NSBundle mainBundle] executablePath])}}); + {"bundleTimestampMillis", PathTimestampMillis([bundle executablePath])}}); [userDataBase setValue:version forKey:@"AlohalyticsInstalledVersion"]; [userDataBase synchronize]; #if (TARGET_OS_IPHONE > 0) @@ -333,11 +334,11 @@ static UIBackgroundTaskIdentifier sBackgroundTaskId = UIBackgroundTaskInvalid; #endif // TARGET_OS_IPHONE forceUpload = true; } else { - NSString * version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; + NSString * version = [[bundle infoDictionary] objectForKey:@"CFBundleShortVersionString"]; if (installedVersion == nil || ![installedVersion isEqualToString:version]) { instance.LogEvent("$update", {{"CFBundleShortVersionString", [version UTF8String]}, {"documentsTimestampMillis", PathTimestampMillis([NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject])}, - {"bundleTimestampMillis", PathTimestampMillis([[NSBundle mainBundle] executablePath])}}); + {"bundleTimestampMillis", PathTimestampMillis([bundle executablePath])}}); [userDataBase setValue:version forKey:@"AlohalyticsInstalledVersion"]; [userDataBase synchronize]; #if (TARGET_OS_IPHONE > 0) |