Improve isMobile API

This commit is contained in:
Alexandru Branza 2023-05-29 18:04:11 +03:00
parent c9347885e0
commit 4f82b85d0c
2 changed files with 9 additions and 6 deletions

View file

@ -4,8 +4,11 @@ const Bowser = require('bowser');
const browser = Bowser.parse(window.navigator?.userAgent || '');
module.exports = () => {
if (browser?.os?.name === 'iOS') return 'ios';
if (browser?.os?.name === 'Android') return 'android';
return false;
const platform = (browser?.os?.name || 'unknown').toLowerCase();
module.exports = {
platform,
check: () => {
return platform === 'ios' || platform === 'android';
}
};

View file

@ -15,8 +15,8 @@ const Stream = ({ className, addonName, name, description, thumbnail, progress,
const href = React.useMemo(() => {
return deepLinks ?
profile.settings.playerType === 'external' ?
isMobile() || !haveStreamingServer ?
deepLinks.externalPlayer.vlc[isMobile()] || deepLinks.externalPlayer.streaming
isMobile.check() || !haveStreamingServer ?
deepLinks.externalPlayer.vlc[isMobile.platform] || deepLinks.externalPlayer.streaming
: 'javascript:void(0);' // handled in StreamsList.js onClick
:
typeof deepLinks.player === 'string' ?