mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-18 08:43:56 +00:00
refactor(boostforreddit): FixSLinksPatch
This commit is contained in:
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user