Skip to content

Commit

Permalink
fix: PttForwardHook for multiuser and optimize dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Jul 19, 2023
1 parent e9477f7 commit 98afb98
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions app/src/main/java/cc/ioctl/hook/msg/PttForwardHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ private PttForwardHook() {
super(SyncUtils.PROC_MAIN, new DexKitTarget[]{CFaceDe.INSTANCE, CDialogUtil.INSTANCE, AbstractQQCustomMenuItem.INSTANCE});
}

@SuppressLint("SetTextI18n")
private static void showSavePttFileDialog(Activity activity, final File ptt) {
Context ctx = CommonContextWrapper.createAppCompatContext(activity);
final EditText editText = new EditText(ctx);
Expand Down Expand Up @@ -352,15 +353,15 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
heads.setPadding(pd / 2, pd / 2, pd / 2, pd / 2);
TextView ni = new TextView(ctx);
ni.setText(cd.nick);
ni.setTextColor(0xFF000000);
ni.setTextColor(HostStyledViewBuilder.getColorSkinBlack());
ni.setPadding(pd, 0, 0, 0);
ni.setTextSize(dip2sp(ctx, 18));
ni.setTextSize(dip2sp(ctx, 17));
heads.addView(imgview, imglp);
heads.addView(ni);
}
CustomDialog dialog = CustomDialog.create(ctx);
final Activity finalCtx = ctx;
dialog.setPositiveButton("确认", (dialog1, which) -> {
dialog.setPositiveButton("发送", (dialog1, which) -> {
try {
for (ContactDescriptor cd : mTargets) {
Parcelable sesssion = SessionInfoImpl.createSessionInfo(cd.uin, cd.uinType);
Expand All @@ -378,7 +379,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
finalCtx.finish();
});
dialog.setNegativeButton("取消", null);
dialog.setCancelable(true);
dialog.setCancelable(false);
dialog.setView(main);
dialog.setTitle("发送给");
dialog.show();
Expand Down Expand Up @@ -500,11 +501,9 @@ private File getPttFileByMsgNt(Object msg) {
}
PttElement element = (PttElement) getElement.invoke(msg);
String filename = element.getFileName();
String filePath =
"/storage/emulated/0/Android/data/com.tencent.mobileqq/Tencent/MobileQQ/" + AppRuntimeHelper.getAccount() + "/ptt/" + filename;
// 严谨性有待考证
File file = new File(filePath);
return file;
String filePath = cc.ioctl.util.HostInfo.getApplication().getExternalFilesDir(null).getParent() +
"/Tencent/MobileQQ/" + AppRuntimeHelper.getAccount() + "/ptt/" + filename;
return new File(filePath);
} catch (Throwable e) {
traceError(e);
return new File("");
Expand Down

0 comments on commit 98afb98

Please sign in to comment.