Skip to content

Commit df62b9c

Browse files
committed
fix(Komoot): Updated patches to support version 2025.38.2
1 parent 773383a commit df62b9c

File tree

2 files changed

+44
-42
lines changed

2 files changed

+44
-42
lines changed

patches/src/main/kotlin/app/revanced/patches/komoot/premium/Fingerprints.kt

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,41 @@ package app.revanced.patches.komoot.premium
22

33
import app.revanced.patcher.fingerprint
44
import com.android.tools.smali.dexlib2.AccessFlags
5-
import com.android.tools.smali.dexlib2.Opcode
65

76
internal val premiumConfigFingerprint = fingerprint {
87
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
9-
opcodes(
10-
Opcode.MOVE_OBJECT,
11-
Opcode.INVOKE_DIRECT
8+
parameters(
9+
"L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L",
10+
"L", "L", "L", "L", "L", "L", "L", "L", "L" ,"L",
11+
"Ljava/lang/Boolean;", "L"
1212
)
1313
custom { _, classDef ->
1414
classDef.endsWith("api/model/AppConfigV3;")
1515
}
1616
}
1717

18-
internal val displayPremiumFingerprint = fingerprint {
19-
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
20-
parameters("L")
21-
returns("L")
18+
internal val publicUserInitFingerprint = fingerprint {
19+
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
20+
parameters("L", "L", "L", "L", "Z")
21+
custom { _, classDef ->
22+
classDef.endsWith("api/model/PublicUserProfileV7;")
23+
}
24+
}
25+
26+
private const val routingPermissionClassName = "Lde/komoot/android/services/api/model/RoutingPermission"
27+
28+
internal val routingPermissionInitFingerprint = fingerprint {
29+
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
30+
parameters("$routingPermissionClassName${"$"}StatusPermission;")
2231
custom { _, classDef ->
23-
classDef.endsWith("PublicUserProfileV7\$Companion;")
32+
classDef.type == "$routingPermissionClassName;"
2433
}
2534
}
2635

27-
internal val routingPermissionFingerprint = fingerprint {
36+
internal val routingPermissionInitJsonFingerprint = fingerprint {
2837
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
29-
parameters("L")
38+
parameters("Lorg/json/JSONObject;")
3039
custom { _, classDef ->
31-
classDef.endsWith("api/model/RoutingPermission;")
40+
classDef.type == "$routingPermissionClassName;"
3241
}
3342
}
Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,48 @@
11
package app.revanced.patches.komoot.premium
22

3-
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
3+
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
4+
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
45
import app.revanced.patcher.patch.bytecodePatch
6+
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
7+
import app.revanced.util.addInstructionsAtControlFlowLabel
8+
import app.revanced.util.indexOfFirstInstructionReversed
59
import com.android.tools.smali.dexlib2.Opcode
10+
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
611

712
@Suppress("unused")
813
val unlockProPatch = bytecodePatch(
914
name = "Unlock Premium features",
1015
description = "Unlock Premium features. Some features are not possible to patch (server sided), " +
1116
"such as saving a multi-days hike."
1217
) {
13-
compatibleWith("de.komoot.android"("2024.29.3"))
18+
compatibleWith("de.komoot.android"("2025.38.2"))
1419

1520
execute {
1621
premiumConfigFingerprint.method.apply {
17-
val index = implementation!!.instructions.indexOfLast{
18-
Opcode.MOVE_OBJECT_FROM16 == it.opcode
19-
}
20-
21-
addInstructions(
22-
index,
23-
"""
24-
sget-object v1, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean;
25-
iput-object v1, v0, Lde/komoot/android/services/api/model/AppConfigV3;->v:Ljava/lang/Boolean;
26-
"""
22+
addInstruction(
23+
0,
24+
"sget-object p22, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean;"
2725
)
2826
}
2927

30-
displayPremiumFingerprint.method.apply {
31-
val index = implementation!!.instructions.indexOfLast{
32-
Opcode.INVOKE_DIRECT_RANGE == it.opcode
33-
}
28+
publicUserInitFingerprint.method.addInstruction(
29+
0,
30+
"const/4 p5, 0x1"
31+
)
32+
33+
fun MutableMethod.grantRoutingPermission() {
34+
val index = indexOfFirstInstructionReversed(Opcode.IPUT_OBJECT)
3435

35-
addInstructions(
36+
val routingStatusRegister = getInstruction<TwoRegisterInstruction>(index).registerA
37+
38+
addInstructionsAtControlFlowLabel(
3639
index,
37-
"""
38-
const/4 v0, 0x1
39-
move v6, v0
40-
"""
40+
"sget-object v$routingStatusRegister, Lde/komoot/android/services/api/model/RoutingPermission\$StatusPermission;->GRANTED:Lde/komoot/android/services/api/model/RoutingPermission\$StatusPermission;",
4141
)
4242
}
4343

44-
routingPermissionFingerprint.method.apply {
45-
val index = implementation!!.instructions.indexOfLast{
46-
Opcode.MOVE_RESULT_OBJECT == it.opcode
47-
}
44+
routingPermissionInitJsonFingerprint.method.grantRoutingPermission()
4845

49-
addInstructions(
50-
index + 1,
51-
"sget-object p1, Lde/komoot/android/services/api/model/RoutingPermission\$StatusPermission;->GRANTED:Lde/komoot/android/services/api/model/RoutingPermission\$StatusPermission;",
52-
)
53-
}
46+
routingPermissionInitFingerprint.method.grantRoutingPermission()
5447
}
5548
}

0 commit comments

Comments
 (0)