Skip to content

Commit

Permalink
feat: better way to disable instant camera
Browse files Browse the repository at this point in the history
  • Loading branch information
huajijam committed Dec 13, 2023
1 parent d21fe52 commit 3210489
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions app/src/main/java/cc/ioctl/tmoe/hook/func/DisableInstantCamera.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,10 @@ import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.github.kyuubiran.ezxhelper.utils.loadClass
import com.github.kyuubiran.ezxhelper.utils.tryOrLogFalse
import de.robv.android.xposed.XposedBridge
import java.lang.Enum as JEnum

@FunctionHookEntry
object DisableInstantCamera : CommonDynamicHook() {
override fun initOnce(): Boolean = tryOrLogFalse {
findMethod(loadClass("org.telegram.ui.Components.ChatActivityEnterViewAnimatedIconView")) {
name == "setState" && parameterTypes.size == 2
}.hookBefore {

if (!isEnabled) return@hookBefore

try {
val state = it.args[0] as JEnum<*>
if (state.name() == "VIDEO") {
it.args[0] = JEnum.valueOf(state.javaClass as Class<out Enum<*>>, "VOICE")
}
} catch (e: Throwable) {
XposedBridge.log(e)
}
}

findMethod(loadClass("org.telegram.ui.Components.ChatActivityEnterView")) { name == "isInVideoMode" }.hookBefore {
if (isEnabled) it.result = false
}
Expand Down

0 comments on commit 3210489

Please sign in to comment.