mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-10 05:06:17 +00:00
fix(Reddit - Hide ads): Update patch for new versions of Reddit (#6342)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
@@ -3,12 +3,8 @@ package app.revanced.patches.reddit.ad.comments
|
|||||||
import app.revanced.patcher.fingerprint
|
import app.revanced.patcher.fingerprint
|
||||||
|
|
||||||
internal val hideCommentAdsFingerprint = fingerprint {
|
internal val hideCommentAdsFingerprint = fingerprint {
|
||||||
strings(
|
custom { method, classDef ->
|
||||||
"link",
|
method.name == "invokeSuspend" &&
|
||||||
// CommentPageRepository is not returning a link object
|
classDef.contains("LoadAdsCombinedCall")
|
||||||
"is not returning a link object"
|
|
||||||
)
|
|
||||||
custom { _, classDef ->
|
|
||||||
classDef.sourceFile == "PostDetailPresenter.kt"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.revanced.patches.reddit.ad.comments
|
package app.revanced.patches.reddit.ad.comments
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
|
|
||||||
val hideCommentAdsPatch = bytecodePatch(
|
val hideCommentAdsPatch = bytecodePatch(
|
||||||
@@ -8,13 +8,6 @@ val hideCommentAdsPatch = bytecodePatch(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
execute {
|
execute {
|
||||||
hideCommentAdsFingerprint.method.addInstructions(
|
hideCommentAdsFingerprint.method.replaceInstructions(0, "return-object p1")
|
||||||
0,
|
|
||||||
"""
|
|
||||||
new-instance v0, Ljava/lang/Object;
|
|
||||||
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
|
|
||||||
return-object v0
|
|
||||||
""",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,5 @@ internal val adPostFingerprint = fingerprint {
|
|||||||
|
|
||||||
internal val newAdPostFingerprint = fingerprint {
|
internal val newAdPostFingerprint = fingerprint {
|
||||||
opcodes(Opcode.INVOKE_VIRTUAL)
|
opcodes(Opcode.INVOKE_VIRTUAL)
|
||||||
strings("chain", "feedElement")
|
strings("feedElement", "com.reddit.cookie")
|
||||||
custom { _, classDef -> classDef.sourceFile == "AdElementConverter.kt" }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package app.revanced.patches.reddit.ad.general
|
|||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.reddit.ad.banner.hideBannerPatch
|
|
||||||
import app.revanced.patches.reddit.ad.comments.hideCommentAdsPatch
|
import app.revanced.patches.reddit.ad.comments.hideCommentAdsPatch
|
||||||
import app.revanced.patches.reddit.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.reddit.misc.extension.sharedExtensionPatch
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
@@ -16,14 +15,9 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|||||||
val hideAdsPatch = bytecodePatch(
|
val hideAdsPatch = bytecodePatch(
|
||||||
name = "Hide ads",
|
name = "Hide ads",
|
||||||
) {
|
) {
|
||||||
dependsOn(hideBannerPatch, hideCommentAdsPatch, sharedExtensionPatch)
|
dependsOn(hideCommentAdsPatch, sharedExtensionPatch)
|
||||||
|
|
||||||
// Note that for now, this patch and anything using it will only work on
|
compatibleWith("com.reddit.frontpage")
|
||||||
// Reddit 2024.17.0 or older. Newer versions will crash during patching.
|
|
||||||
// See https://github.com/ReVanced/revanced-patches/issues/3099
|
|
||||||
// and https://github.com/iBotPeaches/Apktool/issues/3534.
|
|
||||||
// This constraint is necessary due to dependency on hideBannerPatch.
|
|
||||||
compatibleWith("com.reddit.frontpage"("2024.17.0"))
|
|
||||||
|
|
||||||
execute {
|
execute {
|
||||||
// region Filter promoted ads (does not work in popular or latest feed)
|
// region Filter promoted ads (does not work in popular or latest feed)
|
||||||
|
|||||||
Reference in New Issue
Block a user