Skip to content

Commit 3c4cecb

Browse files
authored
feat(Threads): Hide Ads (#5064)
1 parent 0b90016 commit 3c4cecb

File tree

4 files changed

+41
-30
lines changed

4 files changed

+41
-30
lines changed

patches/api/patches.api

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ public final class app/revanced/patches/messenger/navbar/RemoveMetaAITabPatchKt
296296
public static final fun getRemoveMetaAITabPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
297297
}
298298

299+
public final class app/revanced/patches/meta/ads/HideAdsPatchKt {
300+
public static final fun getHideAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
301+
}
302+
299303
public final class app/revanced/patches/mifitness/misc/locale/ForceEnglishLocalePatchKt {
300304
public static final fun getForceEnglishLocalePatch ()Lapp/revanced/patcher/patch/BytecodePatch;
301305
}
Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
11
package app.revanced.patches.instagram.ads
22

3-
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
43
import app.revanced.patcher.patch.bytecodePatch
54

5+
@Deprecated("Patch was moved to different package: app.revanced.patches.meta.ads.hideAdsPatch")
66
@Suppress("unused")
7-
val hideAdsPatch = bytecodePatch(
8-
name = "Hide ads",
9-
description = "Hides ads in stories, discover, profile, etc. " +
10-
"An ad can still appear once when refreshing the home feed.",
11-
) {
12-
compatibleWith("com.instagram.android")
13-
14-
execute {
15-
adInjectorFingerprint.method.addInstructions(
16-
0,
17-
"""
18-
const/4 v0, 0x0
19-
return v0
20-
""",
21-
)
22-
}
7+
val hideAdsPatch = bytecodePatch {
8+
dependsOn(app.revanced.patches.meta.ads.hideAdsPatch)
239
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package app.revanced.patches.instagram.ads
2-
3-
import app.revanced.patcher.fingerprint
4-
import com.android.tools.smali.dexlib2.AccessFlags
5-
6-
internal val adInjectorFingerprint = fingerprint {
7-
accessFlags(AccessFlags.PRIVATE)
8-
returns("Z")
9-
parameters("L", "L")
10-
strings(
11-
"SponsoredContentController.insertItem",
12-
)
13-
}
1+
package app.revanced.patches.meta.ads
2+
3+
import app.revanced.patcher.fingerprint
4+
import com.android.tools.smali.dexlib2.AccessFlags
5+
6+
internal val adInjectorFingerprint = fingerprint {
7+
accessFlags(AccessFlags.PRIVATE)
8+
returns("Z")
9+
parameters("L", "L")
10+
strings(
11+
"SponsoredContentController.insertItem",
12+
)
13+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package app.revanced.patches.meta.ads
2+
3+
import app.revanced.patcher.patch.bytecodePatch
4+
import app.revanced.util.returnEarly
5+
6+
@Suppress("unused")
7+
val hideAdsPatch = bytecodePatch(
8+
name = "Hide ads",
9+
) {
10+
/**
11+
* Patch is identical for both Instagram and Threads app.
12+
*/
13+
compatibleWith(
14+
"com.instagram.android",
15+
"com.instagram.barcelona",
16+
)
17+
18+
execute {
19+
adInjectorFingerprint.method.returnEarly(false)
20+
}
21+
}

0 commit comments

Comments
 (0)