Add "IsSupportedTvBrowser" flag

This commit is contained in:
redphx 2024-07-06 16:13:53 +07:00
parent 2b63edb7eb
commit 481b365e6e
2 changed files with 9 additions and 1 deletions

View File

@ -11,6 +11,8 @@ type BxFlags = Partial<{
FeatureGates: {[key: string]: boolean} | null, FeatureGates: {[key: string]: boolean} | null,
ScriptUi: 'default' | 'tv', ScriptUi: 'default' | 'tv',
IsSupportedTvBrowser: boolean,
}> }>
// Setup flags // Setup flags

View File

@ -1,5 +1,6 @@
import { UserAgentProfile } from "@enums/user-agent"; import { UserAgentProfile } from "@enums/user-agent";
import { deepClone } from "./global"; import { deepClone } from "./global";
import { BX_FLAGS } from "./bx-flags";
type UserAgentConfig = { type UserAgentConfig = {
profile: UserAgentProfile, profile: UserAgentProfile,
@ -116,7 +117,12 @@ export class UserAgent {
return; return;
} }
const newUserAgent = UserAgent.get(profile); let newUserAgent = UserAgent.get(profile);
// Pretend to be Tizen TV
if (BX_FLAGS.IsSupportedTvBrowser) {
newUserAgent += 'SmartTV FC4A1DA2-711C-4E9C-BC7F-047AF8A672EA';
}
// Clear data of navigator.userAgentData, force xCloud to detect browser based on navigator.userAgent // Clear data of navigator.userAgentData, force xCloud to detect browser based on navigator.userAgent
(window.navigator as any).orgUserAgentData = (window.navigator as any).userAgentData; (window.navigator as any).orgUserAgentData = (window.navigator as any).userAgentData;