Use a better method to skip feedback dialog

This commit is contained in:
redphx 2024-05-31 07:14:58 +07:00
parent 941ed0a00f
commit bee190b867
2 changed files with 13 additions and 7 deletions

View File

@ -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',

View File

@ -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]');