fix notification trigger for messengers

This commit is contained in:
lucky 2022-02-12 19:08:35 +03:00
parent dbb3139eb2
commit 11fc657b85
1 changed files with 3 additions and 4 deletions

View File

@ -21,11 +21,10 @@ class NotificationListenerService : NotificationListenerService() {
override fun onNotificationPosted(sbn: StatusBarNotification?) { override fun onNotificationPosted(sbn: StatusBarNotification?) {
super.onNotificationPosted(sbn) super.onNotificationPosted(sbn)
if (sbn == null) return if (sbn == null || !prefs.isServiceEnabled) return
val code = prefs.code val code = prefs.code
if (!prefs.isServiceEnabled || if (code == "" ||
code == "" || sbn.notification.extras[Notification.EXTRA_TEXT]?.toString() != code) return
sbn.notification.extras.getString(Notification.EXTRA_TEXT)?.trim() != code) return
cancelAllNotifications() cancelAllNotifications()
try { try {
admin.lockNow() admin.lockNow()