mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
App option to disable context menu in Home page
This commit is contained in:
parent
afd851861a
commit
88b63a5518
@ -84,6 +84,7 @@ const SETTINGS_UI = {
|
|||||||
[t('ui')]: {
|
[t('ui')]: {
|
||||||
items: [
|
items: [
|
||||||
PrefKey.UI_LAYOUT,
|
PrefKey.UI_LAYOUT,
|
||||||
|
PrefKey.UI_HOME_CONTEXT_MENU_DISABLED,
|
||||||
PrefKey.STREAM_SIMPLIFY_MENU,
|
PrefKey.STREAM_SIMPLIFY_MENU,
|
||||||
PrefKey.SKIP_SPLASH_VIDEO,
|
PrefKey.SKIP_SPLASH_VIDEO,
|
||||||
!AppInterface && PrefKey.UI_SCROLLBAR_HIDE,
|
!AppInterface && PrefKey.UI_SCROLLBAR_HIDE,
|
||||||
|
@ -565,6 +565,29 @@ export function interceptHttpRequests() {
|
|||||||
BxEvent.dispatch(window, BxEvent.STREAM_STARTING);
|
BxEvent.dispatch(window, BxEvent.STREAM_STARTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Override experimentals
|
||||||
|
if (url.startsWith('https://emerald.xboxservices.com/xboxcomfd/experimentation')) {
|
||||||
|
try {
|
||||||
|
const response = await NATIVE_FETCH(request, init);
|
||||||
|
const json = await response.json();
|
||||||
|
|
||||||
|
const overrideTreatments: {[key: string]: boolean} = {};
|
||||||
|
|
||||||
|
if (getPref(PrefKey.UI_HOME_CONTEXT_MENU_DISABLED)) {
|
||||||
|
overrideTreatments['EnableHomeContextMenu'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const key in overrideTreatments) {
|
||||||
|
json.exp.treatments[key] = overrideTreatments[key]
|
||||||
|
}
|
||||||
|
|
||||||
|
response.json = () => Promise.resolve(json);
|
||||||
|
return response;
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add list of games with custom layouts to the official list
|
// Add list of games with custom layouts to the official list
|
||||||
if (STATES.hasTouchSupport && url.includes('catalog.gamepass.com/sigls/')) {
|
if (STATES.hasTouchSupport && url.includes('catalog.gamepass.com/sigls/')) {
|
||||||
const response = await NATIVE_FETCH(request, init);
|
const response = await NATIVE_FETCH(request, init);
|
||||||
|
@ -65,6 +65,8 @@ export enum PrefKey {
|
|||||||
UI_LAYOUT = 'ui_layout',
|
UI_LAYOUT = 'ui_layout',
|
||||||
UI_SCROLLBAR_HIDE = 'ui_scrollbar_hide',
|
UI_SCROLLBAR_HIDE = 'ui_scrollbar_hide',
|
||||||
|
|
||||||
|
UI_HOME_CONTEXT_MENU_DISABLED = 'ui_home_context_menu_disabled',
|
||||||
|
|
||||||
VIDEO_CLARITY = 'video_clarity',
|
VIDEO_CLARITY = 'video_clarity',
|
||||||
VIDEO_RATIO = 'video_ratio',
|
VIDEO_RATIO = 'video_ratio',
|
||||||
VIDEO_BRIGHTNESS = 'video_brightness',
|
VIDEO_BRIGHTNESS = 'video_brightness',
|
||||||
@ -470,6 +472,11 @@ export class Preferences {
|
|||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
[PrefKey.UI_HOME_CONTEXT_MENU_DISABLED]: {
|
||||||
|
label: t('disable-home-context-menu'),
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
|
||||||
[PrefKey.BLOCK_SOCIAL_FEATURES]: {
|
[PrefKey.BLOCK_SOCIAL_FEATURES]: {
|
||||||
label: t('disable-social-features'),
|
label: t('disable-social-features'),
|
||||||
default: false,
|
default: false,
|
||||||
|
@ -2,6 +2,7 @@ import { STATES } from "@utils/global";
|
|||||||
import { BxLogger } from "./bx-logger";
|
import { BxLogger } from "./bx-logger";
|
||||||
import { TouchController } from "@modules/touch-controller";
|
import { TouchController } from "@modules/touch-controller";
|
||||||
import { GamePassCloudGallery } from "./gamepass-gallery";
|
import { GamePassCloudGallery } from "./gamepass-gallery";
|
||||||
|
import { getPref, PrefKey } from "./preferences";
|
||||||
|
|
||||||
const LOG_TAG = 'PreloadState';
|
const LOG_TAG = 'PreloadState';
|
||||||
|
|
||||||
@ -41,6 +42,14 @@ export function overridePreloadState() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getPref(PrefKey.UI_HOME_CONTEXT_MENU_DISABLED)) {
|
||||||
|
try {
|
||||||
|
state.experiments.experimentationInfo.data.treatments.EnableHomeContextMenu = false;
|
||||||
|
} catch (e) {
|
||||||
|
BxLogger.error(LOG_TAG, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
_state = state;
|
_state = state;
|
||||||
STATES.appContext = structuredClone(state.appContext);
|
STATES.appContext = structuredClone(state.appContext);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user