feat(YouTube): Add Remove viewer discretion dialog patch

This commit is contained in:
oSumAtrIX 2023-12-27 05:39:23 +01:00
parent 6ca7946e8f
commit 6f3f88264e
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,18 @@
package app.revanced.integrations.patches;
import android.app.AlertDialog;
import app.revanced.integrations.settings.SettingsEnum;
public class RemoveViewerDiscretionDialogPatch {
public static void confirmDialog(AlertDialog dialog) {
if (!SettingsEnum.REMOVE_VIEWER_DISCRETION_DIALOG.getBoolean()) {
// Since the patch replaces the AlertDialog#show() method, we need to call the original method here.
dialog.show();
return;
}
final var button = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
button.setSoundEffectsEnabled(false);
button.performClick();
}
}

View File

@ -209,6 +209,8 @@ public enum SettingsEnum {
ANNOUNCEMENT_CONSUMER("revanced_announcement_consumer", STRING, ""),
ANNOUNCEMENT_LAST_HASH("revanced_announcement_last_hash", STRING, ""),
REMOVE_TRACKING_QUERY_PARAMETER("revanced_remove_tracking_query_parameter", BOOLEAN, TRUE),
REMOVE_VIEWER_DISCRETION_DIALOG("revanced_remove_viewer_discretion_dialog", BOOLEAN, FALSE,
"revanced_remove_viewer_discretion_dialog_user_dialog_message"),
// Swipe controls
SWIPE_BRIGHTNESS("revanced_swipe_brightness", BOOLEAN, TRUE),