From bee190b867b782c4db049d0b27b7c235c769a378 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Fri, 31 May 2024 07:14:58 +0700 Subject: [PATCH] Use a better method to skip feedback dialog --- src/modules/patcher.ts | 13 +++++++++++++ src/modules/stream/stream-ui.ts | 7 ------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/modules/patcher.ts b/src/modules/patcher.ts index a788c50..9755d62 100644 --- a/src/modules/patcher.ts +++ b/src/modules/patcher.ts @@ -554,6 +554,16 @@ true` + text; str = str.replace(text, newCode); return str; }, + + skipFeedbackDialog(str: string) { + const text = '&&this.shouldTransitionToFeedback('; + if (!str.includes(text)) { + return false; + } + + str = str.replace(text, '&& false ' + text); + return str; + }, }; let PATCH_ORDERS: PatchArray = [ @@ -605,6 +615,9 @@ let PLAYING_PATCH_ORDERS: PatchArray = [ // Patch volume control for combined audio+video stream getPref(PrefKey.AUDIO_ENABLE_VOLUME_CONTROL) && getPref(PrefKey.STREAM_COMBINE_SOURCES) && 'patchCombinedAudioVideoMediaStream', + // Skip feedback dialog + getPref(PrefKey.STREAM_DISABLE_FEEDBACK_DIALOG) && 'skipFeedbackDialog', + STATES.hasTouchSupport && getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === 'all' && 'patchShowSensorControls', STATES.hasTouchSupport && getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === 'all' && 'exposeTouchLayoutManager', diff --git a/src/modules/stream/stream-ui.ts b/src/modules/stream/stream-ui.ts index 1cdc112..80e92ac 100644 --- a/src/modules/stream/stream-ui.ts +++ b/src/modules/stream/stream-ui.ts @@ -90,7 +90,6 @@ export function injectStreamMenuButtons() { let $btnStreamSettings: HTMLElement; let $btnStreamStats: HTMLElement; - const PREF_DISABLE_FEEDBACK_DIALOG = getPref(PrefKey.STREAM_DISABLE_FEEDBACK_DIALOG); const observer = new MutationObserver(mutationList => { mutationList.forEach(item => { if (item.type !== 'childList') { @@ -125,12 +124,6 @@ export function injectStreamMenuButtons() { return; } - if (PREF_DISABLE_FEEDBACK_DIALOG && $elm.className.startsWith('PostStreamFeedbackScreen')) { - const $btnClose = $elm.querySelector('button'); - $btnClose && $btnClose.click(); - return; - } - // Render badges if ($elm.className?.startsWith('StreamMenu-module__container')) { const $btnCloseHud = document.querySelector('button[class*=StreamMenu-module__backButton]');