From c2f28274ee178e15dd06fdb7694732eeba4e0196 Mon Sep 17 00:00:00 2001 From: hd <1839732296@qq.com> Date: Thu, 15 Aug 2024 23:13:39 +0800 Subject: [PATCH] feat: OutFileHbDetail --- .../main/java/me/hd/hook/OutFileHbDetail.kt | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 app/src/main/java/me/hd/hook/OutFileHbDetail.kt diff --git a/app/src/main/java/me/hd/hook/OutFileHbDetail.kt b/app/src/main/java/me/hd/hook/OutFileHbDetail.kt new file mode 100644 index 0000000000..c5c7d3b138 --- /dev/null +++ b/app/src/main/java/me/hd/hook/OutFileHbDetail.kt @@ -0,0 +1,67 @@ +/* + * QAuxiliary - An Xposed module for QQ/TIM + * Copyright (C) 2019-2024 QAuxiliary developers + * https://github.com/cinit/QAuxiliary + * + * This software is an opensource software: you can redistribute it + * and/or modify it under the terms of the General Public License + * as published by the Free Software Foundation; either + * version 3 of the License, or any later version as published + * by QAuxiliary contributors. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the General Public License for more details. + * + * You should have received a copy of the General Public License + * along with this software. + * If not, see + * . + */ + +package me.hd.hook + +import android.widget.TextView +import com.github.kyuubiran.ezxhelper.utils.hookAfter +import com.xiaoniu.util.ContextUtils +import io.github.qauxv.base.annotation.FunctionHookEntry +import io.github.qauxv.base.annotation.UiItemAgentEntry +import io.github.qauxv.dsl.FunctionEntryRouter +import io.github.qauxv.hook.CommonSwitchFunctionHook +import io.github.qauxv.util.QQVersion +import io.github.qauxv.util.Toasts +import io.github.qauxv.util.requireMinQQVersion +import xyz.nextalone.util.get +import xyz.nextalone.util.invoke +import xyz.nextalone.util.method +import java.io.File + +@FunctionHookEntry +@UiItemAgentEntry +object OutFileHbDetail : CommonSwitchFunctionHook() { + + override val name = "输出红包领取列表详情" + override val description = "根据领取金额倒序排列, 输出详情到 /cache/hd_temp/output.txt" + override val uiItemLocation = FunctionEntryRouter.Locations.Auxiliary.EXPERIMENTAL_CATEGORY + override val isAvailable = requireMinQQVersion(QQVersion.QQ_8_9_88) + + override fun initOnce(): Boolean { + "Lcom/tenpay/sdk/activity/HbDetailActivity;->initToolBar(Landroid/view/View;)V".method.hookAfter { param -> + val toolbarTitle = param.thisObject.get("toolbarTitle") as TextView + toolbarTitle.setOnClickListener { + val viewModel = param.thisObject.get("detailViewModel")!! + val liveData = viewModel.invoke("getReceivers")!! + val receivers = liveData.invoke("getValue") as List<*> + val receiverInfoList = receivers.sortedByDescending { it.get("amount") as Int }.map { + "${it.get("createTime")} ${it.get("recvName")}(${it.get("recvUin")}) ${it.get("amount")}" + } + val context = ContextUtils.getCurrentActivity() + val outFile = File(context.externalCacheDir, "hd_temp/output.txt").apply { parentFile!!.mkdirs() } + outFile.writeText(receiverInfoList.joinToString("\n")) + Toasts.show("已输出到 /cache/hd_temp/output.txt") + } + } + return true + } +} \ No newline at end of file