mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-24 19:25:59 +01:00
parent
6a90efcf0d
commit
cfe765e991
@ -24,7 +24,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
|||||||
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([GeneralAdsResourcePatch::class])
|
@DependsOn([GeneralAdsResourcePatch::class, VerticalScrollPatch::class])
|
||||||
@Name("general-ads")
|
@Name("general-ads")
|
||||||
@Description("Removes general ads.")
|
@Description("Removes general ads.")
|
||||||
@GeneralAdsCompatibility
|
@GeneralAdsCompatibility
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.fix.verticalscroll.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[
|
||||||
|
Package("com.google.android.youtube"),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class VerticalScrollCompatibility
|
@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.fix.verticalscroll.fingerprints
|
||||||
|
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object CanScrollVerticallyFingerprint : MethodFingerprint(
|
||||||
|
"Z",
|
||||||
|
parameters = emptyList(),
|
||||||
|
opcodes = listOf(Opcode.INSTANCE_OF),
|
||||||
|
customFingerprint = { methodDef -> methodDef.definingClass.endsWith("SwipeRefreshLayout;") }
|
||||||
|
)
|
@ -0,0 +1,33 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.fix.verticalscroll.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patches.youtube.misc.fix.verticalscroll.annotations.VerticalScrollCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.fix.verticalscroll.fingerprints.CanScrollVerticallyFingerprint
|
||||||
|
|
||||||
|
@Description("Fixes issues with scrolling on the home screen when the first component is of type EmptyComponent.")
|
||||||
|
@VerticalScrollCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class VerticalScrollPatch : BytecodePatch(
|
||||||
|
listOf(CanScrollVerticallyFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
val result = CanScrollVerticallyFingerprint.result ?: return CanScrollVerticallyFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
result.mutableMethod.addInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 v0, 0x0
|
||||||
|
return v0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user