mirror of
https://github.com/Tencent/Hippy.git
synced 2026-10-29 14:10:47 +08:00
feat(devtools): remove ios inspector instance
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
|
||||
@interface HippyDevManager ()<HippyDevClientProtocol> {
|
||||
HippyDevWebSocketClient *_devWSClient;
|
||||
HippyInspector *_inspector;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -47,7 +48,7 @@
|
||||
contextName:contextName
|
||||
clientId:clientId];
|
||||
_devWSClient.delegate = self;
|
||||
[HippyInspector sharedInstance].devManager = self;
|
||||
_inspector = [[HippyInspector alloc] initWithDevManager:self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -72,9 +73,8 @@
|
||||
|
||||
#pragma mark WS Delegate
|
||||
- (void)devClient:(HippyDevWebSocketClient *)devClient didReceiveMessage:(NSString *)message {
|
||||
HippyInspector *inspector = [HippyInspector sharedInstance];
|
||||
HippyDevCommand *command = nil;
|
||||
HippyInspectorDomain *domain = [inspector inspectorDomainFromMessage:message command:&command];
|
||||
HippyInspectorDomain *domain = [_inspector inspectorDomainFromMessage:message command:&command];
|
||||
[domain handleRequestDevCommand:command bridge:_bridge completion:^(NSDictionary *rspObject) {
|
||||
rspObject = properResultForEmprtyObject(command.cmdID, rspObject);
|
||||
NSData *data = [NSJSONSerialization dataWithJSONObject:rspObject options:0 error:nil];
|
||||
|
||||
@@ -30,10 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@property (nonatomic, weak) HippyDevManager *devManager;
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (instancetype)new NS_UNAVAILABLE;
|
||||
- (instancetype)initWithDevManager:(HippyDevManager *)manager;
|
||||
|
||||
- (HippyInspectorDomain *)inspectorDomainFromMessage:(NSString *)message command:(out HippyDevCommand *_Nullable*_Nullable)command;
|
||||
|
||||
|
||||
@@ -39,15 +39,6 @@ NSString *const HippyInspectorRspDataKeyParams = @"params";
|
||||
|
||||
@implementation HippyInspector
|
||||
|
||||
+ (instancetype)sharedInstance {
|
||||
static HippyInspector *instance = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
instance = [[HippyInspector alloc] init];
|
||||
});
|
||||
return instance;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
@@ -57,6 +48,13 @@ NSString *const HippyInspectorRspDataKeyParams = @"params";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithDevManager:(HippyDevManager *)manager {
|
||||
if (self = [self init]) {
|
||||
_devManager = manager;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark private method
|
||||
- (void)initializeDomain {
|
||||
HippyDomDomain *domDomain = [[HippyDomDomain alloc] initWithInspector:self];
|
||||
|
||||
Reference in New Issue
Block a user