forked from ReVanced/revanced-patches
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(YouTube - Hide load more button): Include patch with `Hide layout…
… components`, and hide button only in search feed (ReVanced#2959)
- Loading branch information
1 parent
9479a95
commit b007e8e
Showing
9 changed files
with
57 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...evanced/patches/youtube/layout/hide/general/fingerprints/HideShowMoreButtonFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package app.revanced.patches.youtube.layout.hide.general.fingerprints | ||
|
||
import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsResourcePatch | ||
import app.revanced.util.patch.LiteralValueFingerprint | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
internal object HideShowMoreButtonFingerprint : LiteralValueFingerprint( | ||
opcodes = listOf( | ||
Opcode.CONST, | ||
Opcode.CONST_4, | ||
Opcode.INVOKE_STATIC, | ||
Opcode.MOVE_RESULT_OBJECT | ||
), | ||
literalSupplier = { HideLayoutComponentsResourcePatch.expandButtonDownId } | ||
) |
63 changes: 5 additions & 58 deletions
63
...kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,12 @@ | ||
package app.revanced.patches.youtube.layout.hide.loadmorebutton | ||
|
||
import app.revanced.util.exception | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.youtube.layout.hide.loadmorebutton.fingerprints.HideLoadMoreButtonFingerprint | ||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction | ||
import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsPatch | ||
|
||
@Patch( | ||
name = "Hide \'Load more\' button", | ||
description = "Adds an option to hide the button under videos that loads similar videos.", | ||
dependencies = [HideLoadMoreButtonResourcePatch::class], | ||
compatiblePackages = [ | ||
CompatiblePackage( | ||
"com.google.android.youtube", | ||
[ | ||
"18.32.39", | ||
"18.37.36", | ||
"18.38.44", | ||
"18.43.45", | ||
"18.44.41", | ||
"18.45.43", | ||
"18.48.39", | ||
"18.49.37", | ||
"19.01.34", | ||
"19.02.39", | ||
"19.03.36", | ||
"19.04.38", | ||
"19.05.36", | ||
"19.06.39", | ||
"19.07.40", | ||
"19.08.36", | ||
"19.09.37" | ||
] | ||
) | ||
] | ||
) | ||
@Suppress("unused") | ||
@Deprecated("This patch class has been merged into HideLayoutComponentsPatch.") | ||
object HideLoadMoreButtonPatch : BytecodePatch( | ||
setOf(HideLoadMoreButtonFingerprint) | ||
dependencies = setOf(HideLayoutComponentsPatch::class) | ||
) { | ||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = | ||
"Lapp/revanced/integrations/youtube/patches/HideLoadMoreButtonPatch;" | ||
|
||
override fun execute(context: BytecodeContext) { | ||
HideLoadMoreButtonFingerprint.result?.let { | ||
it.mutableMethod.apply { | ||
val moveRegisterIndex = it.scanResult.patternScanResult!!.endIndex | ||
val viewRegister = | ||
getInstruction<OneRegisterInstruction>(moveRegisterIndex).registerA | ||
|
||
val insertIndex = moveRegisterIndex + 1 | ||
addInstruction( | ||
insertIndex, | ||
"invoke-static { v$viewRegister }, " + | ||
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideLoadMoreButton(Landroid/view/View;)V" | ||
) | ||
} | ||
} ?: throw HideLoadMoreButtonFingerprint.exception | ||
} | ||
} | ||
override fun execute(context: BytecodeContext) {} | ||
} |
15 changes: 0 additions & 15 deletions
15
.../patches/youtube/layout/hide/loadmorebutton/fingerprints/HideLoadMoreButtonFingerprint.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters