move host:didInitializeRuntime: to public api

Summary:
Changelog: [Internal]

it appears that having some access to jsi in userland will be necessary for framework developers, so i'm moving this API to the public header.

bypass-github-export-checks

Reviewed By: mdvacca

Differential Revision: D46385184

fbshipit-source-id: 7261c0a8ba8c8c9302f65d440a3a3fb2782c0666
This commit is contained in:
Phillip Pan 2023-06-05 21:31:29 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 80134f7211
Коммит b6b247b874
3 изменённых файлов: 9 добавлений и 16 удалений

Просмотреть файл

@ -8,21 +8,13 @@
#import "RCTHost.h"
#import <ReactCommon/RCTContextContainerHandling.h>
#import <jsi/jsi.h>
typedef NSURL * (^RCTHostBundleURLProvider)(void);
@protocol RCTHostRuntimeDelegate <NSObject>
- (void)hostDidInitializeRuntime:(facebook::jsi::Runtime &)runtime;
@end
@interface RCTHost (Internal)
- (void)registerSegmentWithId:(NSNumber *)segmentId path:(NSString *)path;
- (void)setBundleURLProvider:(RCTHostBundleURLProvider)bundleURLProvider;
- (void)setRuntimeDelegate:(id<RCTHostRuntimeDelegate>)runtimeDelegate;
- (void)setContextContainerHandler:(id<RCTContextContainerHandling>)contextContainerHandler;
@end

Просмотреть файл

@ -18,7 +18,6 @@ NS_ASSUME_NONNULL_BEGIN
@class RCTFabricSurface;
@class RCTHost;
@class RCTJSThreadManager;
@class RCTModuleRegistry;
FB_RUNTIME_PROTOCOL
@protocol RCTTurboModuleManagerDelegate;
@ -37,6 +36,12 @@ FB_RUNTIME_PROTOCOL
@end
@protocol RCTHostRuntimeDelegate <NSObject>
- (void)host:(RCTHost *)host didInitializeRuntime:(facebook::jsi::Runtime &)runtime;
@end
typedef std::shared_ptr<facebook::react::JSEngineInstance> (^RCTHostJSEngineProvider)(void);
@interface RCTHost : NSObject
@ -46,6 +51,8 @@ typedef std::shared_ptr<facebook::react::JSEngineInstance> (^RCTHostJSEngineProv
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
jsEngineProvider:(RCTHostJSEngineProvider)jsEngineProvider NS_DESIGNATED_INITIALIZER FB_OBJC_DIRECT;
@property (nonatomic, weak, nullable) id<RCTHostRuntimeDelegate> runtimeDelegate;
- (void)start;
- (void)callFunctionOnJSModule:(NSString *)moduleName method:(NSString *)method args:(NSArray *)args;

Просмотреть файл

@ -28,7 +28,6 @@ using namespace facebook::react;
__weak id<RCTHostDelegate> _hostDelegate;
__weak id<RCTTurboModuleManagerDelegate> _turboModuleManagerDelegate;
__weak id<RCTHostRuntimeDelegate> _runtimeDelegate;
__weak id<RCTContextContainerHandling> _contextContainerHandler;
NSURL *_oldDelegateBundleURL;
@ -257,7 +256,7 @@ using namespace facebook::react;
- (void)instance:(RCTInstance *)instance didInitializeRuntime:(facebook::jsi::Runtime &)runtime
{
[_runtimeDelegate hostDidInitializeRuntime:runtime];
[self.runtimeDelegate host:self didInitializeRuntime:runtime];
}
#pragma mark - RCTContextContainerHandling
@ -279,11 +278,6 @@ using namespace facebook::react;
_bundleURLProvider = [bundleURLProvider copy];
}
- (void)setRuntimeDelegate:(id<RCTHostRuntimeDelegate>)runtimeDelegate
{
_runtimeDelegate = runtimeDelegate;
}
- (void)setContextContainerHandler:(id<RCTContextContainerHandling>)contextContainerHandler
{
_contextContainerHandler = contextContainerHandler;