Skip to content

Commit

Permalink
fix: FileShareExtHook on QQ 9.0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Jan 31, 2024
1 parent e4a360d commit be568d3
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions app/src/main/java/cc/ioctl/hook/msg/FileShareExtHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package cc.ioctl.hook.msg;

import static io.github.qauxv.util.HostInfo.requireMinQQVersion;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
Expand All @@ -47,6 +49,7 @@
import io.github.qauxv.ui.ResUtils;
import io.github.qauxv.util.Initiator;
import io.github.qauxv.util.Log;
import io.github.qauxv.util.QQVersion;
import io.github.qauxv.util.SyncUtils;
import io.github.qauxv.util.Toasts;
import io.github.qauxv.util.dexkit.DefaultFileModel;
Expand Down Expand Up @@ -108,11 +111,15 @@ protected boolean initOnce() throws Exception {
// args
Class<?> kFileBrowserModelBase = Initiator.loadClass("com.tencent.mobileqq.filemanager.fileviewer.model.FileBrowserModelBase");
Class<?> kDefaultFileModel = DexKit.requireClassFromCache(DefaultFileModel.INSTANCE);
Class<?> kIFileViewerAdapter = Initiator.loadClassEither(
"com.tencent.mobileqq.filemanager.fileviewer.IFileViewerAdapter",
// QQ 8.9.0(3060)
"com.tencent.mobileqq.filemanager.fileviewer.h"
);
String fileViewerAdapterClassName;
if (requireMinQQVersion(QQVersion.QQ_9_0_15)) {
fileViewerAdapterClassName = "com.tencent.mobileqq.filemanager.fileviewer.g";
} else if (requireMinQQVersion(QQVersion.QQ_8_9_0)) {
fileViewerAdapterClassName = "com.tencent.mobileqq.filemanager.fileviewer.h";
} else {
fileViewerAdapterClassName = "com.tencent.mobileqq.filemanager.fileviewer.IFileViewerAdapter";
}
Class<?> kIFileViewerAdapter = Initiator.loadClass(fileViewerAdapterClassName);
kFileBrowserManager = Initiator.loadClassEither(
"com.tencent.mobileqq.filemanager.fileviewer.FileBrowserManager",
// QQ 8.9.0(3060)
Expand All @@ -127,11 +134,15 @@ protected boolean initOnce() throws Exception {
List<Method> getShareSheetItemLists2List = ArraysKt.filter(kDefaultFileModel.getDeclaredMethods(), it -> {
return it.getParameterTypes().length == 0 && it.getReturnType() == ArrayList[].class;
});
Method onItemClick = Initiator.loadClassEither(
"com.tencent.mobileqq.filemanager.fileviewer.FileBrowserManager$2",
// QQ 8.9.0(3060)
"com.tencent.mobileqq.filemanager.fileviewer.a$b"
).getDeclaredMethod("onItemClick", kActionSheetItem, kiShareActionSheet);
String fileBrowserManagerItemClassName;
if (requireMinQQVersion(QQVersion.QQ_9_0_15)) {
fileBrowserManagerItemClassName = "com.tencent.mobileqq.filemanager.fileviewer.FileBrowserManager$c";
} else if (requireMinQQVersion(QQVersion.QQ_8_9_0)) {
fileBrowserManagerItemClassName = "com.tencent.mobileqq.filemanager.fileviewer.a$b";
} else {
fileBrowserManagerItemClassName = "com.tencent.mobileqq.filemanager.fileviewer.FileBrowserManager$2";
}
Method onItemClick = Initiator.loadClass(fileBrowserManagerItemClassName).getDeclaredMethod("onItemClick", kActionSheetItem, kiShareActionSheet);
XposedBridge.hookMethod(onItemClick, mItemClickHandler);
Method mFileBrowserActivity_InnerClass_onItemClick = DexKit.loadMethodFromCache(FileBrowserActivity_InnerClass_onItemClick.INSTANCE);
if (mFileBrowserActivity_InnerClass_onItemClick != null) {
Expand Down

0 comments on commit be568d3

Please sign in to comment.