1111#import < React/RCTComponent.h>
1212#import < react/renderer/components/RNSandboxSpec/EventEmitters.h>
1313
14+ #include < string>
15+ #include < vector>
16+
1417NS_ASSUME_NONNULL_BEGIN
1518
1619/* *
1720 * A React Native delegate that provides sandboxed environments with filtered module access.
1821 * This delegate uses RCTFilteredAppDependencyProvider to restrict which native modules
1922 * are available to the JavaScript runtime, enhancing security in multi-instance scenarios.
2023 *
21- * Registry functionality has been moved to SandboxRegistry class to maintain single responsibility.
24+ * This class provides the core React Native integration functionality.
25+ * For C++ registry integration, use SandboxDelegateWrapper.
2226 */
2327@interface SandboxReactNativeDelegate : RCTDefaultReactNativeFactoryDelegate
2428
2529@property (nonatomic ) std::shared_ptr<const facebook::react::SandboxReactNativeViewEventEmitter> eventEmitter;
2630@property (nonatomic , assign ) BOOL hasOnMessageHandler;
2731@property (nonatomic , assign ) BOOL hasOnErrorHandler;
28- @property (nonatomic , copy , nullable ) NSString * origin;
29- @property (nonatomic , copy , nullable ) NSString * jsBundleSource;
32+ @property (nonatomic , readwrite ) std::string origin;
33+ @property (nonatomic , readwrite ) std::string jsBundleSource;
3034
3135/* *
3236 * Sets the list of allowed TurboModules for this sandbox instance.
3337 * Only modules in this list will be accessible to the JavaScript runtime.
3438 */
35- @property (nonatomic , copy ) NSArray <NSString *> * allowedTurboModules;
39+ @property (nonatomic , readwrite ) std::set<std::string> allowedTurboModules;
3640
3741/* *
3842 * Sets the list of allowed origins for this sandbox instance.
3943 * Only sandboxes with origins in this list can send messages to this sandbox.
4044 */
41- @property (nonatomic , copy ) NSArray <NSString *> * allowedOrigins;
45+ @property (nonatomic , readwrite ) std::set<std::string> allowedOrigins;
4246
4347/* *
4448 * Initializes the delegate.
@@ -48,17 +52,17 @@ NS_ASSUME_NONNULL_BEGIN
4852
4953/* *
5054 * Posts a message to the JavaScript runtime.
51- * @param message String containing the JSON.stringified message
55+ * @param message C++ string containing the JSON.stringified message
5256 */
53- - (void )postMessage : (NSString * )message ;
57+ - (void )postMessage : (const std::string & )message ;
5458
5559/* *
5660 * Routes a message to a specific sandbox delegate.
5761 * @param message The message to route
5862 * @param targetId The ID of the target sandbox
59- * @return YES if the message was successfully routed, NO otherwise
63+ * @return true if the message was successfully routed, false otherwise
6064 */
61- - (BOOL )routeMessage : (NSString * )message toSandbox : (NSString * )targetId ;
65+ - (bool )routeMessage : (const std::string & )message toSandbox : (const std::string & )targetId ;
6266
6367@end
6468
0 commit comments