Skip to content

Commit

Permalink
Merge pull request #705 from zdodson21/master
Browse files Browse the repository at this point in the history
Fixes #2075
  • Loading branch information
btopro authored Nov 21, 2024
2 parents ea8f79a + fd6c77e commit 43ca51b
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions elements/hax-body/lib/hax-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
`;
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 43ca51b

Please sign in to comment.