From 1ff148d49f5f6197aab3be1d10e9f79f2361a498 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Thu, 5 Feb 2026 00:52:45 +0100 Subject: [PATCH] update to new api --- .../customclients/baconreader/api/SpoofClientPatch.kt | 4 ++-- .../customclients/redditisfun/api/SpoofClientPatch.kt | 6 +++--- .../shared/misc/privacy/SanitizeSharingLinksPatch.kt | 7 +++---- .../twitter/interaction/downloads/UnlockDownloadsPatch.kt | 4 ++-- .../layout/hide/general/HideLayoutComponentsPatch.kt | 6 +++--- .../player/fullscreen/OpenVideosFullscreenHookPatch.kt | 4 ++-- .../patches/youtube/layout/seekbar/SeekbarColorPatch.kt | 2 +- 7 files changed, 16 insertions(+), 17 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt index 5dba2ef80d..dde1e50726 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt @@ -1,6 +1,6 @@ package app.revanced.patches.reddit.customclients.baconreader.api -import app.revanced.patcher.Match +import app.revanced.patcher.CompositeMatch import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patches.reddit.customclients.spoofClientPatch @@ -22,7 +22,7 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "http://baconreader.com/au val clientId by clientIdOption apply { - fun Match.patch(replacementString: String) { + fun CompositeMatch.patch(replacementString: String) { val clientIdIndex = get(0) val clientIdRegister = method.getInstruction(clientIdIndex).registerA diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt index 762cb47749..95bd1ccd5d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt @@ -1,6 +1,6 @@ package app.revanced.patches.reddit.customclients.redditisfun.api -import app.revanced.patcher.Match +import app.revanced.patcher.CompositeMatch import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patches.reddit.customclients.spoofClientPatch @@ -28,9 +28,9 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "redditisfun://auth") { cl * * @param string The string to replace the instruction with. * @param getReplacementIndex A function that returns the index of the instruction to replace - * using the [Match.indices] list from the [Match]. + * using the [CompositeMatch.indices] list from the [CompositeMatch]. */ - fun Match.replaceWith( + fun CompositeMatch.replaceWith( string: String, getReplacementIndex: List.() -> Int, ) = method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/privacy/SanitizeSharingLinksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/privacy/SanitizeSharingLinksPatch.kt index ed5f349155..120640ce77 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/privacy/SanitizeSharingLinksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/privacy/SanitizeSharingLinksPatch.kt @@ -1,7 +1,6 @@ package app.revanced.patches.shared.misc.privacy -import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod -import app.revanced.patcher.Match +import app.revanced.patcher.CompositeMatch import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.patch.BytecodePatchBuilder @@ -61,7 +60,7 @@ internal fun sanitizeSharingLinksPatch( ) - fun Match.hookUrlString(matchIndex: Int) { + fun CompositeMatch.hookUrlString(matchIndex: Int) { val index = get(matchIndex) val urlRegister = method.getInstruction(index).registerA @@ -74,7 +73,7 @@ internal fun sanitizeSharingLinksPatch( ) } - fun Match.hookIntentPutExtra(matchIndex: Int) { + fun CompositeMatch.hookIntentPutExtra(matchIndex: Int) { val index = get(matchIndex) val urlRegister = method.getInstruction(index).registerE diff --git a/patches/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch.kt index 090d42a4b5..99165494c5 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch.kt @@ -1,6 +1,6 @@ package app.revanced.patches.twitter.interaction.downloads -import app.revanced.patcher.Match +import app.revanced.patcher.CompositeMatch import app.revanced.patcher.extensions.* import app.revanced.patcher.patch.bytecodePatch import com.android.tools.smali.dexlib2.Opcode @@ -15,7 +15,7 @@ val unlockDownloadsPatch = bytecodePatch( compatibleWith("com.twitter.android") apply { - fun Match.patch(getRegisterAndIndex: Match.() -> Pair) { + fun CompositeMatch.patch(getRegisterAndIndex: CompositeMatch.() -> Pair) { val (index, register) = getRegisterAndIndex() method.addInstruction(index, "const/4 v$register, 0x1") } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt index ea9e4dd25b..e1bc527ff4 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt @@ -1,6 +1,6 @@ package app.revanced.patches.youtube.layout.hide.general -import app.revanced.patcher.Match +import app.revanced.patcher.CompositeMatch import app.revanced.patcher.extensions.* import app.revanced.patcher.immutableClassDef import app.revanced.patcher.patch.resourcePatch @@ -386,11 +386,11 @@ val hideLayoutComponentsPatch = hideLayoutComponentsPatch( * Patch a [Method] with a given [instructions]. * * @param RegisterInstruction The type of instruction to get the register from. - * @param insertIndexOffset The offset to add to the end index of the [Match.indices]. + * @param insertIndexOffset The offset to add to the end index of the [CompositeMatch.indices]. * @param hookRegisterOffset The offset to add to the register of the hook. * @param instructions The instructions to add with the register as a parameter. */ - fun Match.patch( + fun CompositeMatch.patch( insertIndexOffset: Int = 0, hookRegisterOffset: Int = 0, instructions: (Int) -> String, diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenHookPatch.kt index 3db908d034..5f53f6cb7a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenHookPatch.kt @@ -1,6 +1,6 @@ package app.revanced.patches.youtube.layout.player.fullscreen -import app.revanced.patcher.Match +import app.revanced.patcher.CompositeMatch import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.patch.bytecodePatch @@ -25,7 +25,7 @@ internal val openVideosFullscreenHookPatch = bytecodePatch { ) apply { - var match: Match + var match: CompositeMatch var insertIndex: Int if (is_19_46_or_greater) { diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt index 17cbc055a4..9a67e0491c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt @@ -114,7 +114,7 @@ val seekbarColorPatch = bytecodePatch( """, ) - val playerMatch: Match + val playerMatch: CompositeMatch val checkGradientCoordinates: Boolean if (is_19_49_or_greater) { playerMatch = playerLinearGradientMethodMatch