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
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"
)

View File

@@ -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",
)