From 68a57901d822f2ae6f8192e5b2ba6dc936e1663f Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Mon, 12 Jan 2026 15:47:33 +0700 Subject: [PATCH] refactor(boostforreddit): FixSLinksPatch --- .../boostforreddit/fix/slink/Fingerprints.kt | 29 ++++++++++--------- .../fix/slink/FixSLinksPatch.kt | 4 +-- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/slink/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/slink/Fingerprints.kt index 665dba5a4..dd8541c67 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/slink/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/slink/Fingerprints.kt @@ -1,21 +1,22 @@ package app.revanced.patches.reddit.customclients.boostforreddit.fix.slink +import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively +import app.revanced.patcher.accessFlags +import app.revanced.patcher.definingClass +import app.revanced.patcher.patch.BytecodePatchContext +import app.revanced.patcher.returnType import com.android.tools.smali.dexlib2.AccessFlags -import app.revanced.patcher.fingerprint -internal val getOAuthAccessTokenFingerprint = fingerprint { +internal val BytecodePatchContext.getOAuthAccessTokenMethod by gettingFirstMutableMethodDeclaratively("access_token") { accessFlags(AccessFlags.PUBLIC) - returns("Ljava/lang/String") - strings("access_token") - custom { method, _ -> method.definingClass == "Lnet/dean/jraw/http/oauth/OAuthData;" } + returnType("Ljava/lang/String;") + definingClass("Lnet/dean/jraw/http/oauth/OAuthData;") } -internal val handleNavigationFingerprint = fingerprint { - strings( - "android.intent.action.SEARCH", - "subscription", - "sort", - "period", - "boostforreddit.com/themes", - ) -} +internal val BytecodePatchContext.handleNavigationMethod by gettingFirstMutableMethodDeclaratively( + "android.intent.action.SEARCH", + "subscription", + "sort", + "period", + "boostforreddit.com/themes" +) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/slink/FixSLinksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/slink/FixSLinksPatch.kt index 6960751f6..373aff56d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/slink/FixSLinksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/slink/FixSLinksPatch.kt @@ -20,7 +20,7 @@ val fixSlinksPatch = fixSLinksPatch( apply { // region Patch navigation handler. - handleNavigationFingerprint.method.apply { + handleNavigationMethod.apply { val urlRegister = "p1" val tempRegister = "v1" @@ -40,7 +40,7 @@ val fixSlinksPatch = fixSLinksPatch( // region Patch set access token. - getOAuthAccessTokenFingerprint.method.addInstruction( + getOAuthAccessTokenMethod.addInstruction( 3, "invoke-static { v0 }, $EXTENSION_CLASS_DESCRIPTOR->$SET_ACCESS_TOKEN_METHOD", )