Skip to content

Commit

Permalink
fix: RepeaterPlus on TIM_NT
Browse files Browse the repository at this point in the history
Closes #1258
  • Loading branch information
HdShare committed Dec 5, 2024
1 parent 224cfe1 commit 3ee39fc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
17 changes: 9 additions & 8 deletions app/src/main/java/cc/hicore/hook/RepeaterPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@


import static cc.ioctl.util.HostInfo.requireMinQQVersion;
import static cc.ioctl.util.HostInfo.requireMinTimVersion;
import static cc.ioctl.util.Reflex.getFirstNSFByType;
import static io.github.qauxv.util.Initiator._SessionInfo;
import static io.github.qauxv.util.Initiator.load;
Expand All @@ -45,17 +46,13 @@
import cc.hicore.message.chat.SessionHooker;
import cc.hicore.message.chat.SessionUtils;
import cc.ioctl.util.HookUtils;
import cc.ioctl.util.HostInfo;
import cc.ioctl.util.Reflex;
import com.tencent.qqnt.kernel.nativeinterface.MsgAttributeInfo;
import com.tencent.qqnt.kernel.nativeinterface.MsgRecord;
import com.xiaoniu.dispatcher.OnMenuBuilder;
import com.xiaoniu.util.ContextUtils;
import io.github.qauxv.base.IEntityAgent;
import io.github.qauxv.util.xpcompat.XC_MethodHook;
import io.github.qauxv.util.xpcompat.XposedBridge;
import io.github.qauxv.util.xpcompat.XposedHelpers;
import io.github.qauxv.R;
import io.github.qauxv.base.IEntityAgent;
import io.github.qauxv.base.ISwitchCellAgent;
import io.github.qauxv.base.IUiItemAgent;
import io.github.qauxv.base.annotation.FunctionHookEntry;
Expand All @@ -71,11 +68,15 @@
import io.github.qauxv.util.Initiator;
import io.github.qauxv.util.Log;
import io.github.qauxv.util.QQVersion;
import io.github.qauxv.util.TIMVersion;
import io.github.qauxv.util.Toasts;
import io.github.qauxv.util.dexkit.AbstractQQCustomMenuItem;
import io.github.qauxv.util.dexkit.DexKit;
import io.github.qauxv.util.dexkit.DexKitTarget;
import io.github.qauxv.util.dexkit.VasAttrBuilder;
import io.github.qauxv.util.xpcompat.XC_MethodHook;
import io.github.qauxv.util.xpcompat.XposedBridge;
import io.github.qauxv.util.xpcompat.XposedHelpers;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -178,7 +179,7 @@ public String[] getUiItemLocation() {
@Override
@SuppressLint({"WrongConstant", "ResourceType"})
public boolean initOnce() throws Exception {
if (requireMinQQVersion(QQVersion.QQ_8_9_63_BETA_11345)) {
if (requireMinQQVersion(QQVersion.QQ_8_9_63_BETA_11345) || requireMinTimVersion(TIMVersion.TIM_4_0_95)) {
if (!RepeaterPlusIconSettingDialog.getIsShowInMenu()) {
XC_MethodHook callback = new XC_MethodHook() {
private ImageView img;
Expand Down Expand Up @@ -316,7 +317,7 @@ protected void afterHookedMethod(MethodHookParam param) {

@Override
public boolean isAvailable() {
return requireMinQQVersion(QQVersion.QQ_8_6_0);
return requireMinQQVersion(QQVersion.QQ_8_6_0) || requireMinTimVersion(TIMVersion.TIM_4_0_95);
}

private static Object AIOParam;
Expand Down Expand Up @@ -357,7 +358,7 @@ private void repeatByForwardNt(Object msg) {
});
} else {
long msgUniqueId;
if (requireMinQQVersion(QQVersion.QQ_9_0_30)) {
if (requireMinQQVersion(QQVersion.QQ_9_0_30) || requireMinTimVersion(TIMVersion.TIM_4_0_95)) {
msgUniqueId = service.generateMsgUniqueId(contact.getChatType(), QAppUtils.getServiceTime());
} else {
msgUniqueId = service.getMsgUniqueId(QAppUtils.getServiceTime());
Expand Down
20 changes: 10 additions & 10 deletions app/src/main/java/cc/hicore/message/chat/SessionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@

package cc.hicore.message.chat;

import android.text.TextUtils;
import cc.hicore.QApp.QAppUtils;
import cc.hicore.ReflectUtil.MField;
import static cc.ioctl.util.HostInfo.requireMinTimVersion;

import cc.hicore.ReflectUtil.XField;
import cc.hicore.Utils.XLog;
import io.github.qauxv.bridge.kernelcompat.ContactCompat;
import io.github.qauxv.bridge.SessionInfoImpl;
import io.github.qauxv.util.Initiator;
import io.github.qauxv.util.TIMVersion;
import java.io.Serializable;
import java.lang.reflect.Field;

public class SessionUtils {

Expand Down Expand Up @@ -59,12 +57,14 @@ public static Serializable AIOParam2ContactRaw(Object AIOParam) {
}

public static String getCurrentPeerIDByAIOContact(Object AIOContact) throws Exception {
return XField.obj(AIOContact).name("f").type(String.class).get();
return XField.obj(AIOContact).name(requireMinTimVersion(TIMVersion.TIM_4_0_95) ? "e" : "f").type(String.class).get();
}
public static int getCurrentChatTypeByAIOContact(Object AIOContact) throws Exception{
return XField.obj(AIOContact).name("e").type(int.class).get();

public static int getCurrentChatTypeByAIOContact(Object AIOContact) throws Exception {
return XField.obj(AIOContact).name(requireMinTimVersion(TIMVersion.TIM_4_0_95) ? "d" : "e").type(int.class).get();
}
public static String getCurrentGuildIDByAIOContact(Object AIOContact) throws Exception{
return XField.obj(AIOContact).name("g").type(String.class).get();

public static String getCurrentGuildIDByAIOContact(Object AIOContact) throws Exception {
return XField.obj(AIOContact).name(requireMinTimVersion(TIMVersion.TIM_4_0_95) ? "f" : "g").type(String.class).get();
}
}

0 comments on commit 3ee39fc

Please sign in to comment.