mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-02 03:16:42 +02:00
Rename "hasTouchSupport" to "userAgentHasTouchSupport"
This commit is contained in:
@@ -277,7 +277,7 @@ function main() {
|
||||
getPref(PrefKey.AUDIO_ENABLE_VOLUME_CONTROL) && patchAudioContext();
|
||||
getPref(PrefKey.BLOCK_TRACKING) && patchMeControl();
|
||||
|
||||
STATES.hasTouchSupport && TouchController.updateCustomList();
|
||||
STATES.userAgentHasTouchSupport && TouchController.updateCustomList();
|
||||
overridePreloadState();
|
||||
|
||||
VibrationManager.initialSetup();
|
||||
|
@@ -41,7 +41,7 @@ export class GameBar {
|
||||
|
||||
this.actions = [
|
||||
new ScreenshotAction(),
|
||||
...(STATES.hasTouchSupport && (getPref(PrefKey.STREAM_TOUCH_CONTROLLER) !== 'off') ? [new TouchControlAction()] : []),
|
||||
...(STATES.userAgentHasTouchSupport && (getPref(PrefKey.STREAM_TOUCH_CONTROLLER) !== 'off') ? [new TouchControlAction()] : []),
|
||||
new MicrophoneAction(),
|
||||
];
|
||||
|
||||
|
@@ -672,7 +672,7 @@ let PATCH_ORDERS: PatchArray = [
|
||||
'remotePlayKeepAlive',
|
||||
'remotePlayDirectConnectUrl',
|
||||
'remotePlayDisableAchievementToast',
|
||||
STATES.hasTouchSupport && 'patchUpdateInputConfigurationAsync',
|
||||
STATES.userAgentHasTouchSupport && 'patchUpdateInputConfigurationAsync',
|
||||
] : []),
|
||||
|
||||
...(BX_FLAGS.EnableXcloudLogging ? [
|
||||
@@ -698,7 +698,7 @@ let PLAYING_PATCH_ORDERS: PatchArray = [
|
||||
// Skip feedback dialog
|
||||
getPref(PrefKey.STREAM_DISABLE_FEEDBACK_DIALOG) && 'skipFeedbackDialog',
|
||||
|
||||
...(STATES.hasTouchSupport ? [
|
||||
...(STATES.userAgentHasTouchSupport ? [
|
||||
getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === 'all' && 'patchShowSensorControls',
|
||||
getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === 'all' && 'exposeTouchLayoutManager',
|
||||
(getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === 'off' || getPref(PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF)) && 'disableTakRenderer',
|
||||
|
@@ -62,8 +62,8 @@ const SETTINGS_UI = {
|
||||
},
|
||||
|
||||
[t('touch-controller')]: {
|
||||
note: !STATES.hasTouchSupport ? '⚠️ ' + t('device-unsupported-touch') : null,
|
||||
unsupported: !STATES.hasTouchSupport,
|
||||
note: !STATES.userAgentHasTouchSupport ? '⚠️ ' + t('device-unsupported-touch') : null,
|
||||
unsupported: !STATES.userAgentHasTouchSupport,
|
||||
items: [
|
||||
PrefKey.STREAM_TOUCH_CONTROLLER,
|
||||
PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF,
|
||||
|
@@ -167,7 +167,7 @@ function setupStreamSettingsDialog() {
|
||||
],
|
||||
},
|
||||
|
||||
STATES.hasTouchSupport && {
|
||||
STATES.userAgentHasTouchSupport && {
|
||||
group: 'touch-controller',
|
||||
label: t('touch-controller'),
|
||||
items: [
|
||||
|
2
src/types/index.d.ts
vendored
2
src/types/index.d.ts
vendored
@@ -28,7 +28,7 @@ type BxStates = {
|
||||
appContext: any | null;
|
||||
serverRegions: any;
|
||||
|
||||
hasTouchSupport: boolean;
|
||||
userAgentHasTouchSupport: boolean;
|
||||
browserHasTouchSupport: boolean;
|
||||
|
||||
currentStream: Partial<{
|
||||
|
@@ -34,7 +34,7 @@ export const BxExposed = {
|
||||
|
||||
titleInfo.details.hasMkbSupport = supportedInputTypes.includes(InputType.MKB);
|
||||
|
||||
if (STATES.hasTouchSupport) {
|
||||
if (STATES.userAgentHasTouchSupport) {
|
||||
let touchControllerAvailability = getPref(PrefKey.STREAM_TOUCH_CONTROLLER);
|
||||
|
||||
// Disable touch control when gamepad found
|
||||
|
@@ -11,13 +11,13 @@ 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 browserHasTouchSupport = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
||||
const hasTouchSupport = !isTv && !isVr && browserHasTouchSupport;
|
||||
const userAgentHasTouchSupport = !isTv && !isVr && browserHasTouchSupport;
|
||||
|
||||
export const STATES: BxStates = {
|
||||
isPlaying: false,
|
||||
appContext: {},
|
||||
serverRegions: {},
|
||||
hasTouchSupport: hasTouchSupport,
|
||||
userAgentHasTouchSupport: userAgentHasTouchSupport,
|
||||
browserHasTouchSupport: browserHasTouchSupport,
|
||||
|
||||
currentStream: {},
|
||||
|
@@ -596,7 +596,7 @@ export function interceptHttpRequests() {
|
||||
}
|
||||
|
||||
// Add list of games with custom layouts to the official list
|
||||
if (STATES.hasTouchSupport && url.includes('catalog.gamepass.com/sigls/')) {
|
||||
if (STATES.userAgentHasTouchSupport && url.includes('catalog.gamepass.com/sigls/')) {
|
||||
const response = await NATIVE_FETCH(request, init);
|
||||
const obj = await response.clone().json();
|
||||
|
||||
|
@@ -263,7 +263,7 @@ export class Preferences {
|
||||
all: t('tc-all-games'),
|
||||
off: t('off'),
|
||||
},
|
||||
unsupported: !STATES.hasTouchSupport,
|
||||
unsupported: !STATES.userAgentHasTouchSupport,
|
||||
ready: (setting: PreferenceSetting) => {
|
||||
if (setting.unsupported) {
|
||||
setting.default = 'default';
|
||||
@@ -273,7 +273,7 @@ export class Preferences {
|
||||
[PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF]: {
|
||||
label: t('tc-auto-off'),
|
||||
default: false,
|
||||
unsupported: !STATES.hasTouchSupport,
|
||||
unsupported: !STATES.userAgentHasTouchSupport,
|
||||
},
|
||||
[PrefKey.STREAM_TOUCH_CONTROLLER_DEFAULT_OPACITY]: {
|
||||
type: SettingElementType.NUMBER_STEPPER,
|
||||
@@ -287,7 +287,7 @@ export class Preferences {
|
||||
ticks: 10,
|
||||
hideSlider: true,
|
||||
},
|
||||
unsupported: !STATES.hasTouchSupport,
|
||||
unsupported: !STATES.userAgentHasTouchSupport,
|
||||
},
|
||||
[PrefKey.STREAM_TOUCH_CONTROLLER_STYLE_STANDARD]: {
|
||||
label: t('tc-standard-layout-style'),
|
||||
@@ -297,7 +297,7 @@ export class Preferences {
|
||||
white: t('tc-all-white'),
|
||||
muted: t('tc-muted-colors'),
|
||||
},
|
||||
unsupported: !STATES.hasTouchSupport,
|
||||
unsupported: !STATES.userAgentHasTouchSupport,
|
||||
},
|
||||
[PrefKey.STREAM_TOUCH_CONTROLLER_STYLE_CUSTOM]: {
|
||||
label: t('tc-custom-layout-style'),
|
||||
@@ -306,7 +306,7 @@ export class Preferences {
|
||||
default: t('default'),
|
||||
muted: t('tc-muted-colors'),
|
||||
},
|
||||
unsupported: !STATES.hasTouchSupport,
|
||||
unsupported: !STATES.userAgentHasTouchSupport,
|
||||
},
|
||||
|
||||
[PrefKey.STREAM_SIMPLIFY_MENU]: {
|
||||
|
@@ -24,7 +24,7 @@ export function overridePreloadState() {
|
||||
}
|
||||
|
||||
// Add list of games with custom layouts to the official list
|
||||
if (STATES.hasTouchSupport) {
|
||||
if (STATES.userAgentHasTouchSupport) {
|
||||
try {
|
||||
const sigls = state.xcloud.sigls;
|
||||
if (GamePassCloudGallery.TOUCH in sigls) {
|
||||
|
Reference in New Issue
Block a user