mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-05 16:45:08 +00:00
Added setting to filter notifications from certain applications
REVIEW: 121687
This commit is contained in:
@@ -64,7 +64,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
|
||||
@Override
|
||||
public boolean hasSettings() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -199,6 +199,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
public void sendNotification(StatusBarNotification statusBarNotification, boolean requestAnswer) {
|
||||
|
||||
Notification notification = statusBarNotification.getNotification();
|
||||
AppDatabase appDatabase = new AppDatabase(context);
|
||||
|
||||
if ((notification.flags & Notification.FLAG_FOREGROUND_SERVICE) != 0
|
||||
|| (notification.flags & Notification.FLAG_ONGOING_EVENT) != 0
|
||||
@@ -207,6 +208,13 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
return;
|
||||
}
|
||||
|
||||
appDatabase.open();
|
||||
if (!appDatabase.isFilterEnabled(statusBarNotification.getPackageName())){
|
||||
return;
|
||||
// we dont want notification from this app
|
||||
}
|
||||
appDatabase.close();
|
||||
|
||||
NotificationId id = NotificationId.fromNotification(statusBarNotification);
|
||||
|
||||
NetworkPackage np = new NetworkPackage(NetworkPackage.PACKAGE_TYPE_NOTIFICATION);
|
||||
|
Reference in New Issue
Block a user