From b3033089ed86624205959ce4c130e9d054b2dacd Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Sat, 11 May 2024 10:47:29 +0700 Subject: [PATCH] Fix unexpected behavior with Stream bar when using Quest VR profile --- src/modules/stream/stream-ui.ts | 2 +- src/types/index.d.ts | 2 ++ src/utils/global.ts | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/stream/stream-ui.ts b/src/modules/stream/stream-ui.ts index 3fca5b7..bf94531 100644 --- a/src/modules/stream/stream-ui.ts +++ b/src/modules/stream/stream-ui.ts @@ -35,7 +35,7 @@ function cloneStreamHudButton($orgButton: HTMLElement, label: string, svgIcon: t } }; - if (STATES.hasTouchSupport) { + if (STATES.browserHasTouchSupport) { $container.addEventListener('transitionstart', onTransitionStart); $container.addEventListener('transitionend', onTransitionEnd); } diff --git a/src/types/index.d.ts b/src/types/index.d.ts index bc94f5f..ea1e741 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -27,7 +27,9 @@ type BxStates = { isPlaying: boolean; appContext: any | null; serverRegions: any; + hasTouchSupport: boolean; + browserHasTouchSupport: boolean; currentStream: Partial<{ titleId: string; diff --git a/src/utils/global.ts b/src/utils/global.ts index de7cc04..82d5cc3 100644 --- a/src/utils/global.ts +++ b/src/utils/global.ts @@ -10,13 +10,15 @@ const userAgent = window.navigator.userAgent.toLowerCase(); const isTv = userAgent.includes('smart-tv') || userAgent.includes('smarttv') || /\baft.*\b/.test(userAgent); const isVr = window.navigator.userAgent.includes('VR') && window.navigator.userAgent.includes('OculusBrowser'); -const hasTouchSupport = !isTv && !isVr && ('ontouchstart' in window || navigator.maxTouchPoints > 0); +const browserHasTouchSupport = 'ontouchstart' in window || navigator.maxTouchPoints > 0; +const hasTouchSupport = !isTv && !isVr && browserHasTouchSupport; export const STATES: BxStates = { isPlaying: false, appContext: {}, serverRegions: {}, hasTouchSupport: hasTouchSupport, + browserHasTouchSupport: browserHasTouchSupport, currentStream: {}, remotePlay: {},