mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-06 02:35:40 +08:00
Merge code
This commit is contained in:
@@ -99,7 +99,7 @@ class YukiHookCreater(private val packageParam: PackageParam, private val hookCl
|
||||
@YukiPrivateApi
|
||||
fun hook(): Result {
|
||||
if (YukiHookAPI.hasXposedBridge.not()) return Result()
|
||||
return if (hookMembers.isEmpty()) error("Hook Members is empty,hook aborted")
|
||||
return if (hookMembers.isEmpty()) error("Hook Members is empty, hook aborted")
|
||||
else Result().also {
|
||||
Thread {
|
||||
/** 延迟使得方法取到返回值 */
|
||||
|
@@ -230,7 +230,7 @@ class ConstructorFinder(
|
||||
)
|
||||
remedyPlans.clear()
|
||||
}
|
||||
} else yLoggerW(msg = "RemedyPlan is empty,forgot it? [${hookTag}]")
|
||||
} else yLoggerW(msg = "RemedyPlan is empty, forgot it? [${hookTag}]")
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -279,7 +279,7 @@ class MethodFinder(
|
||||
)
|
||||
remedyPlans.clear()
|
||||
}
|
||||
} else yLoggerW(msg = "RemedyPlan is empty,forgot it? [${hookTag}]")
|
||||
} else yLoggerW(msg = "RemedyPlan is empty, forgot it? [${hookTag}]")
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -69,7 +69,7 @@ class HookParam(private val createrInstance: YukiHookCreater, private val wrappe
|
||||
* @return [Any]
|
||||
* @throws IllegalStateException 如果对象为空
|
||||
*/
|
||||
val instance get() = wrapper.instance ?: error("HookParam instance got null,Is this a static member?")
|
||||
val instance get() = wrapper.instance ?: error("HookParam instance got null! Is this a static member?")
|
||||
|
||||
/**
|
||||
* 获取当前 Hook 实例的类对象
|
||||
@@ -271,8 +271,8 @@ class HookParam(private val createrInstance: YukiHookCreater, private val wrappe
|
||||
* @throws IllegalStateException 如果目标方法参数对象数组为空或 [index] 下标不存在
|
||||
*/
|
||||
fun <T> set(any: T?) {
|
||||
if (args.isEmpty()) error("HookParam method args is empty,mabe not has args")
|
||||
if (index > args.lastIndex) error("HookParam method args index out of bounds,max is ${args.lastIndex}")
|
||||
if (args.isEmpty()) error("HookParam method args is empty, mabe not has args")
|
||||
if (index > args.lastIndex) error("HookParam method args index out of bounds, max is ${args.lastIndex}")
|
||||
wrapper.setArgs(index, any)
|
||||
}
|
||||
|
||||
|
@@ -85,7 +85,7 @@ class YukiHookModulePrefs(private val context: Context? = null) {
|
||||
private fun checkApi() {
|
||||
if (YukiHookAPI.isLoadedFromBaseContext) error("YukiHookModulePrefs not allowed in Custom Hook API")
|
||||
if (YukiHookAPI.hasXposedBridge && YukiHookXposedBridge.modulePackageName.isBlank())
|
||||
error("Xposed modulePackageName load failed,please reset and rebuild it")
|
||||
error("Xposed modulePackageName load failed, please reset and rebuild it")
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,11 +107,11 @@ class YukiHookModulePrefs(private val context: Context? = null) {
|
||||
get() = try {
|
||||
checkApi()
|
||||
context?.getSharedPreferences(prefsName, Context.MODE_WORLD_READABLE)
|
||||
?: error("If you want to use module prefs,you must set the context instance first")
|
||||
?: error("If you want to use module prefs, you must set the context instance first")
|
||||
} catch (_: Throwable) {
|
||||
checkApi()
|
||||
context?.getSharedPreferences(prefsName, Context.MODE_PRIVATE)
|
||||
?: error("If you want to use module prefs,you must set the context instance first")
|
||||
?: error("If you want to use module prefs, you must set the context instance first")
|
||||
}
|
||||
|
||||
/** 设置全局可读可写 */
|
||||
|
Reference in New Issue
Block a user