mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
34 lines
932 B
JavaScript
34 lines
932 B
JavaScript
// Copyright (C) 2017-2024 Smart code 203358507
|
|
|
|
// this detects ipad properly in safari
|
|
// while bowser does not
|
|
const iOS = () => {
|
|
return [
|
|
'iPad Simulator',
|
|
'iPhone Simulator',
|
|
'iPod Simulator',
|
|
'iPad',
|
|
'iPhone',
|
|
'iPod'
|
|
].includes(navigator.platform)
|
|
|| (navigator.userAgent.includes('Mac') && 'ontouchend' in document);
|
|
};
|
|
|
|
const Bowser = require('bowser');
|
|
|
|
const browser = Bowser.parse(window.navigator?.userAgent || '');
|
|
|
|
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,
|
|
isMobile: () => {
|
|
return name === 'ios' || name === 'android';
|
|
}
|
|
};
|