mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 16:17:20 +02:00
Show "Stream settings" and "App settings" in the Guide menu
This commit is contained in:
parent
6de235ce2f
commit
986d9fe088
@ -635,6 +635,16 @@ true` + text;
|
|||||||
str = str.replace(text, 'if (!e) e = "https://www.xbox.com";');
|
str = str.replace(text, 'if (!e) e = "https://www.xbox.com";');
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
exposeDialogRoutes(str: string) {
|
||||||
|
const text = 'return{goBack:function(){';
|
||||||
|
if (!str.includes(text)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
str = str.replace(text, 'return window.BX_EXPOSED.dialogRoutes = {goBack:function(){');
|
||||||
|
return str;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let PATCH_ORDERS: PatchArray = [
|
let PATCH_ORDERS: PatchArray = [
|
||||||
@ -652,6 +662,7 @@ let PATCH_ORDERS: PatchArray = [
|
|||||||
'broadcastPollingMode',
|
'broadcastPollingMode',
|
||||||
|
|
||||||
'exposeStreamSession',
|
'exposeStreamSession',
|
||||||
|
'exposeDialogRoutes',
|
||||||
|
|
||||||
getPref(PrefKey.UI_LAYOUT) !== 'default' && 'websiteLayout',
|
getPref(PrefKey.UI_LAYOUT) !== 'default' && 'websiteLayout',
|
||||||
getPref(PrefKey.LOCAL_CO_OP_ENABLED) && 'supportLocalCoOp',
|
getPref(PrefKey.LOCAL_CO_OP_ENABLED) && 'supportLocalCoOp',
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { BxEvent } from "@/utils/bx-event";
|
import { BxEvent } from "@/utils/bx-event";
|
||||||
import { AppInterface, STATES } from "@/utils/global";
|
import { AppInterface, STATES } from "@/utils/global";
|
||||||
import { createButton, ButtonStyle } from "@/utils/html";
|
import { createButton, ButtonStyle, CE } from "@/utils/html";
|
||||||
import { t } from "@/utils/translation";
|
import { t } from "@/utils/translation";
|
||||||
|
import { StreamSettings } from "../stream/stream-settings";
|
||||||
|
|
||||||
export enum GuideMenuTab {
|
export enum GuideMenuTab {
|
||||||
HOME,
|
HOME,
|
||||||
@ -14,20 +15,52 @@ export class GuideMenu {
|
|||||||
if (!$dividers) {
|
if (!$dividers) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const $lastDivider = $dividers[$dividers.length - 1];
|
|
||||||
|
|
||||||
// Add "Close app" button
|
const buttons = [];
|
||||||
|
|
||||||
|
// "Stream settings" button
|
||||||
|
buttons.push(createButton({
|
||||||
|
label: t('stream-settings'),
|
||||||
|
style: ButtonStyle.FULL_WIDTH | ButtonStyle.FOCUSABLE,
|
||||||
|
onClick: e => {
|
||||||
|
// Close all xCloud's dialogs
|
||||||
|
window.BX_EXPOSED.dialogRoutes.closeAll();
|
||||||
|
|
||||||
|
StreamSettings.getInstance().show();
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
// "App settings" & "Close app" buttons
|
||||||
if (AppInterface) {
|
if (AppInterface) {
|
||||||
const $btnQuit = createButton({
|
buttons.push(createButton({
|
||||||
|
label: t('android-app-settings'),
|
||||||
|
style: ButtonStyle.FULL_WIDTH | ButtonStyle.FOCUSABLE,
|
||||||
|
onClick: e => {
|
||||||
|
AppInterface.openAppSettings && AppInterface.openAppSettings();
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
buttons.push(createButton({
|
||||||
label: t('close-app'),
|
label: t('close-app'),
|
||||||
style: ButtonStyle.FULL_WIDTH | ButtonStyle.FOCUSABLE | ButtonStyle.DANGER,
|
style: ButtonStyle.FULL_WIDTH | ButtonStyle.FOCUSABLE | ButtonStyle.DANGER,
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
AppInterface.closeApp();
|
AppInterface.closeApp();
|
||||||
},
|
},
|
||||||
});
|
}));
|
||||||
|
|
||||||
$lastDivider.insertAdjacentElement('afterend', $btnQuit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!buttons.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const $div = CE('div', {});
|
||||||
|
|
||||||
|
for (const $button of buttons) {
|
||||||
|
$div.appendChild($button);
|
||||||
|
}
|
||||||
|
|
||||||
|
const $lastDivider = $dividers[$dividers.length - 1];
|
||||||
|
$lastDivider.insertAdjacentElement('afterend', $div);
|
||||||
}
|
}
|
||||||
|
|
||||||
static #injectHomePlaying($root: HTMLElement) {
|
static #injectHomePlaying($root: HTMLElement) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user