Skip to content

Commit

Permalink
feat(Komoot): Added patch for Komoot navigation and maps download
Browse files Browse the repository at this point in the history
  • Loading branch information
Brosssh committed Nov 20, 2024
1 parent c771744 commit dbdcda1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions patches/api/patches.api
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ public final class app/revanced/patches/hevy/subscription/UnlockSubscriptionPatc
public static final fun getUnlockSubscriptionPatch ()Lapp/revanced/patcher/patch/RawResourcePatch;
}

public final class app/revanced/patches/komoot/navigation/UnlockNavigationPatchKt {
public static final fun getUnlockProPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}

public final class app/revanced/patches/shared/misc/hex/HexPatchKt {
public static final fun hexPatch (Lkotlin/jvm/functions/Function0;)Lapp/revanced/patcher/patch/ResourcePatch;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package app.revanced.patches.komoot.navigation

import app.revanced.patcher.fingerprint
import com.android.tools.smali.dexlib2.AccessFlags

internal val routingPermissionFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
parameters("L")
custom { _, classDef ->
classDef.endsWith("api/model/RoutingPermission;")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package app.revanced.patches.komoot.navigation

import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch
import com.android.tools.smali.dexlib2.Opcode

@Suppress("unused")
val unlockProPatch = bytecodePatch(
name = "Unlock the routing and the maps download",
) {
compatibleWith("de.komoot.android"("2024.29.3"))

execute {
routingPermissionFingerprint.method.apply {
val index = implementation!!.instructions.indexOfLast{
Opcode.MOVE_RESULT_OBJECT == it.opcode
}

addInstructions(
index + 1,
"sget-object p1, Lde/komoot/android/services/api/model/RoutingPermission\$StatusPermission;->GRANTED:Lde/komoot/android/services/api/model/RoutingPermission\$StatusPermission;",
)
}
}
}

0 comments on commit dbdcda1

Please sign in to comment.