feat(youtube): add hide-description-components patch

This commit is contained in:
inotia00 2023-07-03 19:36:56 +09:00
parent 93d1c57390
commit 8f4695763e
3 changed files with 68 additions and 2 deletions

View File

@ -0,0 +1,49 @@
package app.revanced.patches.youtube.descriptions.layout.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.youtube.utils.annotations.YouTubeCompatibility
import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
import app.revanced.util.integrations.Constants.PATCHES_PATH
@Patch
@Name("hide-description-components")
@Description("Hides description components.")
@DependsOn(
[
LithoFilterPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class DescriptionComponentsPatch : BytecodePatch() {
override fun execute(context: BytecodeContext): PatchResult {
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/DescriptionsFilter;")
/**
* Add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: GENERAL_SETTINGS",
"SETTINGS: HIDE_DESCRIPTION_COMPONENTS"
)
)
SettingsPatch.updatePatchStatus("hide-description-components")
context.updatePatchStatus("DescriptionComponent")
return PatchResultSuccess()
}
}

View File

@ -31,6 +31,7 @@
<string name="revanced_default_video_quality_mobile_title">Default video quality on Mobile network</string>
<string name="revanced_default_video_quality_wifi_title">Default video quality on Wi-Fi network</string>
<string name="revanced_default_video_speed_title">Default video speed</string>
<string name="revanced_description_title">Description</string>
<string name="revanced_disable_auto_captions_summary_off">Forced auto captions are enabled</string>
<string name="revanced_disable_auto_captions_summary_on">Forced auto captions are disabled</string>
<string name="revanced_disable_auto_captions_title">Disable forced auto captions</string>
@ -240,7 +241,7 @@
<string name="revanced_hide_channel_watermark_title">Hide channel watermark</string>
<string name="revanced_hide_chapters_summary_off">Chapters are shown</string>
<string name="revanced_hide_chapters_summary_on">Chapters are hidden</string>
<string name="revanced_hide_chapters_title">Hide chapters in the video description</string>
<string name="revanced_hide_chapters_title">Hide chapters</string>
<string name="revanced_hide_collapse_button_summary_off">Collapse button is shown</string>
<string name="revanced_hide_collapse_button_summary_on">Collapse button is hidden</string>
<string name="revanced_hide_collapse_button_title">Hide collapse button</string>
@ -338,6 +339,9 @@
<string name="revanced_hide_movie_shelf_summary_off">Movies shelves are shown</string>
<string name="revanced_hide_movie_shelf_summary_on">Movies shelves are hidden</string>
<string name="revanced_hide_movie_shelf_title">Hide movies shelf</string>
<string name="revanced_hide_music_section_summary_off">Music sections are shown</string>
<string name="revanced_hide_music_section_summary_on">Music sections are hidden</string>
<string name="revanced_hide_music_section_title">Hide music sections</string>
<string name="revanced_hide_navigation_label_summary_off">Navigation label is shown</string>
<string name="revanced_hide_navigation_label_summary_on">Navigation label is hidden</string>
<string name="revanced_hide_navigation_label_title">Hide navigation label</string>
@ -347,6 +351,9 @@
<string name="revanced_hide_paid_promotion_banner_summary_off">Paid promotion banner is shown</string>
<string name="revanced_hide_paid_promotion_banner_summary_on">Paid promotion banner is hidden</string>
<string name="revanced_hide_paid_promotion_banner_title">Hide paid promotion banner</string>
<string name="revanced_hide_place_section_summary_off">Place sections are shown</string>
<string name="revanced_hide_place_section_summary_on">Place sections are hidden</string>
<string name="revanced_hide_place_section_title">Hide place sections</string>
<string name="revanced_hide_player_button_background_summary_off">Player button background is shown</string>
<string name="revanced_hide_player_button_background_summary_on">Player button background is hidden</string>
<string name="revanced_hide_player_button_background_title">Hide player button background</string>
@ -472,6 +479,9 @@ Only available on YouTube v18.24.37+"</string>
<string name="revanced_hide_time_stamp_summary_off">Time stamp is shown</string>
<string name="revanced_hide_time_stamp_summary_on">Time stamp is hidden</string>
<string name="revanced_hide_time_stamp_title">Hide time stamp</string>
<string name="revanced_hide_transcript_section_summary_off">Transcript sections are shown</string>
<string name="revanced_hide_transcript_section_summary_on">Transcript sections are hidden</string>
<string name="revanced_hide_transcript_section_title">Hide transcript sections</string>
<string name="revanced_hide_trending_searches_summary_off">Trending searches are shown</string>
<string name="revanced_hide_trending_searches_summary_on">Trending searches are hidden</string>
<string name="revanced_hide_trending_searches_title">Hide trending searches</string>

View File

@ -187,7 +187,6 @@
<app.revanced.integrations.settingsmenu.ResettableEditTextPreference android:title="@string/revanced_custom_filter_strings_title" android:key="revanced_custom_filter_strings" android:summary="@string/revanced_custom_filter_strings_summary" android:defaultValue="" android:inputType="textMultiLine" />
<SwitchPreference android:title="@string/revanced_hide_album_card_title" android:key="revanced_hide_album_card" android:defaultValue="true" android:summaryOn="@string/revanced_hide_album_card_summary_on" android:summaryOff="@string/revanced_hide_album_card_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_channel_member_shelf_title" android:key="revanced_hide_channel_member_shelf" android:defaultValue="true" android:summaryOn="@string/revanced_hide_channel_member_shelf_summary_on" android:summaryOff="@string/revanced_hide_channel_member_shelf_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_chapters_title" android:key="revanced_hide_chapters" android:defaultValue="true" android:summaryOn="@string/revanced_hide_chapters_summary_on" android:summaryOff="@string/revanced_hide_chapters_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_community_posts_home_title" android:key="revanced_hide_community_posts_home" android:defaultValue="true" android:summaryOn="@string/revanced_hide_community_posts_home_summary_on" android:summaryOff="@string/revanced_hide_community_posts_home_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_community_posts_subscriptions_title" android:key="revanced_hide_community_posts_subscriptions" android:defaultValue="false" android:summaryOn="@string/revanced_hide_community_posts_subscriptions_summary_on" android:summaryOff="@string/revanced_hide_community_posts_subscriptions_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_expandable_chip_title" android:key="revanced_hide_expandable_chip" android:defaultValue="false" android:summaryOn="@string/revanced_hide_expandable_chip_summary_on" android:summaryOff="@string/revanced_hide_expandable_chip_summary_off" />
@ -203,6 +202,13 @@
<SwitchPreference android:title="@string/revanced_hide_ticket_shelf_title" android:key="revanced_hide_ticket_shelf" android:defaultValue="true" android:summaryOn="@string/revanced_hide_ticket_shelf_summary_on" android:summaryOff="@string/revanced_hide_ticket_shelf_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_timed_reactions_title" android:key="revanced_hide_timed_reactions" android:defaultValue="true" android:summaryOn="@string/revanced_hide_timed_reactions_summary_on" android:summaryOff="@string/revanced_hide_timed_reactions_summary_off" />SETTINGS: HIDE_LAYOUT_COMPONENTS -->
<!-- SETTINGS: HIDE_DESCRIPTION_COMPONENTS
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_description_title" />
<SwitchPreference android:title="@string/revanced_hide_chapters_title" android:key="revanced_hide_chapters" android:defaultValue="false" android:summaryOn="@string/revanced_hide_chapters_summary_on" android:summaryOff="@string/revanced_hide_chapters_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_music_section_title" android:key="revanced_hide_music_section" android:defaultValue="false" android:summaryOn="@string/revanced_hide_music_section_summary_on" android:summaryOff="@string/revanced_hide_music_section_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_place_section_title" android:key="revanced_hide_place_section" android:defaultValue="false" android:summaryOn="@string/revanced_hide_place_section_summary_on" android:summaryOff="@string/revanced_hide_place_section_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_transcript_section_title" android:key="revanced_hide_transcript_section" android:defaultValue="false" android:summaryOn="@string/revanced_hide_transcript_section_summary_on" android:summaryOff="@string/revanced_hide_transcript_section_summary_off" />SETTINGS: HIDE_DESCRIPTION_COMPONENTS -->
<!-- PREFERENCE: GENERAL_SETTINGS
</PreferenceScreen>PREFERENCE: GENERAL_SETTINGS -->
@ -306,6 +312,7 @@
<Preference android:title="hide-category-bar" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-channel-avatar-section" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-crowdfunding-box" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-description-components" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-email-address" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-floating-microphone" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-layout-components" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>