mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
Minor fixes
This commit is contained in:
parent
9fad2914ac
commit
361ce057b7
@ -19,7 +19,7 @@ export class ProductDetailsPage {
|
|||||||
private static shortcutTimeoutId: number | null = null;
|
private static shortcutTimeoutId: number | null = null;
|
||||||
|
|
||||||
static injectShortcutButton() {
|
static injectShortcutButton() {
|
||||||
if (!AppInterface || BX_FLAGS.DeviceInfo!.deviceType !== 'android') {
|
if (!AppInterface || BX_FLAGS.DeviceInfo.deviceType !== 'android') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
type BxFlags = Partial<{
|
type BxFlags = {
|
||||||
CheckForUpdate: boolean;
|
CheckForUpdate: boolean;
|
||||||
EnableXcloudLogging: boolean;
|
EnableXcloudLogging: boolean;
|
||||||
SafariWorkaround: boolean;
|
SafariWorkaround: boolean;
|
||||||
@ -6,13 +6,11 @@ type BxFlags = Partial<{
|
|||||||
ForceNativeMkbTitles: string[];
|
ForceNativeMkbTitles: string[];
|
||||||
FeatureGates: {[key: string]: boolean} | null,
|
FeatureGates: {[key: string]: boolean} | null,
|
||||||
|
|
||||||
IsSupportedTvBrowser: boolean,
|
DeviceInfo: {
|
||||||
|
|
||||||
DeviceInfo: Partial<{
|
|
||||||
deviceType: 'android' | 'android-tv' | 'webos' | 'unknown',
|
deviceType: 'android' | 'android-tv' | 'webos' | 'unknown',
|
||||||
userAgent?: string,
|
userAgent?: string,
|
||||||
}>,
|
}
|
||||||
}>
|
}
|
||||||
|
|
||||||
// Setup flags
|
// Setup flags
|
||||||
const DEFAULT_FLAGS: BxFlags = {
|
const DEFAULT_FLAGS: BxFlags = {
|
||||||
@ -33,8 +31,8 @@ try {
|
|||||||
delete window.BX_FLAGS;
|
delete window.BX_FLAGS;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
if (!BX_FLAGS.DeviceInfo!.userAgent) {
|
if (!BX_FLAGS.DeviceInfo.userAgent) {
|
||||||
BX_FLAGS.DeviceInfo!.userAgent = window.navigator.userAgent;
|
BX_FLAGS.DeviceInfo.userAgent = window.navigator.userAgent;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const NATIVE_FETCH = window.fetch;
|
export const NATIVE_FETCH = window.fetch;
|
||||||
|
@ -457,7 +457,7 @@ export class GlobalSettingsStorage extends BaseSettingsStorage {
|
|||||||
|
|
||||||
[PrefKey.UI_CONTROLLER_FRIENDLY]: {
|
[PrefKey.UI_CONTROLLER_FRIENDLY]: {
|
||||||
label: t('controller-friendly-ui'),
|
label: t('controller-friendly-ui'),
|
||||||
default: BX_FLAGS.DeviceInfo!.deviceType !== 'unknown',
|
default: BX_FLAGS.DeviceInfo.deviceType !== 'unknown',
|
||||||
},
|
},
|
||||||
|
|
||||||
[PrefKey.UI_LAYOUT]: {
|
[PrefKey.UI_LAYOUT]: {
|
||||||
@ -512,7 +512,7 @@ export class GlobalSettingsStorage extends BaseSettingsStorage {
|
|||||||
[PrefKey.USER_AGENT_PROFILE]: {
|
[PrefKey.USER_AGENT_PROFILE]: {
|
||||||
label: t('user-agent-profile'),
|
label: t('user-agent-profile'),
|
||||||
note: '⚠️ ' + t('unexpected-behavior'),
|
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: {
|
options: {
|
||||||
[UserAgentProfile.DEFAULT]: t('default'),
|
[UserAgentProfile.DEFAULT]: t('default'),
|
||||||
[UserAgentProfile.WINDOWS_EDGE]: 'Edge + Windows',
|
[UserAgentProfile.WINDOWS_EDGE]: 'Edge + Windows',
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { UserAgentProfile } from "@enums/user-agent";
|
import { UserAgentProfile } from "@enums/user-agent";
|
||||||
import { BX_FLAGS } from "./bx-flags";
|
|
||||||
|
|
||||||
type UserAgentConfig = {
|
type UserAgentConfig = {
|
||||||
profile: UserAgentProfile,
|
profile: UserAgentProfile,
|
||||||
@ -120,11 +119,6 @@ export class UserAgent {
|
|||||||
|
|
||||||
let newUserAgent = UserAgent.get(profile);
|
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
|
// Clear data of navigator.userAgentData, force xCloud to detect browser based on navigator.userAgent
|
||||||
if ('userAgentData' in window.navigator) {
|
if ('userAgentData' in window.navigator) {
|
||||||
(window.navigator as any).orgUserAgentData = (window.navigator as any).userAgentData;
|
(window.navigator as any).orgUserAgentData = (window.navigator as any).userAgentData;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user