From 432829833125e783e058648c8bd5c22178e5a740 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Tue, 14 Jan 2025 13:47:44 +0100 Subject: [PATCH] chore: Initialize `RNSentryTimeToDisplay` during native module `init` on iOS --- CHANGELOG.md | 4 ++++ packages/core/ios/RNSentry.mm | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3dd716d64a..f46face18c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/packages/core/ios/RNSentry.mm b/packages/core/ios/RNSentry.mm index d22852df6a..79ff76d0ae 100644 --- a/packages/core/ios/RNSentry.mm +++ b/packages/core/ios/RNSentry.mm @@ -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 @@ -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