mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 02:22:09 +00:00
feat: detect vision os as a platform
This commit is contained in:
parent
8d18820ca1
commit
f442df8f52
1 changed files with 11 additions and 5 deletions
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright (C) 2017-2023 Smart code 203358507
|
||||
// Copyright (C) 2017-2024 Smart code 203358507
|
||||
|
||||
// this detects ipad properly in safari
|
||||
// while bowser does not
|
||||
function iOS() {
|
||||
const iOS = () => {
|
||||
return [
|
||||
'iPad Simulator',
|
||||
'iPhone Simulator',
|
||||
|
|
@ -11,14 +11,20 @@ function iOS() {
|
|||
'iPhone',
|
||||
'iPod'
|
||||
].includes(navigator.platform)
|
||||
|| (navigator.userAgent.includes('Mac') && 'ontouchend' in document);
|
||||
}
|
||||
|| (navigator.userAgent.includes('Mac') && 'ontouchend' in document);
|
||||
};
|
||||
|
||||
const Bowser = require('bowser');
|
||||
|
||||
const browser = Bowser.parse(window.navigator?.userAgent || '');
|
||||
|
||||
const name = iOS() ? 'ios' : (browser?.os?.name || 'unknown').toLowerCase();
|
||||
const isVisionProUser = () => {
|
||||
const isMacintosh = navigator.userAgent.includes('Macintosh');
|
||||
const hasFiveTouchPoints = navigator.maxTouchPoints === 5;
|
||||
return isMacintosh && hasFiveTouchPoints;
|
||||
};
|
||||
|
||||
const name = isVisionProUser() ? 'visionos' : (iOS() ? 'ios' : (browser?.os?.name || 'unknown').toLowerCase());
|
||||
|
||||
module.exports = {
|
||||
name,
|
||||
|
|
|
|||
Loading…
Reference in a new issue