Merge code

This commit is contained in:
2022-03-25 02:01:52 +08:00
parent b8894e3bc0
commit 299e93b25c

View File

@@ -624,8 +624,8 @@ class HookEntry : YukiHookXposedInitProxy {
}.onFind { isUseLegacy = true } }.onFind { isUseLegacy = true }
} }
afterHook { afterHook {
(globalContext ?: firstArgs as Context).also { context -> (globalContext ?: firstArgs())?.also { context ->
val expandedNf = args[if (isUseLegacy) 1 else 0] as? StatusBarNotification? val expandedNf = args(if (isUseLegacy) 1 else 0).of<StatusBarNotification?>()
/** Hook 状态栏小图标 */ /** Hook 状态栏小图标 */
compatStatusIcon( compatStatusIcon(
context = context, context = context,
@@ -717,7 +717,7 @@ class HookEntry : YukiHookXposedInitProxy {
name = "setMaxStaticIcons" name = "setMaxStaticIcons"
param(IntType) param(IntType)
} }
beforeHook { isShowNotificationIcons = firstArgs as Int > 0 } beforeHook { isShowNotificationIcons = (firstArgs<Int>() ?: 0) > 0 }
}.ignoredNoSuchMemberFailure() }.ignoredNoSuchMemberFailure()
/** 新版方法 - 旧版不存在 */ /** 新版方法 - 旧版不存在 */
injectMember { injectMember {
@@ -725,7 +725,7 @@ class HookEntry : YukiHookXposedInitProxy {
name = "miuiShowNotificationIcons" name = "miuiShowNotificationIcons"
param(BooleanType) param(BooleanType)
} }
beforeHook { isShowNotificationIcons = firstArgs as Boolean } beforeHook { isShowNotificationIcons = firstArgs<Boolean>() ?: false }
}.ignoredNoSuchMemberFailure() }.ignoredNoSuchMemberFailure()
}.by { NotificationIconContainerClass.clazz.hasField(name = "MAX_STATIC_ICONS") } }.by { NotificationIconContainerClass.clazz.hasField(name = "MAX_STATIC_ICONS") }
NotificationHeaderViewWrapperClass.hook { NotificationHeaderViewWrapperClass.hook {
@@ -821,11 +821,11 @@ class HookEntry : YukiHookXposedInitProxy {
if (iconDatas.takeIf { e -> e.isNotEmpty() } if (iconDatas.takeIf { e -> e.isNotEmpty() }
?.filter { e -> e.packageName == newPkgName } ?.filter { e -> e.packageName == newPkgName }
.isNullOrEmpty() .isNullOrEmpty()
) IconAdaptationTool.pushNewAppSupportNotify(firstArgs as Context, newPkgName) ) IconAdaptationTool.pushNewAppSupportNotify(firstArgs()!!, newPkgName)
} }
Intent.ACTION_PACKAGE_REMOVED -> Intent.ACTION_PACKAGE_REMOVED ->
IconAdaptationTool.removeNewAppSupportNotify( IconAdaptationTool.removeNewAppSupportNotify(
firstArgs as Context, context = firstArgs()!!,
packageName = it.data?.schemeSpecificPart ?: "" packageName = it.data?.schemeSpecificPart ?: ""
) )
} }