2023-09-20 05:33:02 +02:00
|
|
|
package app.revanced.patches.youtube.layout.hide.loadmorebutton
|
|
|
|
|
2023-12-02 22:35:13 +01:00
|
|
|
import app.revanced.util.exception
|
2023-09-20 05:33:02 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
@Patch(
|
2023-10-08 03:25:27 +02:00
|
|
|
name = "Hide \'Load more\' button",
|
2024-01-01 16:30:04 +01:00
|
|
|
description = "Adds an option to hide the button under videos that loads similar videos.",
|
2023-09-20 05:33:02 +02:00
|
|
|
dependencies = [HideLoadMoreButtonResourcePatch::class],
|
|
|
|
compatiblePackages = [
|
|
|
|
CompatiblePackage(
|
|
|
|
"com.google.android.youtube",
|
|
|
|
[
|
2023-09-28 01:28:25 +02:00
|
|
|
"18.32.39",
|
2023-10-08 03:37:42 +02:00
|
|
|
"18.37.36",
|
2023-11-12 16:43:11 +01:00
|
|
|
"18.38.44",
|
2023-11-12 17:01:49 +01:00
|
|
|
"18.43.45",
|
|
|
|
"18.44.41",
|
2024-01-16 19:54:06 +01:00
|
|
|
"18.45.43",
|
|
|
|
"18.48.39",
|
|
|
|
"18.49.37",
|
2024-01-17 21:24:55 +01:00
|
|
|
"19.01.34",
|
2024-01-24 14:19:02 +01:00
|
|
|
"19.02.39",
|
2024-02-04 18:38:19 +01:00
|
|
|
"19.03.36",
|
2024-03-11 14:20:07 +01:00
|
|
|
"19.04.38",
|
|
|
|
"19.05.36",
|
|
|
|
"19.06.39",
|
|
|
|
"19.07.40",
|
|
|
|
"19.08.36",
|
|
|
|
"19.09.37"
|
2023-09-20 05:33:02 +02:00
|
|
|
]
|
|
|
|
)
|
|
|
|
]
|
|
|
|
)
|
|
|
|
@Suppress("unused")
|
|
|
|
object HideLoadMoreButtonPatch : BytecodePatch(
|
|
|
|
setOf(HideLoadMoreButtonFingerprint)
|
|
|
|
) {
|
|
|
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
2024-01-01 16:33:07 +01:00
|
|
|
"Lapp/revanced/integrations/youtube/patches/HideLoadMoreButtonPatch;"
|
2023-09-20 05:33:02 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|