Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix pangu and optimize FileRecvRedirec logic #1210

Merged
merged 4 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ package cc.ioctl.hook.experimental

import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.os.Environment
import android.view.View
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
Expand All @@ -33,12 +32,10 @@ import android.widget.CheckBox
import android.widget.EditText
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.view.setPadding
import cc.ioctl.util.HostInfo
import cc.ioctl.util.hookAfterIfEnabled
import com.github.kyuubiran.ezxhelper.utils.Log
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import io.github.qauxv.util.xpcompat.XposedHelpers
import io.github.duzhaokun123.util.FilePicker
import io.github.qauxv.base.IUiItemAgent
import io.github.qauxv.base.annotation.FunctionHookEntry
Expand All @@ -53,6 +50,7 @@ import io.github.qauxv.util.SyncUtils
import io.github.qauxv.util.Toasts
import io.github.qauxv.util.dexkit.CAppConstants
import io.github.qauxv.util.dexkit.DexKit
import io.github.qauxv.util.xpcompat.XposedHelpers
import kotlinx.coroutines.flow.StateFlow
import java.io.File
import java.lang.reflect.Field
Expand Down Expand Up @@ -100,7 +98,7 @@ object FileRecvRedirect : CommonConfigFunctionHook(SyncUtils.PROC_ANY and (SyncU
ll_path.visibility = if (isChecked) View.VISIBLE else View.GONE
}
btn_select.setOnClickListener {
FilePicker.pickDir(activity, "选择下载文件重定向目录", et_path.text.toString()) { path ->
FilePicker.pickDir(activity, "选择下载文件重定向目录", Environment.getExternalStorageDirectory().absolutePath) { path ->
et_path.setText(path)
}
}
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/cc/microblock/hook/Pangu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,12 @@ object SendPangu : CommonSwitchFunctionHook("sendMsgPangu", arrayOf(AIOTextEleme
override fun initOnce(): Boolean {
DexKit.requireMethodFromCache(AIOTextElementCtor)
.hookBefore(this) {
val content = it.args[0].get(if (requireMinQQVersion(QQVersion.QQ_9_0_65)) "e" else "a") as String
val inputStrFieldName = if (requireMinQQVersion(QQVersion.QQ_9_0_56)) "e" else "a"
val content = it.args[0].get(inputStrFieldName) as String
if (!content.startsWith(",,") && !content.startsWith(",,"))
it.args[0].set("a", processPangu(content))
it.args[0].set(inputStrFieldName, processPangu(content))
else
it.args[0].set("a", content.substring(2))
it.args[0].set(inputStrFieldName, content.substring(2))
}
return true
}
Expand Down
Loading