diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/ad/comments/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/ad/comments/Fingerprints.kt index 4fa8dbc81..9b8e61c67 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/ad/comments/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/ad/comments/Fingerprints.kt @@ -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) } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/ad/comments/HideCommentAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/ad/comments/HideCommentAdsPatch.kt index 4890ea83c..0a19d4146 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/ad/comments/HideCommentAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/ad/comments/HideCommentAdsPatch.kt @@ -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") } }