Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): fixed an issue where some part of devtools were not available #3670

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading