Skip to content

Commit

Permalink
refactor: getKernelMsgService and SimplifyPlusPanel
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Aug 26, 2023
1 parent 971ec5e commit c468b46
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,15 @@ public static Object getMsgService(@NonNull AppRuntime app) throws ReflectiveOpe
@Nullable
public static IKernelMsgService getKernelMsgService(@NonNull AppRuntime app) throws ReflectiveOperationException, LinkageError {
Object msgService = getMsgService(app);
Method getKMsgSvc = Reflex.findSingleMethod(msgService.getClass(), IKernelMsgService.class, false);
return (IKernelMsgService) getKMsgSvc.invoke(msgService);
IKernelMsgService service;
try {
// 8.9.78起
service = (IKernelMsgService) msgService.getClass().getMethod("getService").invoke(msgService);
} catch (Exception unused) {
Method getKMsgSvc = Reflex.findSingleMethod(msgService.getClass(), IKernelMsgService.class, false);
service = (IKernelMsgService) getKMsgSvc.invoke(msgService);
}
return service;
}

}
11 changes: 7 additions & 4 deletions app/src/main/java/xyz/nextalone/hook/SimplifyPlusPanel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package xyz.nextalone.hook

import cc.hicore.QApp.QAppUtils
import com.github.kyuubiran.ezxhelper.utils.paramCount
import de.robv.android.xposed.XC_MethodHook
import io.github.qauxv.base.annotation.FunctionHookEntry
import io.github.qauxv.base.annotation.UiItemAgentEntry
Expand All @@ -31,6 +32,7 @@ import io.github.qauxv.util.QQVersion
import io.github.qauxv.util.hostInfo
import io.github.qauxv.util.requireMinQQVersion
import xyz.nextalone.base.MultiItemDelayableHook
import xyz.nextalone.util.clazz
import xyz.nextalone.util.hookBefore
import xyz.nextalone.util.method
import xyz.nextalone.util.throwOrTrue
Expand Down Expand Up @@ -130,10 +132,11 @@ object SimplifyPlusPanel : MultiItemDelayableHook("na_simplify_plus_panel_multi"
} else {
// assert QQ.version <= QQVersion.QQ_8_4_8
if (QAppUtils.isQQnt()) {
"Lcom/tencent/qqnt/pluspanel/adapter/PanelAdapter;->p(Ljava/util/ArrayList;)V".method.hookBefore(
this,
callback
)
"Lcom/tencent/qqnt/pluspanel/adapter/PanelAdapter;".clazz!!.declaredMethods.single { it.paramCount == 1 && it.parameterTypes[0] == ArrayList::class.java }
.hookBefore(
this,
callback
)
} else if (hostInfo.versionCode >= QQVersion.QQ_8_4_8) {
"Lcom/tencent/mobileqq/activity/aio/PlusPanel;->a(Ljava/util/ArrayList;)V".method.hookBefore(
this,
Expand Down

0 comments on commit c468b46

Please sign in to comment.