Skip to content

Commit

Permalink
Fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
whitechi73 committed Jan 31, 2024
1 parent bca1594 commit 5eb40d9
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions app/src/main/java/moe/qwq/miko/internals/helper/NTServiceFetcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,24 @@ internal object NTServiceFetcher {
QwQSetting.getSetting(QwQSetting.INTERCEPT_RECALL).isFailed = false

kernelService.wrapperSession.javaClass.hookMethod("onMsfPush").before {
val cmd = it.args[0] as String
val buffer = it.args[1] as ByteArray
if (cmd == "trpc.msg.register_proxy.RegisterProxy.InfoSyncPush") {
val syncPush = ProtoBuf.decodeFromByteArray<InfoSyncPush>(buffer)
if (AioListener.onInfoSyncPush(syncPush)) {
it.args[1] = ProtoBuf.encodeToByteArray(syncPush.copy(
syncContent = syncPush.syncContent?.copy(body = ArrayList(0))
))
}
} else if (cmd == "trpc.msg.olpush.OlPushService.MsgPush") {
val msgPush = ProtoBuf.decodeFromByteArray<MessagePush>(buffer)
if (AioListener.onMsgPush(msgPush)) {
it.result = Unit
runCatching {
val cmd = it.args[0] as String
val buffer = it.args[1] as ByteArray
if (cmd == "trpc.msg.register_proxy.RegisterProxy.InfoSyncPush") {
val syncPush = ProtoBuf.decodeFromByteArray<InfoSyncPush>(buffer)
if (AioListener.onInfoSyncPush(syncPush)) {
it.args[1] = ProtoBuf.encodeToByteArray(syncPush.copy(
syncContent = syncPush.syncContent?.copy(body = ArrayList(0))
))
}
} else if (cmd == "trpc.msg.olpush.OlPushService.MsgPush") {
val msgPush = ProtoBuf.decodeFromByteArray<MessagePush>(buffer)
if (AioListener.onMsgPush(msgPush)) {
it.result = Unit
}
}
}.onFailure {
XposedBridge.log(it)
}
}

Expand Down

0 comments on commit 5eb40d9

Please sign in to comment.