feat(Sync for Lemmy): Add Disable ads
patch (#2872)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
1c649c976d
commit
0785819dd5
|
@ -481,6 +481,13 @@ public final class app/revanced/patches/reddit/customclients/Constants {
|
||||||
public static final field OAUTH_USER_AGENT Ljava/lang/String;
|
public static final field OAUTH_USER_AGENT Ljava/lang/String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract class app/revanced/patches/reddit/customclients/ads/BaseDisableAdsPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||||
|
public fun <init> (Ljava/util/Set;Ljava/util/Set;)V
|
||||||
|
public synthetic fun <init> (Ljava/util/Set;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
|
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
|
}
|
||||||
|
|
||||||
public final class app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch {
|
public final class app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch {
|
||||||
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch;
|
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch;
|
||||||
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
|
@ -536,10 +543,12 @@ public final class app/revanced/patches/reddit/customclients/slide/api/SpoofClie
|
||||||
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patches/reddit/customclients/syncforreddit/ads/DisableAdsPatch : app/revanced/patcher/patch/BytecodePatch {
|
public final class app/revanced/patches/reddit/customclients/syncforlemmy/ads/DisableAdsPatch : app/revanced/patches/reddit/customclients/ads/BaseDisableAdsPatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/syncforlemmy/ads/DisableAdsPatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/reddit/customclients/syncforreddit/ads/DisableAdsPatch : app/revanced/patches/reddit/customclients/ads/BaseDisableAdsPatch {
|
||||||
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/syncforreddit/ads/DisableAdsPatch;
|
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/syncforreddit/ads/DisableAdsPatch;
|
||||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
|
||||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patches/reddit/customclients/syncforreddit/annoyances/startup/DisableSyncForLemmyBottomSheetPatch : app/revanced/patcher/patch/BytecodePatch {
|
public final class app/revanced/patches/reddit/customclients/syncforreddit/annoyances/startup/DisableSyncForLemmyBottomSheetPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package app.revanced.patches.reddit.customclients.ads
|
||||||
|
|
||||||
|
import app.revanced.patcher.PatchClass
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patches.reddit.customclients.ads.fingerprints.IsAdsEnabledFingerprint
|
||||||
|
import app.revanced.util.returnEarly
|
||||||
|
|
||||||
|
abstract class BaseDisableAdsPatch(
|
||||||
|
dependencies: Set<PatchClass> = emptySet(),
|
||||||
|
compatiblePackages: Set<CompatiblePackage>,
|
||||||
|
) : BytecodePatch(
|
||||||
|
name = "Disable ads",
|
||||||
|
dependencies = dependencies,
|
||||||
|
compatiblePackages = compatiblePackages,
|
||||||
|
fingerprints = setOf(IsAdsEnabledFingerprint),
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) = listOf(IsAdsEnabledFingerprint).returnEarly()
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package app.revanced.patches.reddit.customclients.syncforreddit.ads.fingerprints
|
package app.revanced.patches.reddit.customclients.ads.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
@ -7,5 +7,5 @@ import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
internal object IsAdsEnabledFingerprint : MethodFingerprint(
|
internal object IsAdsEnabledFingerprint : MethodFingerprint(
|
||||||
returnType = "Z",
|
returnType = "Z",
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
strings = listOf("SyncIapHelper")
|
strings = listOf("SyncIapHelper"),
|
||||||
)
|
)
|
|
@ -0,0 +1,10 @@
|
||||||
|
package app.revanced.patches.reddit.customclients.syncforlemmy.ads
|
||||||
|
|
||||||
|
import app.revanced.patches.reddit.customclients.ads.BaseDisableAdsPatch
|
||||||
|
import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.DisablePiracyDetectionPatch
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
|
object DisableAdsPatch : BaseDisableAdsPatch(
|
||||||
|
dependencies = setOf(DisablePiracyDetectionPatch::class),
|
||||||
|
compatiblePackages = setOf(CompatiblePackage("com.laurencedawson.reddit_sync")),
|
||||||
|
)
|
|
@ -1,30 +1,8 @@
|
||||||
package app.revanced.patches.reddit.customclients.syncforreddit.ads
|
package app.revanced.patches.reddit.customclients.syncforreddit.ads
|
||||||
|
|
||||||
import app.revanced.util.exception
|
import app.revanced.patches.reddit.customclients.ads.BaseDisableAdsPatch
|
||||||
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.CompatiblePackage
|
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
|
||||||
import app.revanced.patches.reddit.customclients.syncforreddit.ads.fingerprints.IsAdsEnabledFingerprint
|
|
||||||
import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.DisablePiracyDetectionPatch
|
|
||||||
|
|
||||||
@Patch(
|
|
||||||
name = "Disable ads",
|
|
||||||
dependencies = [DisablePiracyDetectionPatch::class],
|
|
||||||
compatiblePackages = [CompatiblePackage("com.laurencedawson.reddit_sync")]
|
|
||||||
)
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object DisableAdsPatch : BytecodePatch(setOf(IsAdsEnabledFingerprint)) {
|
object DisableAdsPatch : BaseDisableAdsPatch(
|
||||||
override fun execute(context: BytecodeContext) {
|
compatiblePackages = setOf(CompatiblePackage("io.syncapps.lemmy_sync")),
|
||||||
IsAdsEnabledFingerprint.result?.mutableMethod?.apply {
|
)
|
||||||
addInstructions(
|
|
||||||
0,
|
|
||||||
"""
|
|
||||||
const/4 v0, 0x0
|
|
||||||
return v0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
} ?: throw IsAdsEnabledFingerprint.exception
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue