Skip to content

Commit

Permalink
feature(ios): Add processor count to device info (#2984)
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich authored Apr 24, 2023
1 parent ad6c299 commit 437ade1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Features

- Add CPU Info to Device Context ([#2984](https://github.com/getsentry/sentry-react-native/pull/2984))

### Fixes

- Allow disabling native on RNNA ([#2978](https://github.com/getsentry/sentry-react-native/pull/2978))
Expand Down
16 changes: 16 additions & 0 deletions ios/RNSentry.mm
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,22 @@ - (void)setEventEnvironmentTag:(SentryEvent *)event
}
}];

NSDictionary<NSString *, id> *extraContext = [PrivateSentrySDKOnly getExtraContext];
NSMutableDictionary<NSString *, NSDictionary<NSString *, id> *> *context = [contexts[@"context"] mutableCopy];

if (extraContext && [extraContext[@"device"] isKindOfClass:[NSDictionary class]]) {
NSMutableDictionary<NSString *, NSDictionary<NSString *, id> *> *deviceContext = [contexts[@"context"][@"device"] mutableCopy];
[deviceContext addEntriesFromDictionary:extraContext[@"device"]];
[context setValue:deviceContext forKey:@"device"];
}

if (extraContext && [extraContext[@"app"] isKindOfClass:[NSDictionary class]]) {
NSMutableDictionary<NSString *, NSDictionary<NSString *, id> *> *appContext = [contexts[@"context"][@"app"] mutableCopy];
[appContext addEntriesFromDictionary:extraContext[@"app"]];
[context setValue:appContext forKey:@"app"];
}

[contexts setValue:context forKey:@"context"];
resolve(contexts);
}

Expand Down

0 comments on commit 437ade1

Please sign in to comment.