From 437ade15a0affbd8f818fa392a4c1df05de7b8ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Wold=C5=99ich?= <31292499+krystofwoldrich@users.noreply.github.com> Date: Mon, 24 Apr 2023 19:07:37 +0200 Subject: [PATCH] feature(ios): Add processor count to device info (#2984) --- CHANGELOG.md | 4 ++++ ios/RNSentry.mm | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eebde5c2..d0a38aad9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/ios/RNSentry.mm b/ios/RNSentry.mm index 78b0a24dd..d34642500 100644 --- a/ios/RNSentry.mm +++ b/ios/RNSentry.mm @@ -207,6 +207,22 @@ - (void)setEventEnvironmentTag:(SentryEvent *)event } }]; + NSDictionary *extraContext = [PrivateSentrySDKOnly getExtraContext]; + NSMutableDictionary *> *context = [contexts[@"context"] mutableCopy]; + + if (extraContext && [extraContext[@"device"] isKindOfClass:[NSDictionary class]]) { + NSMutableDictionary *> *deviceContext = [contexts[@"context"][@"device"] mutableCopy]; + [deviceContext addEntriesFromDictionary:extraContext[@"device"]]; + [context setValue:deviceContext forKey:@"device"]; + } + + if (extraContext && [extraContext[@"app"] isKindOfClass:[NSDictionary class]]) { + NSMutableDictionary *> *appContext = [contexts[@"context"][@"app"] mutableCopy]; + [appContext addEntriesFromDictionary:extraContext[@"app"]]; + [context setValue:appContext forKey:@"app"]; + } + + [contexts setValue:context forKey:@"context"]; resolve(contexts); }