更新 YukiHookAPI

This commit is contained in:
2022-03-02 03:07:38 +08:00
parent 89321af1ce
commit 6684d7f376
2 changed files with 8 additions and 10 deletions

View File

@@ -68,8 +68,8 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
compileOnly 'de.robv.android.xposed:api:82' compileOnly 'de.robv.android.xposed:api:82'
implementation 'com.highcapable.yukihookapi:api:1.0.2' implementation 'com.highcapable.yukihookapi:api:1.0.3'
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.2' ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.3'
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.0' implementation 'com.geyifeng.immersionbar:immersionbar:3.2.0'
implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.0' implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.3' implementation 'com.squareup.okhttp3:okhttp:4.9.3'

View File

@@ -261,9 +261,7 @@ class HookEntry : YukiHookXposedInitProxy {
*/ */
private val PackageParam.globalContext private val PackageParam.globalContext
get() = safeOfNull { get() = safeOfNull {
if (SystemUIApplicationClass.clazz.hasMethod(name = "getContext")) SystemUIApplicationClass.clazz.method { name = "getContext" }.ignoredError().get().invoke<Context>()
SystemUIApplicationClass.clazz.method { name = "getContext" }.get().invoke<Context>()
else null
} }
/** /**
@@ -505,7 +503,7 @@ class HookEntry : YukiHookXposedInitProxy {
replaceAny { replaceAny {
hookIgnoreStatusBarIconColor( hookIgnoreStatusBarIconColor(
context = globalContext ?: error("GlobalContext got null"), context = globalContext ?: error("GlobalContext got null"),
expandedNf = args[0] as? StatusBarNotification? expandedNf = firstArgs as? StatusBarNotification?
) )
} }
} }
@@ -526,7 +524,7 @@ class HookEntry : YukiHookXposedInitProxy {
}.onFind { isUseLegacy = true } }.onFind { isUseLegacy = true }
} }
afterHook { afterHook {
(globalContext ?: args[0] as Context).also { context -> (globalContext ?: firstArgs as Context).also { context ->
hookSmallIconOnSet( hookSmallIconOnSet(
context = context, context = context,
args[if (isUseLegacy) 1 else 0] as? StatusBarNotification?, args[if (isUseLegacy) 1 else 0] as? StatusBarNotification?,
@@ -597,15 +595,15 @@ class HookEntry : YukiHookXposedInitProxy {
} }
} }
intercept() intercept()
}.ignoredAllFailure() }
injectMember { injectMember {
method { method {
name = "resetIconBgAndPaddings" name = "resetIconBgAndPaddings"
param(ImageViewClass, ExpandedNotificationClass.clazz) param(ImageViewClass, ExpandedNotificationClass.clazz)
} }
intercept() intercept()
}.ignoredAllFailure() }
} }.ignoredHookClassNotFoundFailure()
} }
} }
} }