@@ -285,10 +285,32 @@ class ReactInspectorHostTargetDelegate : public jsinspector_modern::HostTargetDe
285285 ReactInspectorHostTargetDelegate (Mso::WeakPtr<ReactHost> &&reactHost) noexcept : m_reactHost(std::move(reactHost)) {}
286286
287287 jsinspector_modern::HostTargetMetadata getMetadata () override {
288- // TODO: (vmoroz) provide more info
289- return {
290- .integrationName = " React Native Windows (Host)" ,
291- };
288+ jsinspector_modern::HostTargetMetadata metadata{};
289+ metadata.integrationName = " React Native Windows (Host)" ;
290+ metadata.platform = " windows" ;
291+
292+ if (Mso::CntPtr<ReactHost> reactHost = m_reactHost.GetStrongPtr ()) {
293+ const ReactOptions &options = reactHost->Options ();
294+ if (!options.Identity .empty ()) {
295+ std::string identity = options.Identity ;
296+ // Replace illegal characters with underscore
297+ for (char &c : identity) {
298+ if (c == ' \\ ' || c == ' /' || c == ' :' || c == ' *' || c == ' ?' || c == ' "' || c == ' <' || c == ' >' ||
299+ c == ' |' ) {
300+ c = ' _' ;
301+ }
302+ }
303+ metadata.appDisplayName = identity;
304+ }
305+ }
306+
307+ wchar_t computerName[MAX_COMPUTERNAME_LENGTH + 1 ];
308+ DWORD size = MAX_COMPUTERNAME_LENGTH + 1 ;
309+ if (GetComputerNameW (computerName, &size)) {
310+ metadata.deviceName = winrt::to_string (computerName);
311+ }
312+
313+ return metadata;
292314 }
293315
294316 void onReload (jsinspector_modern::HostTargetDelegate::PageReloadRequest const &request) override {
@@ -589,9 +611,20 @@ void ReactHost::AddInspectorPage() noexcept {
589611 jsinspector_modern::InspectorTargetCapabilities capabilities;
590612 capabilities.nativePageReloads = true ;
591613 capabilities.prefersFuseboxFrontend = true ;
592- // TODO: (vmoroz) improve the page name
614+
615+ auto metadata = m_inspectorHostTargetDelegate->getMetadata ();
616+ std::string pageName;
617+ if (metadata.appDisplayName .has_value () && !metadata.appDisplayName .value ().empty ()) {
618+ pageName = metadata.appDisplayName .value ();
619+ } else {
620+ pageName = " React Native Windows (Experimental)" ;
621+ }
622+ if (metadata.deviceName .has_value () && !metadata.deviceName .value ().empty ()) {
623+ pageName += " (" + metadata.deviceName .value () + " )" ;
624+ }
625+
593626 inspectorPageId = jsinspector_modern::getInspectorInstance ().addPage (
594- " React Native Windows (Experimental) " ,
627+ pageName ,
595628 " Hermes" ,
596629 [weakInspectorHostTarget =
597630 std::weak_ptr (m_inspectorHostTarget)](std::unique_ptr<jsinspector_modern::IRemoteConnection> remote)
0 commit comments