diff --git a/app/src/main/java/com/fankes/miui/notify/hook/entity/SystemUIHooker.kt b/app/src/main/java/com/fankes/miui/notify/hook/entity/SystemUIHooker.kt index 358d13a..168b082 100644 --- a/app/src/main/java/com/fankes/miui/notify/hook/entity/SystemUIHooker.kt +++ b/app/src/main/java/com/fankes/miui/notify/hook/entity/SystemUIHooker.kt @@ -54,6 +54,7 @@ import com.fankes.miui.notify.params.IconPackParams import com.fankes.miui.notify.params.factory.isAppNotifyHookAllOf import com.fankes.miui.notify.params.factory.isAppNotifyHookOf import com.fankes.miui.notify.utils.factory.* +import com.fankes.miui.notify.utils.tool.ActivationPromptTool import com.fankes.miui.notify.utils.tool.BitmapCompatTool import com.fankes.miui.notify.utils.tool.IconAdaptationTool import com.fankes.miui.notify.utils.tool.SystemUITool @@ -693,11 +694,12 @@ object SystemUIHooker : YukiBaseHooker() { addAction(Intent.ACTION_PACKAGE_REPLACED) addAction(Intent.ACTION_PACKAGE_REMOVED) }) { context, intent -> - if (intent.action.equals(Intent.ACTION_PACKAGE_REPLACED).not() && - intent.getBooleanExtra(Intent.EXTRA_REPLACING, false) - ) return@registerReceiver - if (ConfigData.isEnableNotifyIconFix && ConfigData.isEnableNotifyIconFixNotify) - intent.data?.schemeSpecificPart?.also { packageName -> + intent.data?.schemeSpecificPart?.also { packageName -> + if (intent.action.equals(Intent.ACTION_PACKAGE_REPLACED)) ActivationPromptTool.prompt(context, packageName) + if (intent.action.equals(Intent.ACTION_PACKAGE_REPLACED).not() && + intent.getBooleanExtra(Intent.EXTRA_REPLACING, false) + ) return@registerReceiver + if (ConfigData.isEnableNotifyIconFix && ConfigData.isEnableNotifyIconFixNotify) when (intent.action) { Intent.ACTION_PACKAGE_ADDED -> { if (iconDatas.takeIf { e -> e.isNotEmpty() } @@ -707,7 +709,7 @@ object SystemUIHooker : YukiBaseHooker() { } Intent.ACTION_PACKAGE_REMOVED -> IconAdaptationTool.removeNewAppSupportNotify(context, packageName) } - } + } } /** 注入模块资源 */ onCreate { injectModuleAppResources() } diff --git a/app/src/main/java/com/fankes/miui/notify/utils/tool/ActivationPromptTool.kt b/app/src/main/java/com/fankes/miui/notify/utils/tool/ActivationPromptTool.kt new file mode 100644 index 0000000..a3b8a89 --- /dev/null +++ b/app/src/main/java/com/fankes/miui/notify/utils/tool/ActivationPromptTool.kt @@ -0,0 +1,84 @@ +/* + * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. + * Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) + * https://github.com/fankes/MIUINativeNotifyIcon + * + * This software is non-free but opensource software: you can redistribute it + * and/or modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + *
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * and eula along with this software. If not, see
+ *