diff --git a/ios/RNSentry.mm b/ios/RNSentry.mm index 87370ec2f..05344cd5a 100644 --- a/ios/RNSentry.mm +++ b/ios/RNSentry.mm @@ -1,5 +1,6 @@ #import #import "RNSentry.h" +#import "RNSentryTimeToDisplay.h" #if __has_include() #import @@ -107,7 +108,7 @@ + (BOOL)requiresMainQueueSetup { sentHybridSdkDidBecomeActive = true; } - _timeToDisplay = [[RNSentryTimeToDisplayModule alloc] init]; + _timeToDisplay = [[RNSentryTimeToDisplay alloc] init]; #if SENTRY_TARGET_REPLAY_SUPPORTED [RNSentryReplay postInit]; @@ -779,19 +780,9 @@ - (NSDictionary*) fetchNativeStackFramesBy: (NSArray*)instructionsAdd } #endif -// Expose timeToDisplay to JS as an object with properties -RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getTimeToDisplay) { - NSMutableDictionary *timeToDisplayDict = [NSMutableDictionary new]; - - // Expose the methods as key-value pairs - timeToDisplayDict[@"requestAnimationFrame"] = @([_timeToDisplay requestAnimationFrame]); - timeToDisplayDict[@"isAvailable"] = @([_timeToDisplay isAvailable]); - - return timeToDisplayDict; -} - -RCT_EXPORT_METHOD(getTimeToDisplay:(RCTResponseSenderBlock)callback) { - [_timeToDisplay getNewScreenTimeToDisplay:callback]; +RCT_EXPORT_METHOD(getNewScreenTimeToDisplay:(RCTPromiseResolveBlock)resolve + rejecter:(RCTPromiseRejectBlock)reject) { + [_timeToDisplay getTimeToDisplay:resolve]; } diff --git a/ios/RNSentryTimeToDisplay.h b/ios/RNSentryTimeToDisplay.h index 7e47e3fc8..fbb468cb2 100644 --- a/ios/RNSentryTimeToDisplay.h +++ b/ios/RNSentryTimeToDisplay.h @@ -1,6 +1,6 @@ #import -@interface RNSentryTimeToDisplayModule : NSObject +@interface RNSentryTimeToDisplay : NSObject - (void)getTimeToDisplay:(RCTResponseSenderBlock)callback;