mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-19 09:03:58 +00:00
refactor(baconreader): FixRedgifsApiPatch
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
package app.revanced.patches.reddit.customclients.baconreader.fix.redgifs
|
||||
|
||||
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.parameterTypes
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
|
||||
internal val getOkHttpClientFingerprint = fingerprint {
|
||||
returns("Lokhttp3/OkHttpClient;")
|
||||
parameters()
|
||||
custom { method, classDef ->
|
||||
classDef.type == "Lcom/onelouder/baconreader/media/gfycat/RedGifsManager;" && method.name == "getOkhttpClient"
|
||||
}
|
||||
}
|
||||
internal val BytecodePatchContext.getOkHttpClientMethod by gettingFirstMutableMethodDeclaratively {
|
||||
returnType("Lokhttp3/OkHttpClient;")
|
||||
parameterTypes()
|
||||
definingClass("Lcom/onelouder/baconreader/media/gfycat/RedGifsManager;")
|
||||
name("getOkhttpClient")
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package app.revanced.patches.reddit.customclients.baconreader.fix.redgifs
|
||||
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.extensions.removeInstruction
|
||||
import app.revanced.patcher.extensions.removeInstructions
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD
|
||||
@@ -28,7 +27,7 @@ val fixRedgifsApi = fixRedgifsApiPatch(
|
||||
apply {
|
||||
// region Patch Redgifs OkHttp3 client.
|
||||
|
||||
getOkHttpClientFingerprint.method.apply {
|
||||
getOkHttpClientMethod.apply {
|
||||
// Remove conflicting OkHttp interceptors.
|
||||
val originalInterceptorInstallIndex = indexOfFirstInstructionOrThrow {
|
||||
opcode == Opcode.NEW_INSTANCE && getReference<TypeReference>()?.type == "Lcom/onelouder/baconreader/media/gfycat/RedGifsManager\$HeaderInterceptor;"
|
||||
|
||||
Reference in New Issue
Block a user