| 6 | import cc.ioctl.tmoe.util.Reflex; |
| 7 | |
| 8 | @FunctionHookEntry |
| 9 | public 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected