From 87c86b53a91b0054ac892a3f02bbe7bf83bbf813 Mon Sep 17 00:00:00 2001 From: Denis Kerner <11692788+dtricks@users.noreply.github.com> Date: Wed, 2 Apr 2025 00:27:59 +0200 Subject: [PATCH] feat(Angulus): Add `Hide ads` patch (#4604) Co-authored-by: Denis Kerner Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Co-authored-by: oSumAtrIX --- patches/api/patches.api | 4 ++++ .../patches/angulus/ads/Fingerprints.kt | 18 ++++++++++++++++++ .../patches/angulus/ads/RemoveAdsPatch.kt | 14 ++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 patches/src/main/kotlin/app/revanced/patches/angulus/ads/Fingerprints.kt create mode 100644 patches/src/main/kotlin/app/revanced/patches/angulus/ads/RemoveAdsPatch.kt diff --git a/patches/api/patches.api b/patches/api/patches.api index fc2d0de32..7ea364a9a 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -132,6 +132,10 @@ public final class app/revanced/patches/amazon/DeepLinkingPatchKt { public static final fun getDeepLinkingPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } +public final class app/revanced/patches/angulus/ads/RemoveAdsPatchKt { + public static final fun getAngulusPatch ()Lapp/revanced/patcher/patch/BytecodePatch; +} + public final class app/revanced/patches/backdrops/misc/pro/ProUnlockPatchKt { public static final fun getProUnlockPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } diff --git a/patches/src/main/kotlin/app/revanced/patches/angulus/ads/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/angulus/ads/Fingerprints.kt new file mode 100644 index 000000000..3196adb7e --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/angulus/ads/Fingerprints.kt @@ -0,0 +1,18 @@ +package app.revanced.patches.angulus.ads + +import app.revanced.patcher.fingerprint +import com.android.tools.smali.dexlib2.AccessFlags + +// Keywords to search for in case the method name changes: +// dailyMeasurementCount +// lastMeasurementDate +// dailyAdResetCount +// MeasurementPrefs + +// This fingerprint targets a method that returns the daily measurement count. +// This method is used to determine if the user has reached the daily limit of measurements. +internal val getDailyMeasurementCountFingerprint = fingerprint { + accessFlags(AccessFlags.PRIVATE) + returns("I") + strings("dailyMeasurementCount") +} diff --git a/patches/src/main/kotlin/app/revanced/patches/angulus/ads/RemoveAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/angulus/ads/RemoveAdsPatch.kt new file mode 100644 index 000000000..5eb585cf5 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/angulus/ads/RemoveAdsPatch.kt @@ -0,0 +1,14 @@ +package app.revanced.patches.angulus.ads + +import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.returnEarly + +@Suppress("unused") +val angulusPatch = bytecodePatch(name = "Hide ads") { + compatibleWith("com.drinkplusplus.angulus") + + execute { + // Always return 0 as the daily measurement count. + getDailyMeasurementCountFingerprint.method.returnEarly() + } +}