Skip to content

Commit

Permalink
feat(YouTube - Hide Shorts components): Selectively hide Shorts for h…
Browse files Browse the repository at this point in the history
…ome / subscription / search (ReVanced#2925)
  • Loading branch information
LisoUseInAIKyrios authored and oSumAtrIX committed Mar 27, 2024
1 parent e25a303 commit 497c067
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.*
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
import app.revanced.patches.youtube.misc.navigation.NavigationBarHookPatch
import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
Expand All @@ -25,7 +27,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
IntegrationsPatch::class,
LithoFilterPatch::class,
HideShortsComponentsResourcePatch::class,
ResourceMappingPatch::class
ResourceMappingPatch::class,
NavigationBarHookPatch::class,
PlayerTypeHookPatch::class
],
compatiblePackages = [
CompatiblePackage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,32 @@ object HideShortsComponentsResourcePatch : ResourcePatch() {
AddResourcesPatch(this::class)

SettingsPatch.PreferenceScreen.SHORTS.addPreferences(
SwitchPreference("revanced_hide_shorts"),
SwitchPreference("revanced_hide_shorts_join_button"),
SwitchPreference("revanced_hide_shorts_subscribe_button"),
SwitchPreference("revanced_hide_shorts_subscribe_button_paused"),
SwitchPreference("revanced_hide_shorts_thanks_button"),
SwitchPreference("revanced_hide_shorts_home"),
SwitchPreference("revanced_hide_shorts_subscriptions"),
SwitchPreference("revanced_hide_shorts_search"),

// Shorts player components.
// Ideally each group should be ordered similar to how they appear in the UI
// since this Setting menu currently uses the ordering used here.

// Vertical row of buttons on right side of the screen.
SwitchPreference("revanced_hide_shorts_like_button"),
SwitchPreference("revanced_hide_shorts_dislike_button"),
SwitchPreference("revanced_hide_shorts_comments_button"),
SwitchPreference("revanced_hide_shorts_remix_button"),
SwitchPreference("revanced_hide_shorts_share_button"),
SwitchPreference("revanced_hide_shorts_info_panel"),
SwitchPreference("revanced_hide_shorts_remix_button"),
SwitchPreference("revanced_hide_shorts_sound_button"),

// Everything else.
SwitchPreference("revanced_hide_shorts_thanks_button"),
SwitchPreference("revanced_hide_shorts_join_button"),
SwitchPreference("revanced_hide_shorts_subscribe_button"),
SwitchPreference("revanced_hide_shorts_subscribe_button_paused"),
SwitchPreference("revanced_hide_shorts_channel_bar"),
SwitchPreference("revanced_hide_shorts_info_panel"),
SwitchPreference("revanced_hide_shorts_full_video_link_label"),
SwitchPreference("revanced_hide_shorts_video_title"),
SwitchPreference("revanced_hide_shorts_sound_metadata_label"),
SwitchPreference("revanced_hide_shorts_full_video_link_label"),
SwitchPreference("revanced_hide_shorts_sound_button"),
SwitchPreference("revanced_hide_shorts_navigation_bar"),
)

Expand Down
12 changes: 9 additions & 3 deletions src/main/resources/addresources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,15 @@
<string name="revanced_hide_seekbar_thumbnail_summary_off">Thumbnail seekbar is shown</string>
</patch>
<patch id="layout.hide.shorts.HideShortsComponentsResourcePatch">
<string name="revanced_hide_shorts_title">Hide Shorts in feed</string>
<string name="revanced_hide_shorts_summary_on">Shorts are hidden</string>
<string name="revanced_hide_shorts_summary_off">Shorts are shown</string>
<string name="revanced_hide_shorts_home_title">Hide Shorts in home feed</string>
<string name="revanced_hide_shorts_home_summary_on">Shorts in home feed are hidden</string>
<string name="revanced_hide_shorts_home_summary_off">Shorts in home feed are shown</string>
<string name="revanced_hide_shorts_subscriptions_title">Hide Shorts in subscription feed</string>
<string name="revanced_hide_shorts_subscriptions_summary_on">Shorts in subscription feed are hidden</string>
<string name="revanced_hide_shorts_subscriptions_summary_off">Shorts in subscription feed are shown</string>
<string name="revanced_hide_shorts_search_title">Hide Shorts in search results</string>
<string name="revanced_hide_shorts_search_summary_on">Shorts in search results are hidden</string>
<string name="revanced_hide_shorts_search_summary_off">Shorts in search results are shown</string>
<string name="revanced_hide_shorts_join_button_title">Hide join button</string>
<string name="revanced_hide_shorts_join_button_summary_on">Join button is hidden</string>
<string name="revanced_hide_shorts_join_button_summary_off">Join button is shown</string>
Expand Down

0 comments on commit 497c067

Please sign in to comment.