mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-29 22:24:31 +02:00
fix(Reddit - Hide ads): Hide comment ads
does not work https://github.com/inotia00/ReVanced_Extended/issues/2884
This commit is contained in:
parent
4feff6b150
commit
4330b7f6df
@ -27,14 +27,6 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"$PATCHES_PATH/GeneralAdsPatch;"
|
"$PATCHES_PATH/GeneralAdsPatch;"
|
||||||
|
|
||||||
private val isCommentAdsMethod: Method.() -> Boolean = {
|
|
||||||
parameterTypes.size == 1 &&
|
|
||||||
parameterTypes.first().startsWith("Lcom/reddit/ads/conversation/") &&
|
|
||||||
accessFlags == AccessFlags.PUBLIC or AccessFlags.FINAL &&
|
|
||||||
returnType == "V" &&
|
|
||||||
indexOfFirstStringInstruction("ad") >= 0
|
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val adsPatch = bytecodePatch(
|
val adsPatch = bytecodePatch(
|
||||||
HIDE_ADS.title,
|
HIDE_ADS.title,
|
||||||
@ -94,11 +86,20 @@ val adsPatch = bytecodePatch(
|
|||||||
if (is_2025_06_or_greater) {
|
if (is_2025_06_or_greater) {
|
||||||
listOf(
|
listOf(
|
||||||
commentAdCommentScreenAdViewFingerprint,
|
commentAdCommentScreenAdViewFingerprint,
|
||||||
commentAdDetailListHeaderViewFingerprint
|
commentAdDetailListHeaderViewFingerprint,
|
||||||
|
commentsViewModelFingerprint
|
||||||
).forEach { fingerprint ->
|
).forEach { fingerprint ->
|
||||||
fingerprint.methodOrThrow().hook()
|
fingerprint.methodOrThrow().hook()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
val isCommentAdsMethod: Method.() -> Boolean = {
|
||||||
|
parameterTypes.size == 1 &&
|
||||||
|
parameterTypes.first().startsWith("Lcom/reddit/ads/conversation/") &&
|
||||||
|
accessFlags == AccessFlags.PUBLIC or AccessFlags.FINAL &&
|
||||||
|
returnType == "V" &&
|
||||||
|
indexOfFirstStringInstruction("ad") >= 0
|
||||||
|
}
|
||||||
|
|
||||||
classes.forEach { classDef ->
|
classes.forEach { classDef ->
|
||||||
classDef.methods.forEach { method ->
|
classDef.methods.forEach { method ->
|
||||||
if (method.isCommentAdsMethod()) {
|
if (method.isCommentAdsMethod()) {
|
||||||
|
@ -8,6 +8,7 @@ import com.android.tools.smali.dexlib2.AccessFlags
|
|||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.TypeReference
|
||||||
|
|
||||||
internal val adPostFingerprint = legacyFingerprint(
|
internal val adPostFingerprint = legacyFingerprint(
|
||||||
name = "adPostFingerprint",
|
name = "adPostFingerprint",
|
||||||
@ -49,6 +50,20 @@ internal val commentAdDetailListHeaderViewFingerprint = legacyFingerprint(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
internal val commentsViewModelFingerprint = legacyFingerprint(
|
||||||
|
name = "commentsViewModelFingerprint",
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("L", "Z", "L", "I"),
|
||||||
|
customFingerprint = { method, classDef ->
|
||||||
|
classDef.superclass == "Lcom/reddit/screen/presentation/CompositionViewModel;" &&
|
||||||
|
method.indexOfFirstInstruction {
|
||||||
|
opcode == Opcode.NEW_INSTANCE &&
|
||||||
|
getReference<TypeReference>()?.type?.startsWith("Lcom/reddit/postdetail/comment/refactor/CommentsViewModel\$LoadAdsSeparately\$") == true
|
||||||
|
} >= 0
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
internal val newAdPostFingerprint = legacyFingerprint(
|
internal val newAdPostFingerprint = legacyFingerprint(
|
||||||
name = "newAdPostFingerprint",
|
name = "newAdPostFingerprint",
|
||||||
returnType = "L",
|
returnType = "L",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user