File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed
src/main/kotlin/app/revanced/patches/duolingo/energy Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,10 @@ public final class app/revanced/patches/duolingo/debug/EnableDebugMenuPatchKt {
184184 public static final fun getEnableDebugMenuPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
185185}
186186
187+ public final class app/revanced/patches/duolingo/energy/SkipEnergyRechargeAdsPatchKt {
188+ public static final fun getSkipEnergyRechargeAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
189+ }
190+
187191public final class app/revanced/patches/facebook/ads/mainfeed/HideSponsoredStoriesPatchKt {
188192 public static final fun getHideSponsoredStoriesPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
189193}
Original file line number Diff line number Diff line change 1+ package app.revanced.patches.duolingo.energy
2+
3+ import app.revanced.patcher.fingerprint
4+ import com.android.tools.smali.dexlib2.AccessFlags
5+ import com.android.tools.smali.dexlib2.Opcode
6+
7+ /* *
8+ * Matches the class found in [energyConfigToStringFingerprint].
9+ */
10+ internal val initializeEnergyConfigFingerprint = fingerprint {
11+ accessFlags(AccessFlags .PUBLIC , AccessFlags .CONSTRUCTOR )
12+ opcodes(Opcode .RETURN_VOID )
13+ }
14+
15+ // Class name currently is not obfuscated but it may be in the future.
16+ internal val energyConfigToStringFingerprint = fingerprint {
17+ parameters()
18+ returns(" Ljava/lang/String;" )
19+ strings(" EnergyConfig(" , " maxEnergy=" ) // Partial string matches.
20+ custom { method, _ -> method.name == " toString" }
21+ }
Original file line number Diff line number Diff line change 1+ package app.revanced.patches.duolingo.energy
2+
3+ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
4+ import app.revanced.patcher.patch.bytecodePatch
5+ import app.revanced.util.findFieldFromToString
6+
7+ @Suppress(" unused" )
8+ val skipEnergyRechargeAdsPatch = bytecodePatch(
9+ name = " Skip energy recharge ads" ,
10+ description = " Skips watching ads to recharge energy."
11+ ) {
12+ compatibleWith(" com.duolingo" )
13+
14+ execute {
15+ initializeEnergyConfigFingerprint
16+ .match(energyConfigToStringFingerprint.classDef)
17+ .method.apply {
18+ val energyField = energyConfigToStringFingerprint.method
19+ .findFieldFromToString(" energy=" )
20+ val insertIndex = initializeEnergyConfigFingerprint.patternMatch!! .startIndex
21+
22+ addInstructions(
23+ insertIndex,
24+ """
25+ const/16 v0, 99
26+ iput v0, p0, $energyField
27+ """
28+ )
29+ }
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments