Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Remove group toast tip #1113

Closed
wants to merge 10 commits into from
51 changes: 34 additions & 17 deletions app/src/main/java/cc/microblock/hook/TimRemoveToastTips.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,47 @@ import io.github.qauxv.hook.CommonSwitchFunctionHook
import io.github.qauxv.util.Initiator
import xyz.nextalone.util.get
import xyz.nextalone.util.set
import cc.ioctl.util.HostInfo
import io.github.qauxv.util.TIMVersion

@FunctionHookEntry
@UiItemAgentEntry
object TimRemoveToastTips : CommonSwitchFunctionHook() {
override val name = "移除群聊“修改/设置消息设置”提示"
override val description = "仅供 TIM 3.5.1 使用";
override val name = "移除群聊“修改/设置消息设置”提示";
override val description = "仅供 TIM 3.5.1 和 TIM 3.0.0(1082) 使用";

override val uiItemLocation = FunctionEntryRouter.Locations.Auxiliary.GROUP_CATEGORY
override val uiItemLocation = FunctionEntryRouter.Locations.Auxiliary.GROUP_CATEGORY;

override fun initOnce(): Boolean {
HookUtils.hookBeforeIfEnabled(
this, Reflex.findMethod(
Initiator.loadClass("com.tencent.mobileqq.activity.aio.rebuild.TroopChatPie\$8\$1"),
"run")
) {
it.result = null;
}
// 漏了一个“你可以在这里xxxxx”,实在吐了,这玩意不定时的
HookUtils.hookBeforeIfEnabled(
this, Reflex.findMethod(
Initiator.loadClass("com.tencent.mobileqq.activity.aio.rebuild.TroopChatPie\$38"),
"run")
) {
it.result = null;
// 功能基于 Issue #781 和 #667 移植实现
// get调用要写成其他样式(?)
val versionCodeLong = HostInfo.longVersionCode‎
if (versionCodeLong == TIMVersion.TIM_3_0_0_1) {
// 3.0.0 (1082)
HookUtils.hookBeforeIfEnabled(
this, Reflex.findMethod(
Initiator.loadClass("com.tencent.mobileqq.activity.aio.rebuild.TroopChatPie\$39\$1"),
"run")
) {
it.result = null;
};
} else {
// 3.5.1
HookUtils.hookBeforeIfEnabled(
this, Reflex.findMethod(
Initiator.loadClass("com.tencent.mobileqq.activity.aio.rebuild.TroopChatPie\$8\$1"),
"run")
) {
it.result = null;
};
// “你可以在这里xxxxx”
HookUtils.hookBeforeIfEnabled(
this, Reflex.findMethod(
Initiator.loadClass("com.tencent.mobileqq.activity.aio.rebuild.TroopChatPie\$38"),
"run")
) {
it.result = null;
};
}
return true;
}
Expand Down
58 changes: 0 additions & 58 deletions app/src/main/java/io/github/moonleeeaf/hook/FuckGroupToastTips.kt

This file was deleted.

Loading