Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(YouTube): Add
Remove viewer discretion dialog
patch
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
app/src/main/java/app/revanced/integrations/patches/RemoveViewerDiscretionDialogPatch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters