a693133b5a
There are a couple of hardcoded UA checks targeted at iOS endpoints introduced circa 2.2-beta. One of those pops up an "unsupported" toast when the device joins a conference - the other blocks camera sharing. Those checks are outdated since we transitioned to minBrowserVersions approach that redirects the client to an unsupported view upon join. I also assume the checks are bugged since, in some environments, it flags iPadOS endpoints as iOS and version-checks it to a hardcoded "12.2" threshold (which is incompatible with iPadOS versioning). That caused camera sharing not to work, which is a false negative. I consider the checks to be outdated, so I removed all references to them.
31 lines
889 B
JavaScript
Executable File
31 lines
889 B
JavaScript
Executable File
import Bowser from 'bowser';
|
|
|
|
const userAgent = window.navigator.userAgent;
|
|
const BOWSER_RESULTS = Bowser.parse(userAgent);
|
|
|
|
const isPhone = BOWSER_RESULTS.platform.type === 'mobile';
|
|
// we need a 'hack' to correctly detect ipads with ios > 13
|
|
const isTablet = BOWSER_RESULTS.platform.type === 'tablet' || (BOWSER_RESULTS.os.name === 'macOS' && window.navigator.maxTouchPoints > 0);
|
|
const isMobile = isPhone || isTablet;
|
|
const hasMediaDevices = !!navigator.mediaDevices;
|
|
const osName = BOWSER_RESULTS.os.name;
|
|
const isIos = osName === 'iOS' || (isTablet && osName=="macOS");
|
|
const isMacos = osName === 'macOS';
|
|
const isIphone = !!(userAgent.match(/iPhone/i));
|
|
|
|
const isPortrait = () => window.innerHeight > window.innerWidth;
|
|
|
|
const deviceInfo = {
|
|
isTablet,
|
|
isPhone,
|
|
isMobile,
|
|
hasMediaDevices,
|
|
osName,
|
|
isPortrait,
|
|
isIos,
|
|
isMacos,
|
|
isIphone,
|
|
};
|
|
|
|
export default deviceInfo;
|