From 3558c44a05c13f19fefdbbf14b364181a79f17c0 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Tue, 17 Jun 2025 23:03:35 +0200 Subject: [PATCH] fix(Threads - Hide ads): Constrain patch to the last working app target (#5189) --- patches/api/patches.api | 4 ++++ .../patches/instagram/ads/HideAdsPatch.kt | 13 ++++++++++--- .../revanced/patches/meta/ads/HideAdsPatch.kt | 13 ++----------- .../app/revanced/patches/threads/HideAdsPatch.kt | 16 ++++++++++++++++ 4 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 patches/src/main/kotlin/app/revanced/patches/threads/HideAdsPatch.kt diff --git a/patches/api/patches.api b/patches/api/patches.api index e98f9b2c3..be23caa1c 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -958,6 +958,10 @@ public final class app/revanced/patches/swissid/integritycheck/RemoveGooglePlayI public static final fun getRemoveGooglePlayIntegrityCheckPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } +public final class app/revanced/patches/threads/HideAdsPatchKt { + public static final fun getHideAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch; +} + public final class app/revanced/patches/ticktick/misc/themeunlock/UnlockThemePatchKt { public static final fun getUnlockProPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/ads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/ads/HideAdsPatch.kt index 9e80fe416..e82a54b05 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/ads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/ads/HideAdsPatch.kt @@ -1,9 +1,16 @@ package app.revanced.patches.instagram.ads import app.revanced.patcher.patch.bytecodePatch +import app.revanced.patches.meta.ads.adInjectorFingerprint +import app.revanced.util.returnEarly -@Deprecated("Patch was moved to different package: app.revanced.patches.meta.ads.hideAdsPatch") @Suppress("unused") -val hideAdsPatch = bytecodePatch { - dependsOn(app.revanced.patches.meta.ads.hideAdsPatch) +val hideAdsPatch = bytecodePatch( + name = "Hide ads", +) { + compatibleWith("com.instagram.android") + + execute { + adInjectorFingerprint.method.returnEarly(false) + } } diff --git a/patches/src/main/kotlin/app/revanced/patches/meta/ads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/meta/ads/HideAdsPatch.kt index f1fb3d791..9c6839f6c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/meta/ads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/meta/ads/HideAdsPatch.kt @@ -3,18 +3,9 @@ package app.revanced.patches.meta.ads import app.revanced.patcher.patch.bytecodePatch import app.revanced.util.returnEarly +@Deprecated("Instead use the Instagram or Threads specific hide ads patch") @Suppress("unused") -val hideAdsPatch = bytecodePatch( - name = "Hide ads", -) { - /** - * Patch is identical for both Instagram and Threads app. - */ - compatibleWith( - "com.instagram.android", - "com.instagram.barcelona", - ) - +val hideAdsPatch = bytecodePatch { execute { adInjectorFingerprint.method.returnEarly(false) } diff --git a/patches/src/main/kotlin/app/revanced/patches/threads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/threads/HideAdsPatch.kt new file mode 100644 index 000000000..c71869480 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/threads/HideAdsPatch.kt @@ -0,0 +1,16 @@ +package app.revanced.patches.threads + +import app.revanced.patcher.patch.bytecodePatch +import app.revanced.patches.meta.ads.adInjectorFingerprint +import app.revanced.util.returnEarly + +@Suppress("unused") +val hideAdsPatch = bytecodePatch( + name = "Hide ads", +) { + compatibleWith("com.instagram.barcelona"("382.0.0.51.85")) + + execute { + adInjectorFingerprint.method.returnEarly(false) + } +}