From 7cf5102fb012f1cdef2d56ff3a420440a26c94dc Mon Sep 17 00:00:00 2001 From: Tymek Date: Tue, 13 Jan 2026 16:38:10 +0100 Subject: [PATCH] Fix(Jakdojade) Code style fixes --- patches/api/patches.api | 4 +-- .../{RemoveAdsPatch.kt => DisableAdsPatch.kt} | 29 ++++++++----------- .../patches/jakdojade/ad/Fingerprints.kt | 18 ++++++------ 3 files changed, 23 insertions(+), 28 deletions(-) rename patches/src/main/kotlin/app/revanced/patches/jakdojade/ad/{RemoveAdsPatch.kt => DisableAdsPatch.kt} (62%) diff --git a/patches/api/patches.api b/patches/api/patches.api index 0094600069..c457c4fdee 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -352,8 +352,8 @@ public final class app/revanced/patches/irplus/ad/RemoveAdsPatchKt { public static final fun getRemoveAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } -public final class app/revanced/patches/jakdojade/ad/RemoveAdsPatchKt { - public static final fun getRemoveAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch; +public final class app/revanced/patches/jakdojade/ad/DisableAdsPatchKt { + public static final fun getDisableAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } public final class app/revanced/patches/letterboxd/ads/HideAdsPatchKt { diff --git a/patches/src/main/kotlin/app/revanced/patches/jakdojade/ad/RemoveAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/jakdojade/ad/DisableAdsPatch.kt similarity index 62% rename from patches/src/main/kotlin/app/revanced/patches/jakdojade/ad/RemoveAdsPatch.kt rename to patches/src/main/kotlin/app/revanced/patches/jakdojade/ad/DisableAdsPatch.kt index 5a0aa1434b..63ebc9ed2f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/jakdojade/ad/RemoveAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/jakdojade/ad/DisableAdsPatch.kt @@ -2,40 +2,35 @@ package app.revanced.patches.jakdojade.ad import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.returnEarly @Suppress("unused") -val removeAdsPatch = bytecodePatch( - name = "Remove ads", +val disableAdsPatch = bytecodePatch( + name = "Disable ads", ) { compatibleWith("com.citynav.jakdojade.pl.android") execute { - // Spoof isPremium() to always return true - // We can do this beacuse Jakdojade Premium's only feature is ad removal - isPremiumFingerprint.method.replaceInstructions( - 0, - """ - const/4 v0, 0x1 - return v0 - """, - ) + // Spoof isPremium() to always return true. + // We can do this beacuse Jakdojade Premium's only feature is ad removal. + isPremiumFingerprint.method.returnEarly(true) - // Spoof Premium renewal date in the UI - // We need to do the spoofing in order to avoid app crashes when opening profile menu - premiumRenewalDateFingerprint.method.replaceInstructions( + // Spoof Premium renewal date in the UI. + // We need to do the spoofing in order to avoid app crashes when opening profile menu. + getPremiumRenewalDateFingerprint.method.replaceInstructions( 0, """ const-string v0, "" return-object v0 - """.trimIndent() + """ ) - // Spoof Premium type + // Spoof Premium type. getGoogleProductFingerprint.method.replaceInstructions( 0, """ sget-object v0, Lcom/citynav/jakdojade/pl/android/billing/output/GoogleProduct;->PREMIUM_YEARLY_V4:Lcom/citynav/jakdojade/pl/android/billing/output/GoogleProduct; return-object v0 - """.trimIndent() + """ ) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/jakdojade/ad/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/jakdojade/ad/Fingerprints.kt index 6c6b53cf63..818ba5eacd 100644 --- a/patches/src/main/kotlin/app/revanced/patches/jakdojade/ad/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/jakdojade/ad/Fingerprints.kt @@ -17,18 +17,18 @@ internal val isPremiumFingerprint = fingerprint { Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT, Opcode.IF_EQZ, - Opcode.IGET_OBJECT, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT, - Opcode.IF_NEZ, - Opcode.CONST_4, - Opcode.GOTO, - Opcode.CONST_4, - Opcode.RETURN +// Opcode.IGET_OBJECT, +// Opcode.INVOKE_VIRTUAL, +// Opcode.MOVE_RESULT, +// Opcode.IF_NEZ, +// Opcode.CONST_4, +// Opcode.GOTO, +// Opcode.CONST_4, +// Opcode.RETURN ) } -internal val premiumRenewalDateFingerprint = fingerprint { +internal val getPremiumRenewalDateFingerprint = fingerprint { returns("Ljava/lang/String;") accessFlags(AccessFlags.PUBLIC) parameters()