refactor(reddit): HideCommentAdsPatch
This commit is contained in:
parent
f8e912f937
commit
da08df7d9e
2 changed files with 12 additions and 9 deletions
|
|
@ -1,10 +1,11 @@
|
|||
package app.revanced.patches.reddit.ad.comments
|
||||
|
||||
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.patch.BytecodePatchContext
|
||||
|
||||
internal val hideCommentAdsFingerprint = fingerprint {
|
||||
custom { method, classDef ->
|
||||
method.name == "invokeSuspend" &&
|
||||
classDef.contains("LoadAdsCombinedCall")
|
||||
}
|
||||
internal val BytecodePatchContext.hideCommentAdsMethod by gettingFirstMutableMethodDeclaratively {
|
||||
name("invokeSuspend")
|
||||
definingClass("LoadAdsCombinedCall"::contains)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package app.revanced.patches.reddit.ad.comments
|
|||
|
||||
import app.revanced.patcher.extensions.replaceInstructions
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
|
||||
val hideCommentAdsPatch = bytecodePatch(
|
||||
description = "Removes ads in the comments.",
|
||||
@Suppress("unused", "ObjectPropertyName")
|
||||
val `Hide comment ads` by creatingBytecodePatch(
|
||||
description = "Removes ads in the comments."
|
||||
) {
|
||||
|
||||
apply {
|
||||
hideCommentAdsFingerprint.method.replaceInstructions(0, "return-object p1")
|
||||
hideCommentAdsMethod.replaceInstructions(0, "return-object p1")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue