Skip to content

fix(Duolingo - Hide ads): Support latest app release #4790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ 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

// FamilyQuestOverride package has been refactored, so check both fully-qualified names.
val oldFingerprint = buildInitMonetizationFingerprint("Lcom/duolingo/debug/FamilyQuestOverride;")
val newFingerprint =
buildInitMonetizationFingerprint("Lcom/duolingo/data/debug/monetization/FamilyQuestOverride;")
val foundFingerprint = if (newFingerprint.methodOrNull != null) newFingerprint else oldFingerprint

foundFingerprint.method.apply {
val insertIndex = foundFingerprint.patternMatch!!.startIndex
val register = getInstruction<TwoRegisterInstruction>(insertIndex).registerA

addInstructions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import app.revanced.patcher.fingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

internal val initializeMonetizationDebugSettingsFingerprint = fingerprint {
internal fun buildInitMonetizationFingerprint(lastParam: String) = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
returns("V")
parameters(
"Z", // disableAds
"Z", // useDebugBilling
"Z", // showManageSubscriptions
"Z", // alwaysShowSuperAds
"Lcom/duolingo/debug/FamilyQuestOverride;",
lastParam,
)
opcodes(Opcode.IPUT_BOOLEAN)
}