Skip to content

Commit

Permalink
chore: Initialize RNSentryTimeToDisplay during native module init
Browse files Browse the repository at this point in the history
… on iOS (#4443)
  • Loading branch information
krystofwoldrich authored Jan 16, 2025
1 parent 8d251c2 commit ae7b03d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
- Rename `navigation.processing` span to more expressive `Navigation dispatch to screen A mounted/navigation cancelled` ([#4423](https://github.com/getsentry/sentry-react-native/pull/4423))
- Add RN SDK package to `sdk.packages` for Cocoa ([#4381](https://github.com/getsentry/sentry-react-native/pull/4381))

### Internal

- Initialize `RNSentryTimeToDisplay` during native module `init` on iOS ([#4443](https://github.com/getsentry/sentry-react-native/pull/4443))

### Dependencies

- Bump CLI from v2.39.1 to v2.40.0 ([#4412](https://github.com/getsentry/sentry-react-native/pull/4412))
Expand Down
10 changes: 8 additions & 2 deletions packages/core/ios/RNSentry.mm
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ + (BOOL)requiresMainQueueSetup
return YES;
}

- (instancetype)init
{
if (self = [super init]) {
_timeToDisplay = [[RNSentryTimeToDisplay alloc] init];
}
return self;
}

RCT_EXPORT_MODULE()

RCT_EXPORT_METHOD(initNativeSdk
Expand Down Expand Up @@ -152,8 +160,6 @@ - (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)
[mutableOptions removeObjectForKey:@"tracesSampler"];
[mutableOptions removeObjectForKey:@"enableTracing"];

_timeToDisplay = [[RNSentryTimeToDisplay alloc] init];

#if SENTRY_TARGET_REPLAY_SUPPORTED
[RNSentryReplay updateOptions:mutableOptions];
#endif
Expand Down

0 comments on commit ae7b03d

Please sign in to comment.