mirror of
https://github.com/revanced/revanced-patches
synced 2025-02-07 14:46:52 +01:00
refactor: start migrating some signatures to Kotlin
This commit is contained in:
parent
bc56555d9e
commit
36a2780ab1
@ -1,28 +0,0 @@
|
|||||||
package app.revanced.patches
|
|
||||||
|
|
||||||
import app.revanced.patcher.patch.Patch
|
|
||||||
import app.revanced.patches.ad.VideoAds
|
|
||||||
import app.revanced.patches.interaction.EnableSeekbarTapping
|
|
||||||
import app.revanced.patches.layout.*
|
|
||||||
import app.revanced.patches.misc.Integrations
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Index contains all the patches and should be imported when using this library.
|
|
||||||
*/
|
|
||||||
@Suppress("Unused")
|
|
||||||
object Index {
|
|
||||||
/**
|
|
||||||
* Array of patches.
|
|
||||||
* New patches should be added to the array.
|
|
||||||
*/
|
|
||||||
val patches: Array<() -> Patch> = arrayOf(
|
|
||||||
::Integrations,
|
|
||||||
::VideoAds,
|
|
||||||
::MinimizedPlayback,
|
|
||||||
::CreateButtonRemover,
|
|
||||||
::HideReels,
|
|
||||||
::HideSuggestions,
|
|
||||||
::OldQualityLayout,
|
|
||||||
::EnableSeekbarTapping
|
|
||||||
)
|
|
||||||
}
|
|
@ -9,7 +9,7 @@ import app.revanced.patcher.smali.asInstructions
|
|||||||
import app.revanced.patches.SHARED_METADATA
|
import app.revanced.patches.SHARED_METADATA
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
class VideoAds : Patch(
|
class VideoAdsPatch : Patch(
|
||||||
PatchMetadata(
|
PatchMetadata(
|
||||||
"video-ads",
|
"video-ads",
|
||||||
"TODO",
|
"TODO",
|
@ -12,7 +12,7 @@ import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
|||||||
import org.jf.dexlib2.iface.Method
|
import org.jf.dexlib2.iface.Method
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction11n
|
import org.jf.dexlib2.iface.instruction.formats.Instruction11n
|
||||||
|
|
||||||
class EnableSeekbarTapping : Patch(
|
class EnableSeekbarTappingPatch : Patch(
|
||||||
PatchMetadata(
|
PatchMetadata(
|
||||||
"enable-seekbar-tapping",
|
"enable-seekbar-tapping",
|
||||||
"TODO",
|
"TODO",
|
@ -7,7 +7,7 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.smali.asInstruction
|
import app.revanced.patcher.smali.asInstruction
|
||||||
|
|
||||||
class CreateButtonRemover : Patch(
|
class CreateButtonRemoverPatch : Patch(
|
||||||
PatchMetadata(
|
PatchMetadata(
|
||||||
"create-button-remover",
|
"create-button-remover",
|
||||||
"TODO",
|
"TODO",
|
@ -7,7 +7,7 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.smali.asInstruction
|
import app.revanced.patcher.smali.asInstruction
|
||||||
|
|
||||||
class HideReels : Patch(
|
class HideReelsPatch : Patch(
|
||||||
PatchMetadata(
|
PatchMetadata(
|
||||||
"hide-reels",
|
"hide-reels",
|
||||||
"TODO",
|
"TODO",
|
@ -17,7 +17,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
|||||||
import org.jf.dexlib2.immutable.ImmutableMethod
|
import org.jf.dexlib2.immutable.ImmutableMethod
|
||||||
import org.jf.dexlib2.immutable.ImmutableMethodImplementation
|
import org.jf.dexlib2.immutable.ImmutableMethodImplementation
|
||||||
|
|
||||||
class HideSuggestions : Patch(
|
class HideSuggestionsPatch : Patch(
|
||||||
PatchMetadata(
|
PatchMetadata(
|
||||||
"hide-suggestions",
|
"hide-suggestions",
|
||||||
"TODO",
|
"TODO",
|
@ -8,7 +8,7 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.smali.asInstructions
|
import app.revanced.patcher.smali.asInstructions
|
||||||
|
|
||||||
class MinimizedPlayback : Patch(
|
class MinimizedPlaybackPatch : Patch(
|
||||||
PatchMetadata(
|
PatchMetadata(
|
||||||
"minimized-playback",
|
"minimized-playback",
|
||||||
"TODO",
|
"TODO",
|
@ -11,7 +11,7 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
||||||
|
|
||||||
class OldQualityLayout : Patch(
|
class OldQualityLayoutPatch : Patch(
|
||||||
PatchMetadata(
|
PatchMetadata(
|
||||||
"old-quality-layout",
|
"old-quality-layout",
|
||||||
"TODO",
|
"TODO",
|
@ -13,7 +13,7 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
import org.jf.dexlib2.immutable.ImmutableMethod
|
import org.jf.dexlib2.immutable.ImmutableMethod
|
||||||
import org.jf.dexlib2.immutable.ImmutableMethodImplementation
|
import org.jf.dexlib2.immutable.ImmutableMethodImplementation
|
||||||
|
|
||||||
class Integrations : Patch(
|
class IntegrationsPatch : Patch(
|
||||||
PatchMetadata(
|
PatchMetadata(
|
||||||
"integrations",
|
"integrations",
|
||||||
"TODO",
|
"TODO",
|
40
src/main/kotlin/app/revanced/shared/Index.kt
Normal file
40
src/main/kotlin/app/revanced/shared/Index.kt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package app.revanced.shared
|
||||||
|
|
||||||
|
import app.revanced.patcher.patch.Patch
|
||||||
|
import app.revanced.patches.ad.VideoAdsPatch
|
||||||
|
import app.revanced.patches.interaction.EnableSeekbarTappingPatch
|
||||||
|
import app.revanced.patches.layout.*
|
||||||
|
import app.revanced.patches.misc.IntegrationsPatch
|
||||||
|
import app.revanced.signatures.SignatureSupplier
|
||||||
|
import app.revanced.signatures.ad.VideoAdsSignature
|
||||||
|
import app.revanced.signatures.misc.IntegrationsSignature
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index contains all the patches and signatures.
|
||||||
|
*/
|
||||||
|
@Suppress("Unused")
|
||||||
|
object Index {
|
||||||
|
/**
|
||||||
|
* Array of patches.
|
||||||
|
* New patches should be added to the array.
|
||||||
|
*/
|
||||||
|
val patches: Array<() -> Patch> = arrayOf(
|
||||||
|
::IntegrationsPatch,
|
||||||
|
::VideoAdsPatch,
|
||||||
|
::MinimizedPlaybackPatch,
|
||||||
|
::CreateButtonRemoverPatch,
|
||||||
|
::HideReelsPatch,
|
||||||
|
::HideSuggestionsPatch,
|
||||||
|
::OldQualityLayoutPatch,
|
||||||
|
::EnableSeekbarTappingPatch
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of signatures.
|
||||||
|
* New signatures should be added to the array.
|
||||||
|
*/
|
||||||
|
val signatures: Array<() -> SignatureSupplier> = arrayOf(
|
||||||
|
::IntegrationsSignature,
|
||||||
|
::VideoAdsSignature,
|
||||||
|
)
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package app.revanced.signatures
|
||||||
|
|
||||||
|
import app.revanced.patcher.signature.MethodSignature
|
||||||
|
|
||||||
|
interface SignatureSupplier {
|
||||||
|
fun get(): MethodSignature
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package app.revanced.signatures.ad
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||||
|
import app.revanced.patcher.signature.*
|
||||||
|
import app.revanced.signatures.SignatureSupplier
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
class VideoAdsSignature : SignatureSupplier {
|
||||||
|
override fun get() = MethodSignature(
|
||||||
|
"show-video-ads-constructor",
|
||||||
|
SignatureMetadata(
|
||||||
|
method = MethodMetadata(
|
||||||
|
definingClass = "zai",
|
||||||
|
methodName = "<init>",
|
||||||
|
comment = "YouTube v17.03.38"
|
||||||
|
),
|
||||||
|
patcher = PatcherMetadata(
|
||||||
|
// FIXME: Test this threshold and find the best value.
|
||||||
|
resolverMethod = ResolverMethod.Fuzzy(2)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"V",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
listOf("L", "L", "L"),
|
||||||
|
listOf(
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.IPUT_BOOLEAN,
|
||||||
|
Opcode.RETURN_VOID
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package app.revanced.signatures.misc
|
||||||
|
|
||||||
|
import app.revanced.patcher.signature.*
|
||||||
|
import app.revanced.signatures.SignatureSupplier
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
class IntegrationsSignature : SignatureSupplier {
|
||||||
|
override fun get() = MethodSignature(
|
||||||
|
"integrations-patch",
|
||||||
|
SignatureMetadata(
|
||||||
|
method = MethodMetadata(
|
||||||
|
definingClass = "???", // TODO: Fill this in.
|
||||||
|
methodName = "???", // TODO: Fill this in.
|
||||||
|
comment = "YouTube v17.03.38"
|
||||||
|
),
|
||||||
|
patcher = PatcherMetadata(
|
||||||
|
// FIXME: Test this threshold and find the best value.
|
||||||
|
resolverMethod = ResolverMethod.Fuzzy(2)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"V",
|
||||||
|
AccessFlags.PUBLIC.value,
|
||||||
|
listOf(),
|
||||||
|
listOf(
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.CONST_STRING,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.MOVE_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
Opcode.MOVE_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.CONST_STRING,
|
||||||
|
Opcode.INVOKE_INTERFACE_RANGE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.SPUT_OBJECT,
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.INVOKE_SUPER,
|
||||||
|
Opcode.INVOKE_VIRTUAL
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user