Skip to content

Commit

Permalink
fix(devtools): fix network debug information for ios in chrome devtool (
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyunong authored and zealotchen0 committed Nov 6, 2024
1 parent 0a89614 commit 38d92f8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions framework/ios/base/executors/HippyJSExecutor.mm
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,7 @@ - (void)injectDeviceInfoAsHippyNativeGlobal:(HippyBridge *)bridge
context:(const std::shared_ptr<hippy::Ctx> &)context
globalObject:(const std::shared_ptr<hippy::CtxValue> &)globalObject {
NSMutableDictionary *deviceInfo = [NSMutableDictionary dictionaryWithDictionary:[bridge deviceInfo]];
NSString *deviceName = [[UIDevice currentDevice] name];
NSString *clientId = HippyMD5Hash([NSString stringWithFormat:@"%@%p", deviceName, self]);
NSDictionary *debugInfo = @{@"Debug" : @{@"debugClientId" : clientId}};
NSDictionary *debugInfo = @{@"Debug" : @{@"debugClientId" : [self getClientID]}};
[deviceInfo addEntriesFromDictionary:debugInfo];

auto key = context->CreateString(kHippyNativeGlobalKey);
Expand Down Expand Up @@ -354,6 +352,12 @@ - (void)registerGetTurboModuleFuncToJS:(const std::shared_ptr<hippy::Ctx> &)cont

#pragma mark -

- (NSString *)getClientID {
NSString *deviceName = [[UIDevice currentDevice] name];
NSString *clientId = HippyMD5Hash([NSString stringWithFormat:@"%@%p", deviceName, self]);
return clientId;
}

- (void)setUriLoader:(std::weak_ptr<hippy::vfs::UriLoader>)uriLoader {
if (self.pScope->GetUriLoader().lock() != uriLoader.lock()) {
self.pScope->SetUriLoader(uriLoader);
Expand Down Expand Up @@ -769,9 +773,7 @@ - (NSString *)completeWSURLWithBridge:(HippyBridge *)bridge {
devInfo.versionId = bundleURLProvider.versionId;
devInfo.wsURL = bundleURLProvider.wsURL;
}
NSString *deviceName = [[UIDevice currentDevice] name];
NSString *clientId = HippyMD5Hash([NSString stringWithFormat:@"%@%p", deviceName, bridge]);
return [devInfo assembleFullWSURLWithClientId:clientId contextName:bridge.contextName];
return [devInfo assembleFullWSURLWithClientId:[self getClientID] contextName:bridge.contextName];
}


Expand Down

0 comments on commit 38d92f8

Please sign in to comment.