diff --git a/src/main/kotlin/app/revanced/patches/music/general/dialog/RemoveViewerDiscretionDialogPatch.kt b/src/main/kotlin/app/revanced/patches/music/general/dialog/RemoveViewerDiscretionDialogPatch.kt new file mode 100644 index 000000000..5ddfa4e4b --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/music/general/dialog/RemoveViewerDiscretionDialogPatch.kt @@ -0,0 +1,31 @@ +package app.revanced.patches.music.general.dialog + +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.patch.annotation.CompatiblePackage +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.music.utils.integrations.Constants.GENERAL +import app.revanced.patches.music.utils.settings.CategoryType +import app.revanced.patches.music.utils.settings.SettingsPatch +import app.revanced.patches.shared.patch.dialog.AbstractRemoveViewerDiscretionDialogPatch + +@Patch( + name = "Remove viewer discretion dialog", + description = "Removes the dialog that appears when you try to watch a video that has been age-restricted " + + "by accepting it automatically. This does not bypass the age restriction.", + dependencies = [SettingsPatch::class], + compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] +) +@Suppress("unused") +object RemoveViewerDiscretionDialogPatch : AbstractRemoveViewerDiscretionDialogPatch( + GENERAL +) { + override fun execute(context: BytecodeContext) { + super.execute(context) + + SettingsPatch.addMusicPreference( + CategoryType.GENERAL, + "revanced_remove_viewer_discretion_dialog", + "false" + ) + } +} diff --git a/src/main/resources/music/settings/host/values/strings.xml b/src/main/resources/music/settings/host/values/strings.xml index 7c2077fc7..04bd68d96 100644 --- a/src/main/resources/music/settings/host/values/strings.xml +++ b/src/main/resources/music/settings/host/values/strings.xml @@ -181,6 +181,9 @@ WARNING: Do not enable new player backgrounds while this is enabled." Normal Already playing official music source. Official music source not available. + "Remove viewer discretion dialog. +This does not bypass the age restriction, it just accepts it automatically." + Remove viewer discretion dialog Restart to load the layout normally Refresh and restart When watching on YouTube, continue watching from the current time.