-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(oom): Report short version as app.version #349
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,6 +146,8 @@ - (BOOL)computeDidOOMLastLaunchWithConfig:(BugsnagConfiguration *)config { | |
NSDictionary *lastBootInfo = [self readSentinelFile]; | ||
if (lastBootInfo != nil) { | ||
self.lastBootCachedFileInfo = lastBootInfo; | ||
NSString *lastBootBundleVersion = | ||
[lastBootInfo valueForKeyPath:@"app.bundleVersion"]; | ||
NSString *lastBootAppVersion = | ||
[lastBootInfo valueForKeyPath:@"app.version"]; | ||
NSString *lastBootOSVersion = | ||
|
@@ -154,9 +156,12 @@ - (BOOL)computeDidOOMLastLaunchWithConfig:(BugsnagConfiguration *)config { | |
[[lastBootInfo valueForKeyPath:@"app.inForeground"] boolValue]; | ||
NSString *osVersion = [BSG_KSSystemInfo osBuildVersion]; | ||
NSDictionary *appInfo = [[NSBundle mainBundle] infoDictionary]; | ||
NSString *bundleVersion = | ||
[appInfo valueForKey:@BSG_KSSystemField_BundleVersion]; | ||
NSString *appVersion = | ||
[appInfo valueForKey:(__bridge NSString *)kCFBundleVersionKey]; | ||
[appInfo valueForKey:@BSG_KSSystemField_BundleShortVersion]; | ||
BOOL sameVersions = [lastBootOSVersion isEqualToString:osVersion] && | ||
[lastBootBundleVersion isEqualToString:bundleVersion] && | ||
[lastBootAppVersion isEqualToString:appVersion]; | ||
BOOL shouldReport = config.reportOOMs && (config.reportBackgroundOOMs || lastBootInForeground); | ||
[self deleteSentinelFile]; | ||
|
@@ -214,7 +219,8 @@ - (NSMutableDictionary *)generateCacheInfoWithConfig:(BugsnagConfiguration *)con | |
app[@"id"] = systemInfo[@BSG_KSSystemField_BundleID] ?: @""; | ||
app[@"name"] = systemInfo[@BSG_KSSystemField_BundleName] ?: @""; | ||
app[@"releaseStage"] = config.releaseStage; | ||
app[@"version"] = systemInfo[@BSG_KSSystemField_BundleVersion] ?: @""; | ||
app[@"version"] = systemInfo[@BSG_KSSystemField_BundleShortVersion] ?: @""; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to add the bundle version in as well? Think it would something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah - having both makes sense 👍 |
||
app[@"bundleVersion"] = systemInfo[@BSG_KSSystemField_BundleVersion] ?: @""; | ||
app[@"inForeground"] = @YES; | ||
#if TARGET_OS_TV | ||
app[@"type"] = @"tvOS"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is being used to detect if the app has the same version and hence report the OOM, should this be on app version and bundle version rather than just app version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question. The safest thing is to check both, so I'll make it do that.