refactor(boostforreddit): FixSLinksPatch

This commit is contained in:
Pun Butrach
2026-01-12 15:47:33 +07:00
parent e2bc428b29
commit 68a57901d8
2 changed files with 17 additions and 16 deletions

View File

@@ -1,21 +1,22 @@
package app.revanced.patches.reddit.customclients.boostforreddit.fix.slink 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 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) accessFlags(AccessFlags.PUBLIC)
returns("Ljava/lang/String") returnType("Ljava/lang/String;")
strings("access_token") definingClass("Lnet/dean/jraw/http/oauth/OAuthData;")
custom { method, _ -> method.definingClass == "Lnet/dean/jraw/http/oauth/OAuthData;" }
} }
internal val handleNavigationFingerprint = fingerprint { internal val BytecodePatchContext.handleNavigationMethod by gettingFirstMutableMethodDeclaratively(
strings( "android.intent.action.SEARCH",
"android.intent.action.SEARCH", "subscription",
"subscription", "sort",
"sort", "period",
"period", "boostforreddit.com/themes"
"boostforreddit.com/themes", )
)
}

View File

@@ -20,7 +20,7 @@ val fixSlinksPatch = fixSLinksPatch(
apply { apply {
// region Patch navigation handler. // region Patch navigation handler.
handleNavigationFingerprint.method.apply { handleNavigationMethod.apply {
val urlRegister = "p1" val urlRegister = "p1"
val tempRegister = "v1" val tempRegister = "v1"
@@ -40,7 +40,7 @@ val fixSlinksPatch = fixSLinksPatch(
// region Patch set access token. // region Patch set access token.
getOAuthAccessTokenFingerprint.method.addInstruction( getOAuthAccessTokenMethod.addInstruction(
3, 3,
"invoke-static { v0 }, $EXTENSION_CLASS_DESCRIPTOR->$SET_ACCESS_TOKEN_METHOD", "invoke-static { v0 }, $EXTENSION_CLASS_DESCRIPTOR->$SET_ACCESS_TOKEN_METHOD",
) )