feat(YouTube Music): add Hide sample shelf patch

This commit is contained in:
inotia00 2024-03-20 01:56:37 +09:00
parent bfda7b4a3e
commit 788d0fd06c
2 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,53 @@
package app.revanced.patches.music.general.sampleshelf
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.utils.integrations.Constants.COMPONENTS_PATH
import app.revanced.patches.music.utils.litho.LithoFilterPatch
import app.revanced.patches.music.utils.settings.CategoryType
import app.revanced.patches.music.utils.settings.SettingsPatch
@Patch(
name = "Hide sample shelf",
description = "Adds an option to hide the sample shelf from the homepage.",
dependencies = [
LithoFilterPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.21.52",
"6.22.52",
"6.23.56",
"6.25.53",
"6.26.51",
"6.27.54",
"6.28.53",
"6.29.58",
"6.31.55",
"6.33.52"
]
)
]
)
@Suppress("unused")
object HideSampleShelfPatch : BytecodePatch(emptySet()) {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_hide_samples_shelf",
"false"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private const val FILTER_CLASS_DESCRIPTOR =
"$COMPONENTS_PATH/SampleShelfFilter;"
}

View File

@ -178,6 +178,8 @@ Some features may not work properly in the old player layout."</string>
<string name="revanced_hide_premium_renewal_title">Hide premium renewal banner</string>
<string name="revanced_hide_samples_button_summary">Hides the samples button.</string>
<string name="revanced_hide_samples_button_title">Hide samples button</string>
<string name="revanced_hide_samples_shelf_summary">Hides the samples shelf from the homepage.</string>
<string name="revanced_hide_samples_shelf_title">Hide samples shelf</string>
<string name="revanced_hide_terms_container_summary">Hides terms of service container.</string>
<string name="revanced_hide_terms_container_title">Hide terms container</string>
<string name="revanced_hide_upgrade_button_summary">Hides the upgrade button.</string>