Description
Once getsentry/sentry-cocoa#8026 is released, SentryUser.initWithDictionary: will natively handle the "geo" key by deserializing it into SentryGeo. This means we can remove the manual geo handling in RNSentry.mm.
Changes needed
In packages/core/ios/RNSentry.mm (userFrom:otherUserKeys:):
- Remove
[filteredKeys removeObjectForKey:@"geo"] and the filteredKeys mutable copy — pass userKeys directly to initWithDictionary:
- Remove the entire manual geo block (~20 lines:
SentryGeo alloc, manual city/countryCode/region parsing, setGeo:)
- Remove
#import <Sentry/SentryGeo.h>
The method should simplify to:
SentryUser *userInstance = [[SentryUser alloc] initWithDictionary:userKeys];
if ([userDataKeys isKindOfClass:NSDictionary.class]) {
[userInstance setData:userDataKeys];
}
return userInstance;
Prerequisite
Related
Description
Once getsentry/sentry-cocoa#8026 is released,
SentryUser.initWithDictionary:will natively handle the"geo"key by deserializing it intoSentryGeo. This means we can remove the manual geo handling inRNSentry.mm.Changes needed
In
packages/core/ios/RNSentry.mm(userFrom:otherUserKeys:):[filteredKeys removeObjectForKey:@"geo"]and thefilteredKeysmutable copy — passuserKeysdirectly toinitWithDictionary:SentryGeoalloc, manual city/countryCode/region parsing,setGeo:)#import <Sentry/SentryGeo.h>The method should simplify to:
Prerequisite
sentry-cocoadependency to the version that includes fix: Support geo in SentryGeo initWithDictionary sentry-cocoa#8026Related