feat(music): add hide-channel-guidelines patch

This commit is contained in:
inotia00 2023-08-04 05:08:14 +09:00
parent ec7f11bef4
commit 98c8214954
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,47 @@
package app.revanced.patches.music.layout.carouselshelf.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.litho.patch.LithoFilterPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch
@Name("Hide channel guidelines")
@Description("Hides channel guidelines at the top of comments.")
@DependsOn(
[
LithoFilterPatch::class,
SettingsPatch::class
]
)
@MusicCompatibility
@Version("0.0.1")
class HideChannelGuidelinesPatch : BytecodePatch() {
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.addMusicPreference(
CategoryType.LAYOUT,
"revanced_hide_channel_guidelines",
"true"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
return PatchResultSuccess()
}
private companion object {
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/ChannelGuidelinesFilter;"
}
}

View File

@ -47,6 +47,8 @@
<string name="revanced_hide_cast_button_title">Hide cast button</string>
<string name="revanced_hide_category_bar_summary">Hides the music category bar at the top of the homepage.</string>
<string name="revanced_hide_category_bar_title">Hide category bar</string>
<string name="revanced_hide_channel_guidelines_summary">Hides channel guidelines at the top of comments</string>
<string name="revanced_hide_channel_guidelines_title">Hide channel guidelines</string>
<string name="revanced_hide_music_ads_summary">Hides ads before playing a music.</string>
<string name="revanced_hide_music_ads_title">Hide music ads</string>
<string name="revanced_hide_navigation_label_summary">Hide labels in navigation bar.</string>