Skip to content

Commit 437ade1

Browse files
feature(ios): Add processor count to device info (#2984)
1 parent ad6c299 commit 437ade1

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
- Add CPU Info to Device Context ([#2984](https://github.com/getsentry/sentry-react-native/pull/2984))
8+
59
### Fixes
610

711
- Allow disabling native on RNNA ([#2978](https://github.com/getsentry/sentry-react-native/pull/2978))

ios/RNSentry.mm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,22 @@ - (void)setEventEnvironmentTag:(SentryEvent *)event
207207
}
208208
}];
209209

210+
NSDictionary<NSString *, id> *extraContext = [PrivateSentrySDKOnly getExtraContext];
211+
NSMutableDictionary<NSString *, NSDictionary<NSString *, id> *> *context = [contexts[@"context"] mutableCopy];
212+
213+
if (extraContext && [extraContext[@"device"] isKindOfClass:[NSDictionary class]]) {
214+
NSMutableDictionary<NSString *, NSDictionary<NSString *, id> *> *deviceContext = [contexts[@"context"][@"device"] mutableCopy];
215+
[deviceContext addEntriesFromDictionary:extraContext[@"device"]];
216+
[context setValue:deviceContext forKey:@"device"];
217+
}
218+
219+
if (extraContext && [extraContext[@"app"] isKindOfClass:[NSDictionary class]]) {
220+
NSMutableDictionary<NSString *, NSDictionary<NSString *, id> *> *appContext = [contexts[@"context"][@"app"] mutableCopy];
221+
[appContext addEntriesFromDictionary:extraContext[@"app"]];
222+
[context setValue:appContext forKey:@"app"];
223+
}
224+
225+
[contexts setValue:context forKey:@"context"];
210226
resolve(contexts);
211227
}
212228

0 commit comments

Comments
 (0)