mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
fix(YouTube/Hide feed components): Hide related videos
setting hides the player flyout component
This commit is contained in:
@ -27,6 +27,7 @@ import app.revanced.patches.youtube.feed.components.fingerprints.LinearLayoutMan
|
||||
import app.revanced.patches.youtube.feed.components.fingerprints.RelatedChipCloudFingerprint
|
||||
import app.revanced.patches.youtube.feed.components.fingerprints.SearchResultsChipBarFingerprint
|
||||
import app.revanced.patches.youtube.feed.components.fingerprints.ShowMoreButtonFingerprint
|
||||
import app.revanced.patches.youtube.utils.bottomsheet.BottomSheetHookPatch
|
||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.youtube.utils.fingerprints.EngagementPanelBuilderFingerprint
|
||||
import app.revanced.patches.youtube.utils.fingerprints.ScrollTopParentFingerprint
|
||||
@ -65,7 +66,8 @@ object FeedComponentsPatch : BaseBytecodePatch(
|
||||
NavigationBarHookPatch::class,
|
||||
PlayerTypeHookPatch::class,
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
SharedResourceIdPatch::class,
|
||||
BottomSheetHookPatch::class,
|
||||
),
|
||||
compatiblePackages = COMPATIBLE_PACKAGE,
|
||||
fingerprints = setOf(
|
||||
@ -158,7 +160,10 @@ object FeedComponentsPatch : BaseBytecodePatch(
|
||||
fun Method.indexOfEngagementPanelBuilderInstruction(targetMethod: MutableMethod) =
|
||||
indexOfFirstInstruction {
|
||||
opcode == Opcode.INVOKE_DIRECT &&
|
||||
MethodUtil.methodSignaturesMatch(targetMethod, getReference<MethodReference>()!!)
|
||||
MethodUtil.methodSignaturesMatch(
|
||||
targetMethod,
|
||||
getReference<MethodReference>()!!
|
||||
)
|
||||
}
|
||||
|
||||
EngagementPanelBuilderFingerprint.resultOrThrow().let {
|
||||
@ -189,7 +194,8 @@ object FeedComponentsPatch : BaseBytecodePatch(
|
||||
// Otherwise, MethodWalker finds the wrong class in YouTube 18.29.38:
|
||||
// https://github.com/ReVanced/revanced-patcher/issues/309
|
||||
LinearLayoutManagerItemCountsFingerprint.resultOrThrow().let {
|
||||
val methodWalker = it.getWalkerMethod(context, it.scanResult.patternScanResult!!.endIndex)
|
||||
val methodWalker =
|
||||
it.getWalkerMethod(context, it.scanResult.patternScanResult!!.endIndex)
|
||||
methodWalker.apply {
|
||||
val index = indexOfFirstInstructionOrThrow(Opcode.MOVE_RESULT)
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
|
@ -0,0 +1,39 @@
|
||||
package app.revanced.patches.youtube.utils.bottomsheet
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.utils.bottomsheet.fingerprint.BottomSheetBehaviorFingerprint
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.UTILS_PATH
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.util.findMethodOrThrow
|
||||
import app.revanced.util.resultOrThrow
|
||||
|
||||
@Patch(dependencies = [SharedResourceIdPatch::class])
|
||||
object BottomSheetHookPatch : BytecodePatch(
|
||||
setOf(BottomSheetBehaviorFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_BOTTOM_SHEET_HOOK_CLASS_DESCRIPTOR =
|
||||
"$UTILS_PATH/BottomSheetHookPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
// region patch for set player type
|
||||
|
||||
val bottomSheetClass =
|
||||
BottomSheetBehaviorFingerprint.resultOrThrow().mutableMethod.definingClass
|
||||
|
||||
arrayOf(
|
||||
"onAttachedToWindow",
|
||||
"onDetachedFromWindow"
|
||||
).forEach { methodName ->
|
||||
context.findMethodOrThrow(bottomSheetClass) {
|
||||
name == methodName
|
||||
}.addInstruction(
|
||||
1,
|
||||
"invoke-static {}, $INTEGRATIONS_BOTTOM_SHEET_HOOK_CLASS_DESCRIPTOR->$methodName()V"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package app.revanced.patches.youtube.utils.bottomsheet.fingerprint
|
||||
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.DesignBottomSheet
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
internal object BottomSheetBehaviorFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
literalSupplier = { DesignBottomSheet }
|
||||
)
|
@ -45,6 +45,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
var ControlsLayoutStub = -1L
|
||||
var DarkBackground = -1L
|
||||
var DarkSplashAnimation = -1L
|
||||
var DesignBottomSheet = -1L
|
||||
var DonationCompanion = -1L
|
||||
var DrawerContentView = -1L
|
||||
var DrawerResults = -1L
|
||||
@ -152,6 +153,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
ControlsLayoutStub = getId(ID, "controls_layout_stub")
|
||||
DarkBackground = getId(ID, "dark_background")
|
||||
DarkSplashAnimation = getId(ID, "dark_splash_animation")
|
||||
DesignBottomSheet = getId(ID, "design_bottom_sheet")
|
||||
DonationCompanion = getId(LAYOUT, "donation_companion")
|
||||
DrawerContentView = getId(ID, "drawer_content_view")
|
||||
DrawerResults = getId(ID, "drawer_results")
|
||||
|
Reference in New Issue
Block a user