2023-09-20 05:33:02 +02:00
|
|
|
package app.revanced.patches.reddit.ad.comments
|
|
|
|
|
2023-12-02 22:35:13 +01:00
|
|
|
import app.revanced.util.exception
|
2023-09-20 05:33:02 +02:00
|
|
|
import app.revanced.patcher.data.BytecodeContext
|
|
|
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
|
|
|
import app.revanced.patcher.patch.BytecodePatch
|
|
|
|
import app.revanced.patcher.patch.annotation.Patch
|
|
|
|
import app.revanced.patches.reddit.ad.comments.fingerprints.HideCommentAdsFingerprint
|
|
|
|
|
2024-03-02 08:27:05 +01:00
|
|
|
@Patch(description = "Removes ads in the comments.")
|
2023-09-20 05:33:02 +02:00
|
|
|
object HideCommentAdsPatch : BytecodePatch(
|
|
|
|
setOf(HideCommentAdsFingerprint)
|
|
|
|
) {
|
|
|
|
// Returns a blank object instead of the comment ad.
|
|
|
|
override fun execute(context: BytecodeContext) = HideCommentAdsFingerprint.result?.mutableMethod?.addInstructions(
|
|
|
|
0, """
|
|
|
|
new-instance v0, Ljava/lang/Object;
|
|
|
|
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-object v0
|
|
|
|
"""
|
|
|
|
) ?: throw HideCommentAdsFingerprint.exception
|
|
|
|
}
|