优化:自动消除全部通知(临时方案)

This commit is contained in:
pppscn 2022-06-08 09:14:37 +08:00
parent fefa4b0ab3
commit abb514df8c
2 changed files with 9 additions and 1 deletions

View File

@ -105,6 +105,14 @@ class NotifyService : NotificationListenerService()/*, LifecycleOwner*/ {
}
}
}*/
//自动消除全部通知(临时方案)
if (SettingUtils.enableCancelAppNotify) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cancelNotification(sbn.key)
} else {
cancelNotification(sbn.packageName, sbn.tag, sbn.id)
}
}
} catch (e: Exception) {
Log.e(TAG, "Parsing Notification failed: " + e.message.toString())

View File

@ -30,7 +30,7 @@ class SendWorker(
val msgInfoJson = inputData.getString(Worker.sendMsgInfo)
val msgInfo = Gson().fromJson(msgInfoJson, MsgInfo::class.java)
//TODO:过滤重复消息机制
// 过滤重复消息机制
if (SettingUtils.duplicateMessagesLimits > 0) {
val key = CipherUtils.md5(msgInfo.type + msgInfo.from + msgInfo.content)
val timestamp: Long = System.currentTimeMillis() / 1000L