Rename "touchLayoutManager" and "testTouchLayout"

This commit is contained in:
redphx 2024-05-08 17:11:15 +07:00
parent 26bf14eda6
commit 500f6671c6
3 changed files with 9 additions and 9 deletions

View File

@ -285,7 +285,7 @@ if (window.BX_VIBRATION_INTENSITY && window.BX_VIBRATION_INTENSITY < 1) {
return false; return false;
} }
str = str.replace(text, 'window.BX_EXPOSED["touch_layout_manager"] = this,' + text); str = str.replace(text, 'window.BX_EXPOSED["touchLayoutManager"] = this,' + text);
return str; return str;
}, },

View File

@ -103,7 +103,7 @@ export class TouchController {
retries = retries || 1; retries = retries || 1;
if (retries > 2) { if (retries > 2) {
TouchController.#customLayouts[xboxTitleId] = null; TouchController.#customLayouts[xboxTitleId] = null;
// Wait for BX_EXPOSED.touch_layout_manager // Wait for BX_EXPOSED.touchLayoutManager
window.setTimeout(() => TouchController.#dispatchLayouts(null), 1000); window.setTimeout(() => TouchController.#dispatchLayouts(null), 1000);
return; return;
} }
@ -139,7 +139,7 @@ export class TouchController {
json.layouts = layouts; json.layouts = layouts;
TouchController.#customLayouts[xboxTitleId] = json; TouchController.#customLayouts[xboxTitleId] = json;
// Wait for BX_EXPOSED.touch_layout_manager // Wait for BX_EXPOSED.touchLayoutManager
window.setTimeout(() => TouchController.#dispatchLayouts(json), 1000); window.setTimeout(() => TouchController.#dispatchLayouts(json), 1000);
} catch (e) { } catch (e) {
// Retry // Retry
@ -148,7 +148,7 @@ export class TouchController {
} }
static loadCustomLayout(xboxTitleId: string, layoutId: string, delay: number=0) { static loadCustomLayout(xboxTitleId: string, layoutId: string, delay: number=0) {
if (!window.BX_EXPOSED.touch_layout_manager) { if (!window.BX_EXPOSED.touchLayoutManager) {
return; return;
} }
@ -181,7 +181,7 @@ export class TouchController {
layoutChanged && Toast.show(msg, layout.name, {html: html}); layoutChanged && Toast.show(msg, layout.name, {html: html});
window.setTimeout(() => { window.setTimeout(() => {
window.BX_EXPOSED.touch_layout_manager.changeLayoutForScope({ window.BX_EXPOSED.touchLayoutManager.changeLayoutForScope({
type: 'showLayout', type: 'showLayout',
scope: xboxTitleId, scope: xboxTitleId,
subscope: 'base', subscope: 'base',
@ -208,10 +208,10 @@ export class TouchController {
static setup() { static setup() {
// Function for testing touch control // Function for testing touch control
window.BX_EXPOSED.test_touch_control = (layout: any) => { (window as any).testTouchLayout = (layout: any) => {
const { touch_layout_manager } = window.BX_EXPOSED; const { touchLayoutManager } = window.BX_EXPOSED;
touch_layout_manager && touch_layout_manager.changeLayoutForScope({ touchLayoutManager && touchLayoutManager.changeLayoutForScope({
type: 'showLayout', type: 'showLayout',
scope: '' + STATES.currentStream?.xboxTitleId, scope: '' + STATES.currentStream?.xboxTitleId,
subscope: 'base', subscope: 'base',

View File

@ -1,7 +1,7 @@
// Get type of an array's element // Get type of an array's element
type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never; type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>> type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>
interface Window { interface Window {
AppInterface: any; AppInterface: any;