diff --git a/src/modules/ui/product-details.ts b/src/modules/ui/product-details.ts index db0d98e..b9d1bfd 100644 --- a/src/modules/ui/product-details.ts +++ b/src/modules/ui/product-details.ts @@ -19,7 +19,7 @@ export class ProductDetailsPage { private static shortcutTimeoutId: number | null = null; static injectShortcutButton() { - if (!AppInterface || BX_FLAGS.DeviceInfo!.deviceType !== 'android') { + if (!AppInterface || BX_FLAGS.DeviceInfo.deviceType !== 'android') { return; } diff --git a/src/utils/bx-flags.ts b/src/utils/bx-flags.ts index d2c2d08..51414db 100644 --- a/src/utils/bx-flags.ts +++ b/src/utils/bx-flags.ts @@ -1,4 +1,4 @@ -type BxFlags = Partial<{ +type BxFlags = { CheckForUpdate: boolean; EnableXcloudLogging: boolean; SafariWorkaround: boolean; @@ -6,13 +6,11 @@ type BxFlags = Partial<{ ForceNativeMkbTitles: string[]; FeatureGates: {[key: string]: boolean} | null, - IsSupportedTvBrowser: boolean, - - DeviceInfo: Partial<{ + DeviceInfo: { deviceType: 'android' | 'android-tv' | 'webos' | 'unknown', userAgent?: string, - }>, -}> + } +} // Setup flags const DEFAULT_FLAGS: BxFlags = { @@ -33,8 +31,8 @@ try { delete window.BX_FLAGS; } catch (e) {} -if (!BX_FLAGS.DeviceInfo!.userAgent) { - BX_FLAGS.DeviceInfo!.userAgent = window.navigator.userAgent; +if (!BX_FLAGS.DeviceInfo.userAgent) { + BX_FLAGS.DeviceInfo.userAgent = window.navigator.userAgent; } export const NATIVE_FETCH = window.fetch; diff --git a/src/utils/settings-storages/global-settings-storage.ts b/src/utils/settings-storages/global-settings-storage.ts index 572ab6c..0cc50a0 100644 --- a/src/utils/settings-storages/global-settings-storage.ts +++ b/src/utils/settings-storages/global-settings-storage.ts @@ -457,7 +457,7 @@ export class GlobalSettingsStorage extends BaseSettingsStorage { [PrefKey.UI_CONTROLLER_FRIENDLY]: { label: t('controller-friendly-ui'), - default: BX_FLAGS.DeviceInfo!.deviceType !== 'unknown', + default: BX_FLAGS.DeviceInfo.deviceType !== 'unknown', }, [PrefKey.UI_LAYOUT]: { @@ -512,7 +512,7 @@ export class GlobalSettingsStorage extends BaseSettingsStorage { [PrefKey.USER_AGENT_PROFILE]: { label: t('user-agent-profile'), note: '⚠️ ' + t('unexpected-behavior'), - default: BX_FLAGS.DeviceInfo!.deviceType === 'android-tv' ? UserAgentProfile.VR_OCULUS : 'default', + default: (BX_FLAGS.DeviceInfo.deviceType === 'android-tv' || BX_FLAGS.DeviceInfo.deviceType === 'webos') ? UserAgentProfile.VR_OCULUS : 'default', options: { [UserAgentProfile.DEFAULT]: t('default'), [UserAgentProfile.WINDOWS_EDGE]: 'Edge + Windows', diff --git a/src/utils/user-agent.ts b/src/utils/user-agent.ts index 907a7bd..336ff72 100644 --- a/src/utils/user-agent.ts +++ b/src/utils/user-agent.ts @@ -1,5 +1,4 @@ import { UserAgentProfile } from "@enums/user-agent"; -import { BX_FLAGS } from "./bx-flags"; type UserAgentConfig = { profile: UserAgentProfile, @@ -120,11 +119,6 @@ export class UserAgent { let newUserAgent = UserAgent.get(profile); - // Pretend to be Tizen TV - if (BX_FLAGS.IsSupportedTvBrowser) { - newUserAgent += ` SmartTV ${SMART_TV_UNIQUE_ID}`; - } - // Clear data of navigator.userAgentData, force xCloud to detect browser based on navigator.userAgent if ('userAgentData' in window.navigator) { (window.navigator as any).orgUserAgentData = (window.navigator as any).userAgentData;