Skip to content

Commit

Permalink
Update LockPremiumFeatures.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Keeperorowner authored Nov 10, 2024
1 parent 95c693c commit 0e1563e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/src/main/java/cc/ioctl/tmoe/hook/func/LockPremiumFeatures.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import de.robv.android.xposed.XposedHelpers
class LockPremiumFeatures : CommonDynamicHook() {

companion object : BaseDynamicHook {
@JvmStatic
fun getInstance(): LockPremiumFeatures = INSTANCE

private val INSTANCE = LockPremiumFeatures()

@JvmStatic
override fun getInstance(): BaseDynamicHook = INSTANCE

@JvmStatic
override fun initialize(): Boolean {
return INSTANCE.initOnce()
}
}

override fun initOnce(): Boolean {
Expand All @@ -41,12 +43,14 @@ class LockPremiumFeatures : CommonDynamicHook() {
private fun hookPremiumFeatures() {
try {
val messagesControllerClass = Initiator.load("org.telegram.messenger.MessagesController")
// Hook constructor
XposedHelpers.findAndHookConstructor(messagesControllerClass, object : XC_MethodHook() {
@Throws(Throwable::class)
override fun afterHookedMethod(param: MethodHookParam) {
XposedHelpers.setBooleanField(param.thisObject, "premiumLocked", true)
}
})
// Hook applyAppConfig method
XposedHelpers.findAndHookMethod(messagesControllerClass,
"applyAppConfig",
object : XC_MethodHook() {
Expand Down

0 comments on commit 0e1563e

Please sign in to comment.