From bbd8932b2e740aff96ba047332e541bff3e09436 Mon Sep 17 00:00:00 2001 From: Sylvain Finot <25269226+SF73@users.noreply.github.com> Date: Mon, 8 Dec 2025 12:30:47 +0100 Subject: [PATCH] feat(ProtonVPN): Add `Remove delay` patch (#6326) Co-authored-by: oSumAtrIX --- patches/api/patches.api | 4 ++++ .../patches/protonvpn/delay/Fingerprints.kt | 16 ++++++++++++++++ .../patches/protonvpn/delay/RemoveDelayPatch.kt | 17 +++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/Fingerprints.kt create mode 100644 patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/RemoveDelayPatch.kt diff --git a/patches/api/patches.api b/patches/api/patches.api index dc493ca0b..4c2586c82 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -621,6 +621,10 @@ public final class app/revanced/patches/protonmail/signature/RemoveSentFromSigna public static final fun getRemoveSentFromSignaturePatch ()Lapp/revanced/patcher/patch/ResourcePatch; } +public final class app/revanced/patches/protonvpn/delay/RemoveDelayPatchKt { + public static final fun getRemoveDelayPatch ()Lapp/revanced/patcher/patch/BytecodePatch; +} + public final class app/revanced/patches/rar/misc/annoyances/purchasereminder/HidePurchaseReminderPatchKt { public static final fun getHidePurchaseReminderPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } diff --git a/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/Fingerprints.kt new file mode 100644 index 000000000..bc8ad3925 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/Fingerprints.kt @@ -0,0 +1,16 @@ +package app.revanced.patches.protonvpn.delay + +import app.revanced.patcher.fingerprint + + +internal val longDelayFingerprint = fingerprint { + custom { method, _ -> + method.name == "getChangeServerLongDelayInSeconds" + } +} + +internal val shortDelayFingerprint = fingerprint { + custom { method, _ -> + method.name == "getChangeServerShortDelayInSeconds" + } +} \ No newline at end of file diff --git a/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/RemoveDelayPatch.kt b/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/RemoveDelayPatch.kt new file mode 100644 index 000000000..512813e59 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/RemoveDelayPatch.kt @@ -0,0 +1,17 @@ +package app.revanced.patches.protonvpn.delay + +import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.returnEarly + +@Suppress("unused") +val removeDelayPatch = bytecodePatch( + name = "Remove delay", + description = "Removes the delay when changing servers.", +) { + compatibleWith("ch.protonvpn.android") + + execute { + longDelayFingerprint.method.returnEarly(0) + shortDelayFingerprint.method.returnEarly(0) + } +} \ No newline at end of file