From 6a4c03220e8c33e6728fd1e7aaf15f5f21e7a5bc Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Mon, 12 Jan 2026 00:08:18 +0700 Subject: [PATCH] refactor(protonvpn): RemoveDelayPatch --- .../patches/protonvpn/delay/Fingerprints.kt | 19 ++++++++----------- .../protonvpn/delay/RemoveDelayPatch.kt | 15 +++++++-------- 2 files changed, 15 insertions(+), 19 deletions(-) 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 index bc8ad3925..3ca1535d3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/Fingerprints.kt @@ -1,16 +1,13 @@ package app.revanced.patches.protonvpn.delay -import app.revanced.patcher.fingerprint +import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively +import app.revanced.patcher.name +import app.revanced.patcher.patch.BytecodePatchContext - -internal val longDelayFingerprint = fingerprint { - custom { method, _ -> - method.name == "getChangeServerLongDelayInSeconds" - } +internal val BytecodePatchContext.longDelayMethod by gettingFirstMutableMethodDeclaratively { + name("getChangeServerLongDelayInSeconds") } -internal val shortDelayFingerprint = fingerprint { - custom { method, _ -> - method.name == "getChangeServerShortDelayInSeconds" - } -} \ No newline at end of file +internal val BytecodePatchContext.shortDelayMethod by gettingFirstMutableMethodDeclaratively { + name("getChangeServerShortDelayInSeconds") +} 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 index 01794b88f..ceb771886 100644 --- a/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/RemoveDelayPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/RemoveDelayPatch.kt @@ -1,17 +1,16 @@ package app.revanced.patches.protonvpn.delay -import app.revanced.patcher.patch.bytecodePatch +import app.revanced.patcher.patch.creatingBytecodePatch import app.revanced.util.returnEarly -@Suppress("unused") -val removeDelayPatch = bytecodePatch( - name = "Remove delay", - description = "Removes the delay when changing servers.", +@Suppress("unused", "ObjectPropertyName") +val `Remove delay` by creatingBytecodePatch( + description = "Removes the delay when changing servers." ) { compatibleWith("ch.protonvpn.android") apply { - longDelayFingerprint.method.returnEarly(0) - shortDelayFingerprint.method.returnEarly(0) + longDelayMethod.returnEarly(0) + shortDelayMethod.returnEarly(0) } -} \ No newline at end of file +}