From 11fc657b8562ea923dd465507e8a74148c7975f1 Mon Sep 17 00:00:00 2001 From: lucky <> Date: Sat, 12 Feb 2022 19:08:35 +0300 Subject: [PATCH] fix notification trigger for messengers --- .../java/me/lucky/wasted/NotificationListenerService.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/me/lucky/wasted/NotificationListenerService.kt b/app/src/main/java/me/lucky/wasted/NotificationListenerService.kt index ec2ab64..d026f7a 100644 --- a/app/src/main/java/me/lucky/wasted/NotificationListenerService.kt +++ b/app/src/main/java/me/lucky/wasted/NotificationListenerService.kt @@ -21,11 +21,10 @@ class NotificationListenerService : NotificationListenerService() { override fun onNotificationPosted(sbn: StatusBarNotification?) { super.onNotificationPosted(sbn) - if (sbn == null) return + if (sbn == null || !prefs.isServiceEnabled) return val code = prefs.code - if (!prefs.isServiceEnabled || - code == "" || - sbn.notification.extras.getString(Notification.EXTRA_TEXT)?.trim() != code) return + if (code == "" || + sbn.notification.extras[Notification.EXTRA_TEXT]?.toString() != code) return cancelAllNotifications() try { admin.lockNow()