diff --git a/patches/src/main/kotlin/app/revanced/patches/duolingo/ad/DisableAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/duolingo/ad/DisableAdsPatch.kt index a5c56ddb0..af93ceb16 100644 --- a/patches/src/main/kotlin/app/revanced/patches/duolingo/ad/DisableAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/duolingo/ad/DisableAdsPatch.kt @@ -19,14 +19,16 @@ val disableAdsPatch = bytecodePatch( // SharedPreferences has a debug boolean value with key "disable_ads", which maps to "DebugCategory.DISABLE_ADS". // // MonetizationDebugSettings seems to be the most general setting to work fine. - initializeMonetizationDebugSettingsFingerprint.method.apply { - val insertIndex = initializeMonetizationDebugSettingsFingerprint.patternMatch!!.startIndex - val register = getInstruction(insertIndex).registerA + initializeMonetizationDebugSettingsFingerprint + .match(monetizationDebugSettingsToStringFingerprint.classDef) + .method.apply { + val insertIndex = initializeMonetizationDebugSettingsFingerprint.patternMatch!!.startIndex + val register = getInstruction(insertIndex).registerA - addInstructions( - insertIndex, - "const/4 v$register, 0x1", - ) - } + addInstructions( + insertIndex, + "const/4 v$register, 0x1", + ) + } } } diff --git a/patches/src/main/kotlin/app/revanced/patches/duolingo/ad/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/duolingo/ad/Fingerprints.kt index 9a23af8c8..8ec0068da 100644 --- a/patches/src/main/kotlin/app/revanced/patches/duolingo/ad/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/duolingo/ad/Fingerprints.kt @@ -7,13 +7,11 @@ import com.android.tools.smali.dexlib2.Opcode internal val initializeMonetizationDebugSettingsFingerprint = fingerprint { accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR) returns("V") - parameters( - "Z", // disableAds - "Z", // useDebugBilling - "Z", // showManageSubscriptions - "Z", // alwaysShowSuperAds - // matches "Lcom/duolingo/debug/FamilyQuestOverride;" or "Lcom/duolingo/data/debug/monetization/FamilyQuestOverride;" - "Lcom/duolingo/", - ) + // Parameters have not been reliable for fingerprinting between versions. opcodes(Opcode.IPUT_BOOLEAN) } + +internal val monetizationDebugSettingsToStringFingerprint = fingerprint { + strings("MonetizationDebugSettings(") // Partial string match. + custom { method, _ -> method.name == "toString" } +} \ No newline at end of file