@@ -326,10 +326,32 @@ class ReactInspectorHostTargetDelegate : public jsinspector_modern::HostTargetDe
326326 ReactInspectorHostTargetDelegate (Mso::WeakPtr<ReactHost> &&reactHost) noexcept : m_reactHost(std::move(reactHost)) {}
327327
328328 jsinspector_modern::HostTargetMetadata getMetadata () override {
329- // TODO: (vmoroz) provide more info
330- return {
331- .integrationName = " React Native Windows (Host)" ,
332- };
329+ jsinspector_modern::HostTargetMetadata metadata{};
330+ metadata.integrationName = " React Native Windows (Host)" ;
331+ metadata.platform = " windows" ;
332+
333+ if (Mso::CntPtr<ReactHost> reactHost = m_reactHost.GetStrongPtr ()) {
334+ const ReactOptions &options = reactHost->Options ();
335+ if (!options.Identity .empty ()) {
336+ std::string identity = options.Identity ;
337+ // Replace illegal characters with underscore
338+ for (char &c : identity) {
339+ if (c == ' \\ ' || c == ' /' || c == ' :' || c == ' *' || c == ' ?' || c == ' "' || c == ' <' || c == ' >' ||
340+ c == ' |' ) {
341+ c = ' _' ;
342+ }
343+ }
344+ metadata.appDisplayName = identity;
345+ }
346+ }
347+
348+ wchar_t computerName[MAX_COMPUTERNAME_LENGTH + 1 ];
349+ DWORD size = MAX_COMPUTERNAME_LENGTH + 1 ;
350+ if (GetComputerNameW (computerName, &size)) {
351+ metadata.deviceName = winrt::to_string (computerName);
352+ }
353+
354+ return metadata;
333355 }
334356
335357 void onReload (jsinspector_modern::HostTargetDelegate::PageReloadRequest const &request) override {
@@ -630,9 +652,20 @@ void ReactHost::AddInspectorPage() noexcept {
630652 jsinspector_modern::InspectorTargetCapabilities capabilities;
631653 capabilities.nativePageReloads = true ;
632654 capabilities.prefersFuseboxFrontend = true ;
633- // TODO: (vmoroz) improve the page name
655+
656+ auto metadata = m_inspectorHostTargetDelegate->getMetadata ();
657+ std::string pageName;
658+ if (metadata.appDisplayName .has_value () && !metadata.appDisplayName .value ().empty ()) {
659+ pageName = metadata.appDisplayName .value ();
660+ } else {
661+ pageName = " React Native Windows (Experimental)" ;
662+ }
663+ if (metadata.deviceName .has_value () && !metadata.deviceName .value ().empty ()) {
664+ pageName += " (" + metadata.deviceName .value () + " )" ;
665+ }
666+
634667 inspectorPageId = jsinspector_modern::getInspectorInstance ().addPage (
635- " React Native Windows (Experimental) " ,
668+ pageName ,
636669 " Hermes" ,
637670 [weakInspectorHostTarget =
638671 std::weak_ptr (m_inspectorHostTarget)](std::unique_ptr<jsinspector_modern::IRemoteConnection> remote)
0 commit comments