Skip to content

Commit aa06215

Browse files
author
Aunali321
committed
feat(telegram): Add Pro patch
1 parent 1ebed8d commit aa06215

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

patches/api/patches.api

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ public final class li/auna/patches/telegram/ads/DisableAdsPatchKt {
247247
public static final fun getHideAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
248248
}
249249

250+
public final class li/auna/patches/telegram/pro/UnlockProKt {
251+
public static final fun getUnlockProPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
252+
}
253+
250254
public final class li/auna/patches/telegram/typingindicator/HideTypingIndicatorPatchKt {
251255
public static final fun getHideAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
252256
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package li.auna.patches.telegram.pro
2+
3+
import app.revanced.patcher.fingerprint
4+
5+
internal val isPremiumUserFingerprint = fingerprint {
6+
returns("Z")
7+
custom { methodDef, classDef ->
8+
classDef.type.endsWith("Lorg/telegram/messenger/MessagesController;") &&
9+
methodDef.name == "isPremiumUser"
10+
}
11+
}
12+
13+
internal val isPremiumFingerprint = fingerprint {
14+
returns("Z")
15+
custom { methodDef, classDef ->
16+
classDef.type.endsWith("Lorg/telegram/messenger/UserConfig;") &&
17+
methodDef.name == "isPremium"
18+
}
19+
}
20+
21+
internal val isPremiumForStoryFingerprint = fingerprint {
22+
returns("Z")
23+
custom { methodDef, classDef ->
24+
classDef.type.endsWith("Lorg/telegram/ui/Stories/StoriesController;") &&
25+
methodDef.name == "isPremium"
26+
}
27+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package li.auna.patches.telegram.pro
2+
3+
import app.revanced.patcher.patch.bytecodePatch
4+
import li.auna.util.returnEarly
5+
6+
@Suppress("unused")
7+
val unlockProPatch = bytecodePatch(
8+
name = "Unlock Pro",
9+
description = "Unlock client-side Pro features",
10+
) {
11+
compatibleWith(
12+
"org.telegram.messenger",
13+
"org.telegram.messenger.web"
14+
)
15+
16+
execute {
17+
setOf(
18+
isPremiumUserFingerprint,
19+
isPremiumFingerprint,
20+
isPremiumForStoryFingerprint
21+
).forEach { it.method.returnEarly(true) }
22+
}
23+
}

0 commit comments

Comments
 (0)