diff --git a/app/src/main/java/app/revanced/integrations/patches/RemoveViewerDiscretionDialogPatch.java b/app/src/main/java/app/revanced/integrations/patches/RemoveViewerDiscretionDialogPatch.java new file mode 100644 index 00000000..c0d013e5 --- /dev/null +++ b/app/src/main/java/app/revanced/integrations/patches/RemoveViewerDiscretionDialogPatch.java @@ -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(); + } +} diff --git a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java index cd154686..ef628fc6 100644 --- a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java +++ b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java @@ -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),