Skip to content

Commit

Permalink
fix: PluginDelayableHook for TIM 3.5.2 and reduce logs
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Jul 27, 2023
1 parent fd171b1 commit b2cfb8b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import io.github.qauxv.dsl.FunctionEntryRouter
import io.github.qauxv.hook.CommonSwitchFunctionHook
import io.github.qauxv.util.Initiator
import io.github.qauxv.util.SyncUtils
import io.github.qauxv.util.isTim
import xyz.nextalone.util.isPublic
import xyz.nextalone.util.isStatic

Expand All @@ -40,6 +41,7 @@ object DisableQQCrashReportManager : CommonSwitchFunctionHook(targetProc = SyncU
override val description = "仅限调试,无实际用途"
override val uiItemLocation = FunctionEntryRouter.Locations.DebugCategory.DEBUG_CATEGORY
override val isApplicationRestartRequired = true
override val isAvailable = !isTim()

override fun initOnce(): Boolean {
val kQQCrashReportManager = Initiator.loadClass("com.tencent.qqperf.monitor.crash.QQCrashReportManager")
Expand Down
13 changes: 8 additions & 5 deletions app/src/main/java/me/ketal/base/PluginDelayableHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ import io.github.qauxv.base.ISwitchCellAgent
import io.github.qauxv.base.IUiItemAgent
import io.github.qauxv.config.ConfigManager
import io.github.qauxv.hook.BaseFunctionHook
import io.github.qauxv.util.Initiator
import io.github.qauxv.util.Log
import io.github.qauxv.util.hostInfo
import kotlinx.coroutines.flow.MutableStateFlow
import xyz.nextalone.util.clazz
import xyz.nextalone.util.method
import xyz.nextalone.util.throwOrTrue
import java.lang.reflect.InvocationTargetException

abstract class PluginDelayableHook(keyName: String) : BaseFunctionHook(keyName) {
abstract class PluginDelayableHook(keyName: String) : BaseFunctionHook(hookKey = keyName) {

abstract val pluginID: String
abstract val preference: IUiItemAgent
Expand Down Expand Up @@ -68,13 +68,16 @@ abstract class PluginDelayableHook(keyName: String) : BaseFunctionHook(keyName)
"Lcom/tencent/mobileqq/pluginsdk/IPluginAdapterProxy;->setProxy(Lcom/tencent/mobileqq/pluginsdk/IPluginAdapter;)V".method.apply {
isAccessible = true
}.invoke(
null, listOf(
null,
listOf(
"Lcooperation/plugin/c;", //8.9.70
"Lcooperation/plugin/PluginAdapterImpl;", //8.8.50
"Lbghq;", //8.2.11 Play
"Lbfdk;" //8.2.6
).firstNotNullOf { it.clazz }.newInstance()
"Lbfdk;", //8.2.6
"Lavel;", //TIM 3.5.2
).firstNotNullOf { Initiator.load(it) }.newInstance()
// implements Lcom/tencent/mobileqq/pluginsdk/IPluginAdapter;
// DexKit.requireClassFromCache(CPluginAdapterImpl).newInstance()
)
Log.i("setProxy success")
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/xyz/nextalone/hook/HideTroopLevel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import io.github.qauxv.bridge.ntapi.ChatTypeConstants
import io.github.qauxv.dsl.FunctionEntryRouter
import io.github.qauxv.hook.CommonSwitchFunctionHook
import io.github.qauxv.util.Initiator._TroopMemberLevelView
import io.github.qauxv.util.isTim
import me.ketal.dispacher.BaseBubbleBuilderHook
import me.ketal.dispacher.OnBubbleBuilder
import me.ketal.util.findViewByType
Expand All @@ -49,7 +50,7 @@ object HideTroopLevel : CommonSwitchFunctionHook(), OnBubbleBuilder {
private val levelClass
get() = _TroopMemberLevelView()

override val isAvailable = levelClass != null
override val isAvailable = !isTim() && levelClass != null

override fun initOnce(): Boolean {
return isAvailable && BaseBubbleBuilderHook.initialize()
Expand Down

0 comments on commit b2cfb8b

Please sign in to comment.