From 60861a850687971d9f208468f97f1fd0a23b168c Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Mon, 12 Jan 2026 16:33:23 +0700 Subject: [PATCH] refactor(slide): SpoofClientPatch --- .../reddit/customclients/slide/api/Fingerprints.kt | 14 +++++++------- .../customclients/slide/api/SpoofClientPatch.kt | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/Fingerprints.kt index 4ff8be461..d7f9f5d80 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/Fingerprints.kt @@ -1,11 +1,11 @@ package app.revanced.patches.reddit.customclients.slide.api -import app.revanced.patcher.fingerprint +import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively +import app.revanced.patcher.definingClass +import app.revanced.patcher.name +import app.revanced.patcher.patch.BytecodePatchContext -internal val getClientIdFingerprint = fingerprint { - custom { method, classDef -> - if (!classDef.endsWith("Credentials;")) return@custom false - - method.name == "getClientId" - } +internal val BytecodePatchContext.getClientIdMethod by gettingFirstMutableMethodDeclaratively { + name("getClientId") + definingClass { endsWith("Credentials;") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch.kt index 4e0600afb..70dec0a42 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch.kt @@ -1,14 +1,14 @@ package app.revanced.patches.reddit.customclients.slide.api -import app.revanced.patches.reddit.customclients.spoofClientPatch +import app.revanced.patches.reddit.customclients.`Spoof client` import app.revanced.util.returnEarly -val spoofClientPatch = spoofClientPatch(redirectUri = "http://www.ccrama.me") { clientIdOption -> +val spoofClientPatch = `Spoof client`(redirectUri = "http://www.ccrama.me") { clientIdOption -> compatibleWith("me.ccrama.redditslide") val clientId by clientIdOption apply { - getClientIdFingerprint.method.returnEarly(clientId!!) + getClientIdMethod.returnEarly(clientId!!) } }