mirror of
https://github.com/revanced/revanced-patches
synced 2024-08-27 17:51:15 +02:00
feat(Joey for Reddit): Add Disable ads
patch
This commit is contained in:
parent
cd103dd9b8
commit
ad7e147712
@ -0,0 +1,10 @@
|
||||
package app.revanced.patches.reddit.customclients.joeyforreddit.ads.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object IsAdFreeUserFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
accessFlags = AccessFlags.PUBLIC.value,
|
||||
strings = listOf("AD_FREE_USER")
|
||||
)
|
@ -0,0 +1,33 @@
|
||||
package app.revanced.patches.reddit.customclients.joeyforreddit.ads.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Package
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.reddit.customclients.joeyforreddit.ads.fingerprints.IsAdFreeUserFingerprint
|
||||
import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.patch.DisablePiracyDetectionPatch
|
||||
|
||||
@Patch
|
||||
@Name("Disable ads")
|
||||
@DependsOn([DisablePiracyDetectionPatch::class])
|
||||
@Compatibility([Package("o.o.joey")])
|
||||
class DisableAdsPatch : BytecodePatch(listOf(IsAdFreeUserFingerprint)) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
IsAdFreeUserFingerprint.result?.mutableMethod?.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
"""
|
||||
) ?: return IsAdFreeUserFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user