From e80c13394bd73aead61cf3c6c1d90f35d4ae6f7d Mon Sep 17 00:00:00 2001 From: xihan123 Date: Sun, 20 Aug 2023 15:48:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=B8=BB=E8=AE=BE=E7=BD=AE):=20`970`=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC=20`=E5=8F=91=E5=B8=96=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E7=9B=B4=E9=93=BE`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xihan123 --- .../main/kotlin/cn/xihan/qdds/HookEntry.kt | 68 ++++++++++++++++--- 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/cn/xihan/qdds/HookEntry.kt b/app/src/main/kotlin/cn/xihan/qdds/HookEntry.kt index 21d2574..0c3f842 100644 --- a/app/src/main/kotlin/cn/xihan/qdds/HookEntry.kt +++ b/app/src/main/kotlin/cn/xihan/qdds/HookEntry.kt @@ -66,6 +66,10 @@ class HookEntry : IYukiHookXposedInit { receiveReadingCreditsAutomatically(versionCode) } + if (optionEntity.mainOption.enablePostToShowImageUrl) { + postToShowImageUrl(versionCode) + } + if (optionEntity.mainOption.enableLocalCard) { enableLocalCard(versionCode) } @@ -264,8 +268,7 @@ class HookEntry : IYukiHookXposedInit { /** * 调试-查看跳转关键词 - */ - /* + *//* findClass("com.qidian.QDReader.other.ActionUrlProcess").hook { /* injectMember { @@ -1748,10 +1751,9 @@ fun PackageParam.receiveReadingCreditsAutomatically(versionCode: Int) { returnType = UnitType } afterHook { - val bubbleViewMap = - instance.getParam>("bubbleViewMap") - bubbleViewMap?.forEach { (_, any2) -> - val readTimeBubbleView = any2 as? LinearLayout + val bubbleViewMap = instance.getParam>("bubbleViewMap") + bubbleViewMap?.values?.forEach { view -> + val readTimeBubbleView = view as? LinearLayout readTimeBubbleView?.postRandomDelay { performClick() } } } @@ -1851,8 +1853,7 @@ fun PackageParam.receiveReadingCreditsAutomatically(versionCode: Int) { returnType = CharSequenceClass }.call() val list = listOf( - "领取奖励", - "开启新一周PK" + "领取奖励", "开启新一周PK" ) if (text in list) { button.postRandomDelay { performClick() } @@ -1866,4 +1867,55 @@ fun PackageParam.receiveReadingCreditsAutomatically(versionCode: Int) { else -> "自动领取阅读积分".printlnNotSupportVersion(versionCode) } +} + +/** + * 发帖显示图片直链 + */ +fun PackageParam.postToShowImageUrl(versionCode: Int) { + when (versionCode) { + 970 -> { + findClass("com.qidian.QDReader.ui.dialog.h9").hook { + injectMember { + method { + name = "p" + emptyParam() + returnType = UnitType + } + afterHook { + val lists = instance.getParamList>().takeUnless { it.isEmpty() } + ?.filterNot { it[0] is String } + lists?.firstOrNull()?.let { urlList -> + urlList.mapNotNull { it?.getParam("mAccessUrl") } + .let { accessUrls -> + instance.getViews() + .firstNotNullOfOrNull { it.context } + ?.showUrlListDialog(accessUrls) + } + } + } + } + } + } + + else -> "发帖显示图片直链".printlnNotSupportVersion(versionCode) + } +} + +/** + * 显示直链地址对话框 + */ +fun Context.showUrlListDialog(urls: List) { + val customEditText = CustomEditText( + context = this, value = urls.joinToString("\n") + ) + alertDialog { + title = "urlList" + customView = customEditText + positiveButton("复制全部") { + context.copyToClipboard(urls.joinToString("\n")) + } + build() + show() + } } \ No newline at end of file