MCPcopy Create free account
hub / github.com/cinit/TMoe / EnableDebugMode

Class EnableDebugMode

app/src/main/java/cc/ioctl/tmoe/hook/func/EnableDebugMode.java:8–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import cc.ioctl.tmoe.util.Reflex;
7
8@FunctionHookEntry
9public class EnableDebugMode extends CommonDynamicHook {
10 public static final EnableDebugMode INSTANCE = new EnableDebugMode();
11
12 private EnableDebugMode() {
13 }
14
15 @Override
16 public boolean initOnce() throws Exception {
17 if (isEnabledByUser()) {
18 updateValue(true);
19 }
20 return true;
21 }
22
23 @Override
24 public void setEnabledByUser(boolean enabled) {
25 super.setEnabledByUser(enabled);
26 try {
27 updateValue(enabled);
28 } catch (NoSuchFieldException e) {
29 loge(e);
30 }
31 }
32
33 private void updateValue(boolean value) throws NoSuchFieldException {
34 Reflex.setStaticObject(Initiator.load("org.telegram.messenger.BuildVars"), "DEBUG_VERSION", value);
35 Reflex.setStaticObjectSilently(Initiator.load("org.telegram.messenger.BuildVars"), "DEBUG_PRIVATE_VERSION", value);
36 }
37}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected