Skip to content

Commit 0af0ee9

Browse files
SwakshanoSumAtrIX
andauthored
feat(Letterboxd): Add Hide ads patch (#6309)
Co-authored-by: oSumAtrIX <[email protected]>
1 parent fff2954 commit 0af0ee9

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

patches/api/patches.api

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ public final class app/revanced/patches/irplus/ad/RemoveAdsPatchKt {
328328
public static final fun getRemoveAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
329329
}
330330

331+
public final class app/revanced/patches/letterboxd/ads/HideAdsPatchKt {
332+
public static final fun getHideAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
333+
}
334+
331335
public final class app/revanced/patches/lightroom/misc/login/DisableMandatoryLoginPatchKt {
332336
public static final fun getDisableMandatoryLoginPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
333337
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package app.revanced.patches.letterboxd.ads
2+
3+
import app.revanced.patcher.fingerprint
4+
5+
internal const val admobHelperClassName = "Lcom/letterboxd/letterboxd/helpers/AdmobHelper;"
6+
7+
internal val admobHelperSetShowAdsFingerprint = fingerprint {
8+
custom { method, classDef ->
9+
method.name == "setShowAds" && classDef.type == admobHelperClassName
10+
}
11+
}
12+
13+
internal val admobHelperShouldShowAdsFingerprint = fingerprint {
14+
custom { method, classDef ->
15+
method.name == "shouldShowAds" && classDef.type == admobHelperClassName
16+
}
17+
}
18+
19+
internal val filmFragmentShowAdsFingerprint = fingerprint {
20+
custom { method, classDef ->
21+
method.name == "showAds" && classDef.type.endsWith("/FilmFragment;")
22+
}
23+
}
24+
25+
internal val memberExtensionShowAdsFingerprint = fingerprint {
26+
custom { method, classDef ->
27+
method.name == "showAds" && classDef.type.endsWith("/AMemberExtensionKt;")
28+
}
29+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
package app.revanced.patches.letterboxd.ads
3+
4+
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
5+
import app.revanced.patcher.patch.bytecodePatch
6+
import app.revanced.util.returnEarly
7+
8+
@Suppress("unused")
9+
val hideAdsPatch = bytecodePatch(
10+
name = "Hide ads",
11+
) {
12+
compatibleWith("com.letterboxd.letterboxd")
13+
14+
execute {
15+
admobHelperSetShowAdsFingerprint.method.addInstruction(0, "const p1, 0x0")
16+
listOf(admobHelperShouldShowAdsFingerprint, filmFragmentShowAdsFingerprint, memberExtensionShowAdsFingerprint).forEach {
17+
it.method.returnEarly(false)
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)