Skip to content

Commit

Permalink
fix(ios): fixed an issue where some part of devtools were not available
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg authored and hippy-actions[bot] committed Dec 21, 2023
1 parent 9f5e50b commit 276d26e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ - (void)runHippyDemo {
moduleProvider:nil
launchOptions:launchOptions
executorKey:uniqueEngineKey];
_hippyBridge.contextName = uniqueEngineKey;
_hippyBridge.moduleName = @"Demo";
_hippyBridge.methodInterceptor = self;

[_hippyBridge setInspectable:YES];
Expand Down
2 changes: 1 addition & 1 deletion framework/ios/base/bridge/HippyBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ HIPPY_EXTERN NSString *HippyBridgeModuleNameForClass(Class bridgeModuleClass);
* @discussion Context name will be shown on safari development menu.
* only for JSC engine
*/
@property(nonatomic, copy)NSString *contextName;
@property (nonatomic, copy) NSString *contextName;

/**
* Set module name
Expand Down
8 changes: 6 additions & 2 deletions framework/ios/base/executors/HippyJSExecutor.mm
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,14 @@ - (void)setContextName:(NSString *)contextName {
if (!contextName) {
return;
}
WeakCtxPtr weak_ctx = self.pScope->GetContext();
__weak __typeof(self)weakSelf = self;
[self executeBlockOnJavaScriptQueue:^{
@autoreleasepool {
SharedCtxPtr context = weak_ctx.lock();
__strong __typeof(weakSelf)strongSelf = weakSelf;
if (!strongSelf.pScope) {
return;
}
SharedCtxPtr context = strongSelf.pScope->GetContext();
if (!context) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion framework/ios/debug/devtools/HippyDevInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ - (void)parseWsURLWithURLQuery:(NSString *)query {
_wsURL = [debugWsURL substringFromIndex:range.location + range.length];
}

- (NSString *)assembleFullWSURLWithClientId:(NSString *)clientId contextName:(NSString *) contextName{
- (NSString *)assembleFullWSURLWithClientId:(NSString *)clientId contextName:(NSString *)contextName {
if (self.port.length <= 0) {
self.port = [self.scheme isEqualToString:HippyDevWebSocketSchemeWs] ? @"80" : @"443";
}
Expand Down
3 changes: 3 additions & 0 deletions renderer/native/ios/renderer/HippyRootView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ - (instancetype)initWithBridge:(HippyBridge *)bridge
if (!_bridge.moduleName) {
_bridge.moduleName = moduleName;
}
if (!_bridge.contextName) {
_bridge.contextName = moduleName;
}
_moduleName = moduleName;
_appProperties = [initialProperties copy];
_delegate = delegate;
Expand Down

0 comments on commit 276d26e

Please sign in to comment.