mirror of
https://github.com/KitsunePie/AppErrorsTracking.git
synced 2025-09-01 08:45:16 +08:00
Modify merge to YukiHookAPI new usage
This commit is contained in:
@@ -38,7 +38,6 @@ import com.fankes.apperrorstracking.locale.LocaleString
|
||||
import com.fankes.apperrorstracking.ui.activity.base.BaseActivity
|
||||
import com.fankes.apperrorstracking.utils.factory.*
|
||||
import com.fankes.apperrorstracking.utils.tool.FrameworkTool
|
||||
import com.highcapable.yukihookapi.hook.factory.current
|
||||
import com.highcapable.yukihookapi.hook.factory.dataChannel
|
||||
import com.highcapable.yukihookapi.hook.log.YukiHookLogger
|
||||
import com.highcapable.yukihookapi.hook.log.YukiLoggerData
|
||||
@@ -137,26 +136,6 @@ class LoggerActivity : BaseActivity<ActivitiyLoggerBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前所有日志写出文件的格式
|
||||
*
|
||||
* 复制自 [YukiHookLogger.contents]
|
||||
* @return [String]
|
||||
*/
|
||||
private val loggerContents: String
|
||||
get() {
|
||||
var content = ""
|
||||
listData.takeIf { it.isNotEmpty() }?.forEach {
|
||||
val head = "${it.time} ------ "
|
||||
content += "$head$it\n"
|
||||
it.throwable?.also { e ->
|
||||
content += "${head}Dump stack trace for \"${e.current().name}\":\n"
|
||||
content += e.toStackTrace()
|
||||
}
|
||||
}
|
||||
return content
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化为本地时间格式
|
||||
* @return [String]
|
||||
@@ -193,7 +172,7 @@ class LoggerActivity : BaseActivity<ActivitiyLoggerBinding>() {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == WRITE_REQUEST_CODE && resultCode == Activity.RESULT_OK) runCatching {
|
||||
data?.data?.let {
|
||||
contentResolver?.openOutputStream(it)?.apply { write(loggerContents.toByteArray()) }?.close()
|
||||
contentResolver?.openOutputStream(it)?.apply { write(YukiHookLogger.contents(listData).toByteArray()) }?.close()
|
||||
toast(LocaleString.exportAllLogsSuccess)
|
||||
} ?: toast(LocaleString.exportAllLogsFail)
|
||||
}.onFailure { toast(LocaleString.exportAllLogsFail) }
|
||||
|
@@ -120,7 +120,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
else -> LocaleString.moduleNotActivated
|
||||
}
|
||||
binding.mainTextApiWay.isVisible = YukiHookAPI.Status.isXposedModuleActive
|
||||
binding.mainTextApiWay.text = "Activated by ${YukiHookAPI.Status.executorName} API ${YukiHookAPI.Status.executorVersion}"
|
||||
binding.mainTextApiWay.text = "Activated by ${YukiHookAPI.Status.Executor.name} API ${YukiHookAPI.Status.Executor.apiLevel}"
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -234,7 +234,8 @@ object FrameworkTool {
|
||||
* @param context 实例
|
||||
* @param result 成功后回调
|
||||
*/
|
||||
fun checkingActivated(context: Context, result: (Boolean) -> Unit) = context.dataChannel(SYSTEM_FRAMEWORK_NAME).checkingVersionEquals(result)
|
||||
fun checkingActivated(context: Context, result: (Boolean) -> Unit) =
|
||||
context.dataChannel(SYSTEM_FRAMEWORK_NAME).checkingVersionEquals(result = result)
|
||||
|
||||
/**
|
||||
* 使用系统框架打开 [packageName]
|
||||
|
Reference in New Issue
Block a user