Skip to content

Commit

Permalink
fix(YouTube/Hide feed components): Hide carousel shelf setting some…
Browse files Browse the repository at this point in the history
…times hides the library shelf
  • Loading branch information
inotia00 committed Sep 23, 2024
1 parent e25bd10 commit 1cf3c6d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ object FeedComponentsPatch : BaseBytecodePatch(
ShowMoreButtonFingerprint
)
) {
private const val CAROUSEL_SHELF_FILTER_CLASS_DESCRIPTOR =
"$COMPONENTS_PATH/CarouselShelfFilter;"
private const val FEED_COMPONENTS_FILTER_CLASS_DESCRIPTOR =
"$COMPONENTS_PATH/FeedComponentsFilter;"
private const val FEED_VIDEO_FILTER_CLASS_DESCRIPTOR =
Expand Down Expand Up @@ -287,6 +289,7 @@ object FeedComponentsPatch : BaseBytecodePatch(

// endregion

LithoFilterPatch.addFilter(CAROUSEL_SHELF_FILTER_CLASS_DESCRIPTOR)
LithoFilterPatch.addFilter(FEED_COMPONENTS_FILTER_CLASS_DESCRIPTOR)
LithoFilterPatch.addFilter(FEED_VIDEO_FILTER_CLASS_DESCRIPTOR)
LithoFilterPatch.addFilter(FEED_VIDEO_VIEWS_FILTER_CLASS_DESCRIPTOR)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package app.revanced.patches.youtube.utils.navigation

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.patch.BytecodePatch
Expand All @@ -12,13 +11,11 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.youtube.utils.fingerprints.InitializeButtonsFingerprint
import app.revanced.patches.youtube.utils.integrations.Constants.SHARED_PATH
import app.revanced.patches.youtube.utils.mainactivity.MainActivityResolvePatch
import app.revanced.patches.youtube.utils.navigation.fingerprints.MobileTopBarButtonOnClickFingerprint
import app.revanced.patches.youtube.utils.navigation.fingerprints.NavigationEnumFingerprint
import app.revanced.patches.youtube.utils.navigation.fingerprints.PivotBarButtonsCreateDrawableViewFingerprint
import app.revanced.patches.youtube.utils.navigation.fingerprints.PivotBarButtonsCreateResourceViewFingerprint
import app.revanced.patches.youtube.utils.navigation.fingerprints.PivotBarButtonsViewSetSelectedFingerprint
import app.revanced.patches.youtube.utils.navigation.fingerprints.PivotBarConstructorFingerprint
import app.revanced.patches.youtube.utils.navigation.fingerprints.SettingsActivityOnBackPressedFingerprint
import app.revanced.patches.youtube.utils.playertype.PlayerTypeHookPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
import app.revanced.util.getReference
Expand All @@ -41,13 +38,11 @@ import com.android.tools.smali.dexlib2.util.MethodUtil
@Suppress("unused")
object NavigationBarHookPatch : BytecodePatch(
setOf(
MobileTopBarButtonOnClickFingerprint,
NavigationEnumFingerprint,
PivotBarButtonsCreateDrawableViewFingerprint,
PivotBarButtonsCreateResourceViewFingerprint,
PivotBarButtonsViewSetSelectedFingerprint,
PivotBarConstructorFingerprint,
SettingsActivityOnBackPressedFingerprint
),
) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
Expand Down Expand Up @@ -110,16 +105,11 @@ object NavigationBarHookPatch : BytecodePatch(
val instruction = getInstruction<FiveRegisterInstruction>(index)
val viewRegister = instruction.registerC
val isSelectedRegister = instruction.registerD
val freeRegister = implementation!!.registerCount - parameters.size - 2

addInstruction(
index + 1,
"invoke-static { v$viewRegister, v$freeRegister, v$isSelectedRegister }, " +
"$INTEGRATIONS_CLASS_DESCRIPTOR->navigationTabSelected(Landroid/view/View;IZ)V",
)
addInstruction(
0,
"move/16 v$freeRegister, p1"
"invoke-static { v$viewRegister, v$isSelectedRegister }, " +
"$INTEGRATIONS_CLASS_DESCRIPTOR->navigationTabSelected(Landroid/view/View;Z)V",
)
}
}
Expand All @@ -133,21 +123,6 @@ object NavigationBarHookPatch : BytecodePatch(
INTEGRATIONS_CLASS_DESCRIPTOR,
"onBackPressed"
)

/**
* Since it is used only after opening the library tab, set index to 3.
*/
arrayOf(
MobileTopBarButtonOnClickFingerprint,
SettingsActivityOnBackPressedFingerprint
).forEach { fingerprint ->
fingerprint.resultOrThrow().mutableMethod.addInstructions(
0, """
const/4 v0, 0x3
invoke-static {v0}, $INTEGRATIONS_CLASS_DESCRIPTOR->setNavigationTabIndex(I)V
"""
)
}
}

val hookNavigationButtonCreated: (String) -> Unit by lazy {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ Tap here to learn more about DeArrow."</string>
<string name="revanced_hide_album_card_title">Hide album cards</string>
<string name="revanced_hide_album_card_summary_on">Album cards are hidden.</string>
<string name="revanced_hide_album_card_summary_off">Album cards are shown.</string>
<string name="revanced_hide_carousel_shelf_title">Hide carousel shelf</string>
<string name="revanced_hide_carousel_shelf_summary">"Hides the following shelves:
• Breaking news
• Continue watching
• Explore more channels
• Listen again
• Shopping
• Watch it again"</string>
<string name="revanced_hide_carousel_shelf_title">Hide carousel shelf</string>
<string name="revanced_hide_chips_shelf_title">Hide chips shelf</string>
<string name="revanced_hide_chips_shelf_on">Chips shelf is hidden.</string>
<string name="revanced_hide_chips_shelf_off">Chips shelf is shown.</string>
Expand Down

0 comments on commit 1cf3c6d

Please sign in to comment.