refactor(baconreader): FixRedgifsApiPatch
This commit is contained in:
parent
4540e7a484
commit
eadc76b161
2 changed files with 13 additions and 10 deletions
|
|
@ -1,11 +1,15 @@
|
||||||
package app.revanced.patches.reddit.customclients.baconreader.fix.redgifs
|
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 {
|
internal val BytecodePatchContext.getOkHttpClientMethod by gettingFirstMutableMethodDeclaratively {
|
||||||
returns("Lokhttp3/OkHttpClient;")
|
returnType("Lokhttp3/OkHttpClient;")
|
||||||
parameters()
|
parameterTypes()
|
||||||
custom { method, classDef ->
|
definingClass("Lcom/onelouder/baconreader/media/gfycat/RedGifsManager;")
|
||||||
classDef.type == "Lcom/onelouder/baconreader/media/gfycat/RedGifsManager;" && method.name == "getOkhttpClient"
|
name("getOkhttpClient")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package app.revanced.patches.reddit.customclients.baconreader.fix.redgifs
|
package app.revanced.patches.reddit.customclients.baconreader.fix.redgifs
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
|
||||||
import app.revanced.patcher.extensions.removeInstructions
|
import app.revanced.patcher.extensions.removeInstructions
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD
|
import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD
|
||||||
|
|
@ -28,7 +27,7 @@ val fixRedgifsApi = fixRedgifsApiPatch(
|
||||||
apply {
|
apply {
|
||||||
// region Patch Redgifs OkHttp3 client.
|
// region Patch Redgifs OkHttp3 client.
|
||||||
|
|
||||||
getOkHttpClientFingerprint.method.apply {
|
getOkHttpClientMethod.apply {
|
||||||
// Remove conflicting OkHttp interceptors.
|
// Remove conflicting OkHttp interceptors.
|
||||||
val originalInterceptorInstallIndex = indexOfFirstInstructionOrThrow {
|
val originalInterceptorInstallIndex = indexOfFirstInstructionOrThrow {
|
||||||
opcode == Opcode.NEW_INSTANCE && getReference<TypeReference>()?.type == "Lcom/onelouder/baconreader/media/gfycat/RedGifsManager\$HeaderInterceptor;"
|
opcode == Opcode.NEW_INSTANCE && getReference<TypeReference>()?.type == "Lcom/onelouder/baconreader/media/gfycat/RedGifsManager\$HeaderInterceptor;"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue