Skip to content

Commit 497c067

Browse files
LisoUseInAIKyriosoSumAtrIX
authored andcommitted
feat(YouTube - Hide Shorts components): Selectively hide Shorts for home / subscription / search (#2925)
1 parent e25a303 commit 497c067

File tree

3 files changed

+33
-13
lines changed

3 files changed

+33
-13
lines changed

src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
1414
import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.*
1515
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
1616
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
17+
import app.revanced.patches.youtube.misc.navigation.NavigationBarHookPatch
18+
import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch
1719
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
1820
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
1921
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
@@ -25,7 +27,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
2527
IntegrationsPatch::class,
2628
LithoFilterPatch::class,
2729
HideShortsComponentsResourcePatch::class,
28-
ResourceMappingPatch::class
30+
ResourceMappingPatch::class,
31+
NavigationBarHookPatch::class,
32+
PlayerTypeHookPatch::class
2933
],
3034
compatiblePackages = [
3135
CompatiblePackage(

src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsResourcePatch.kt

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,32 @@ object HideShortsComponentsResourcePatch : ResourcePatch() {
1717
AddResourcesPatch(this::class)
1818

1919
SettingsPatch.PreferenceScreen.SHORTS.addPreferences(
20-
SwitchPreference("revanced_hide_shorts"),
21-
SwitchPreference("revanced_hide_shorts_join_button"),
22-
SwitchPreference("revanced_hide_shorts_subscribe_button"),
23-
SwitchPreference("revanced_hide_shorts_subscribe_button_paused"),
24-
SwitchPreference("revanced_hide_shorts_thanks_button"),
20+
SwitchPreference("revanced_hide_shorts_home"),
21+
SwitchPreference("revanced_hide_shorts_subscriptions"),
22+
SwitchPreference("revanced_hide_shorts_search"),
23+
24+
// Shorts player components.
25+
// Ideally each group should be ordered similar to how they appear in the UI
26+
// since this Setting menu currently uses the ordering used here.
27+
28+
// Vertical row of buttons on right side of the screen.
2529
SwitchPreference("revanced_hide_shorts_like_button"),
2630
SwitchPreference("revanced_hide_shorts_dislike_button"),
2731
SwitchPreference("revanced_hide_shorts_comments_button"),
28-
SwitchPreference("revanced_hide_shorts_remix_button"),
2932
SwitchPreference("revanced_hide_shorts_share_button"),
30-
SwitchPreference("revanced_hide_shorts_info_panel"),
33+
SwitchPreference("revanced_hide_shorts_remix_button"),
34+
SwitchPreference("revanced_hide_shorts_sound_button"),
35+
36+
// Everything else.
37+
SwitchPreference("revanced_hide_shorts_thanks_button"),
38+
SwitchPreference("revanced_hide_shorts_join_button"),
39+
SwitchPreference("revanced_hide_shorts_subscribe_button"),
40+
SwitchPreference("revanced_hide_shorts_subscribe_button_paused"),
3141
SwitchPreference("revanced_hide_shorts_channel_bar"),
42+
SwitchPreference("revanced_hide_shorts_info_panel"),
43+
SwitchPreference("revanced_hide_shorts_full_video_link_label"),
3244
SwitchPreference("revanced_hide_shorts_video_title"),
3345
SwitchPreference("revanced_hide_shorts_sound_metadata_label"),
34-
SwitchPreference("revanced_hide_shorts_full_video_link_label"),
35-
SwitchPreference("revanced_hide_shorts_sound_button"),
3646
SwitchPreference("revanced_hide_shorts_navigation_bar"),
3747
)
3848

src/main/resources/addresources/values/strings.xml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,15 @@
479479
<string name="revanced_hide_seekbar_thumbnail_summary_off">Thumbnail seekbar is shown</string>
480480
</patch>
481481
<patch id="layout.hide.shorts.HideShortsComponentsResourcePatch">
482-
<string name="revanced_hide_shorts_title">Hide Shorts in feed</string>
483-
<string name="revanced_hide_shorts_summary_on">Shorts are hidden</string>
484-
<string name="revanced_hide_shorts_summary_off">Shorts are shown</string>
482+
<string name="revanced_hide_shorts_home_title">Hide Shorts in home feed</string>
483+
<string name="revanced_hide_shorts_home_summary_on">Shorts in home feed are hidden</string>
484+
<string name="revanced_hide_shorts_home_summary_off">Shorts in home feed are shown</string>
485+
<string name="revanced_hide_shorts_subscriptions_title">Hide Shorts in subscription feed</string>
486+
<string name="revanced_hide_shorts_subscriptions_summary_on">Shorts in subscription feed are hidden</string>
487+
<string name="revanced_hide_shorts_subscriptions_summary_off">Shorts in subscription feed are shown</string>
488+
<string name="revanced_hide_shorts_search_title">Hide Shorts in search results</string>
489+
<string name="revanced_hide_shorts_search_summary_on">Shorts in search results are hidden</string>
490+
<string name="revanced_hide_shorts_search_summary_off">Shorts in search results are shown</string>
485491
<string name="revanced_hide_shorts_join_button_title">Hide join button</string>
486492
<string name="revanced_hide_shorts_join_button_summary_on">Join button is hidden</string>
487493
<string name="revanced_hide_shorts_join_button_summary_off">Join button is shown</string>

0 commit comments

Comments
 (0)