diff --git a/elements/hax-body/lib/hax-store.js b/elements/hax-body/lib/hax-store.js index d60944aa92..98d75b442c 100644 --- a/elements/hax-body/lib/hax-store.js +++ b/elements/hax-body/lib/hax-store.js @@ -2335,7 +2335,7 @@ What did you want merlin to do? var title = `[${type}] User report from HAX daemon`; body = `Location: ${globalThis.location.href} Browser: ${navigator.userAgent} -OS: ${navigator.userAgentData.platform} - ${navigator.deviceMemory}GB RAM - ${navigator.hardwareConcurrency} cores +OS: ${this.getOperatingSystem()} - ${navigator.deviceMemory}GB RAM - ${navigator.hardwareConcurrency} cores Screen: ${globalThis.screen.width}x${globalThis.screen.height} Window size: ${globalThis.innerWidth}x${globalThis.innerHeight} `; @@ -2364,6 +2364,31 @@ Window size: ${globalThis.innerWidth}x${globalThis.innerHeight} ); } + /** + * @description - Gets operating system from browser navigator + * @returns {string} - The operating system either from userAgentData (if supported) with userAgent as back up + */ + getOperatingSystem() { + if (navigator.userAgentData && navigator.userAgentData.platform) { + return navigator.userAgentData.platform; + } else { + const USER_AGENT = navigator.userAgent.toLowerCase(); + if (USER_AGENT.includes('windows')) { + return 'Windows'; + } else if (USER_AGENT.includes('iphone')) { + return 'iOS'; + } else if (USER_AGENT.includes('mac os')) { + return 'macOS'; + } else if (USER_AGENT.includes('linux')) { + return 'Linux'; + } else if (USER_AGENT.includes('android')) { + return 'Android'; + } else { + return 'Unknown'; + } + } + } + async _richTextEditorPromptOpen(e) { if (e.detail.element && e.detail.element.gizmo.tag) { const fakeNode = globalThis.document.createElement( @@ -2427,7 +2452,7 @@ Window size: ${globalThis.innerWidth}x${globalThis.innerHeight} setTimeout(() => { globalThis.HaxStore.requestAvailability().setHaxProperties(globalThis.customElements.get('instruction-card').haxProperties, 'instruction-card'); }, 1000); - }); + }); }); */ _buildPrimitiveDefinitions() {