Workaround for bridge.isInspectable

Summary:
`RCTDevSettings` uses the API `bridge.isInspectable` to understand if the runtime can be debugged. In bridgeless mode, let's use `RuntimeExecutor` to check the same property.

Changelog: [Internal]

Reviewed By: p-sun

Differential Revision: D27095935

fbshipit-source-id: 93785774b175bd7da17269e1590b5d92eba2b0cf
This commit is contained in:
Peter Argany
2021-03-17 18:23:15 -07:00
committed by Facebook GitHub Bot
parent 4079c0454b
commit dbf5fa2d1a
2 changed files with 22 additions and 2 deletions
+10
View File
@@ -30,6 +30,16 @@
@end
@protocol RCTDevSettingsInspectable <NSObject>
/**
* Whether current jsi::Runtime is inspectable.
* Only set when using as a bridgeless turbo module.
*/
@property (nonatomic, assign, readwrite) BOOL isInspectable;
@end
@interface RCTDevSettings : RCTEventEmitter
- (instancetype)initWithDataSource:(id<RCTDevSettingsDataSource>)dataSource;
+12 -2
View File
@@ -114,7 +114,12 @@ void RCTDevSettingsSetEnabled(BOOL enabled)
@end
@interface RCTDevSettings () <RCTBridgeModule, RCTInvalidating, NativeDevSettingsSpec, RCTBundleHolderModule> {
@interface RCTDevSettings () <
RCTBridgeModule,
RCTInvalidating,
NativeDevSettingsSpec,
RCTBundleHolderModule,
RCTDevSettingsInspectable> {
BOOL _isJSLoaded;
#if ENABLE_PACKAGER_CONNECTION
RCTHandlerToken _reloadToken;
@@ -129,6 +134,7 @@ void RCTDevSettingsSetEnabled(BOOL enabled)
@implementation RCTDevSettings
@synthesize bundleURL = _bundleURL;
@synthesize isInspectable = _isInspectable;
RCT_EXPORT_MODULE()
@@ -242,7 +248,11 @@ RCT_EXPORT_MODULE()
- (BOOL)isDeviceDebuggingAvailable
{
#if RCT_ENABLE_INSPECTOR
return self.bridge.isInspectable;
if (self.bridge) {
return self.bridge.isInspectable;
} else {
return self.isInspectable;
}
#else
return false;
#endif // RCT_ENABLE_INSPECTOR