Skip to content

Commit

Permalink
fix: repeat msg bubble
Browse files Browse the repository at this point in the history
  • Loading branch information
Hicores committed Nov 20, 2023
1 parent 700c0e3 commit ffb0bd5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
27 changes: 16 additions & 11 deletions app/src/main/java/cc/hicore/hook/RepeaterPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@
import io.github.qauxv.util.QQVersion;
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 java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -85,6 +87,7 @@
import kotlin.jvm.functions.Function2;
import kotlin.jvm.functions.Function3;
import kotlinx.coroutines.flow.MutableStateFlow;
import org.luckypray.dexkit.DexKitBridge;

@FunctionHookEntry
@UiItemAgentEntry
Expand All @@ -93,7 +96,7 @@ public class RepeaterPlus extends BaseFunctionHook implements SessionHooker.IAIO
public static final RepeaterPlus INSTANCE = new RepeaterPlus();

private RepeaterPlus() {
super(null, false, new DexKitTarget[]{AbstractQQCustomMenuItem.INSTANCE});
super(null, false, new DexKitTarget[]{AbstractQQCustomMenuItem.INSTANCE, VasAttrBuilder.INSTANCE});
}

private IUiItemAgent mUiAgent = null;
Expand Down Expand Up @@ -392,18 +395,20 @@ private void repeatByForwardNt(Object msg) {

IKernelMsgService service = MsgServiceHelper.getKernelMsgService(AppRuntimeHelper.getAppRuntime());
HashMap<Integer, MsgAttributeInfo> attrMap = new HashMap<>();
MsgAttributeInfo info = Nt_kernel_bridge.getDefaultAttributeInfo();
if (info != null) {
attrMap.put(0, info);
service.getMsgsByMsgId(contact, l, (i, str, list) ->{
if (list.size() > 0 && list.get(0).getElements().get(0).getPttElement() != null){
service.sendMsg(service.getMsgUniqueId(QAppUtils.getServiceTime()),contact,list.get(0).getElements(),attrMap,(i1, str1) -> { });
}else {
service.forwardMsg(l, contact, c, attrMap, (i2, str2, hashMap) -> { });
}
});
Method builder = DexKit.loadMethodFromCache(VasAttrBuilder.INSTANCE);
if (builder != null){
Object builderInstance = builder.getDeclaringClass().newInstance();
builder.invoke(builderInstance,attrMap,contact,4);
}

service.getMsgsByMsgId(contact, l, (i, str, list) ->{
if (list.size() > 0 && list.get(0).getElements().get(0).getPttElement() != null){
service.sendMsg(service.getMsgUniqueId(QAppUtils.getServiceTime()),contact,list.get(0).getElements(),attrMap,(i1, str1) -> { });
}else {
service.forwardMsg(l, contact, c, attrMap, (i2, str2, hashMap) -> { });
}
});


} catch (Exception e) {
Log.e(e);
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@ data object AbstractQQCustomMenuItem : DexKitTarget.UsingStr() {
override val filter = DexKitFilter.strInClsName("com/tencent/qqnt/aio/menu/ui")
}

data object VasAttrBuilder : DexKitTarget.UsingStr() {
override val findMethod: Boolean = true
override val declaringClass = "com.tencent.mobileqq.vas.p"
override val traitString = arrayOf("attrs")
override val filter = DexKitFilter.strInClsName("com/tencent/mobileqq/vas")
}

data object Guild_Emo_Btn_Create_QQNT : DexKitTarget.UsingStr() {
override val findMethod: Boolean = true
override val traitString = arrayOf("mEmojiLayout.findViewByI…id.guild_aio_emoji_image)")
Expand Down

0 comments on commit ffb0bd5

Please sign in to comment.