Skip to content

Commit

Permalink
feat(YouTube): Add Remove viewer discretion dialog patch
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Dec 27, 2023
1 parent 6ca7946 commit 6f3f882
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
@@ -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();
}
}
Expand Up @@ -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),
Expand Down

0 comments on commit 6f3f882

Please sign in to comment.