mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 04:46:51 +01:00
Allow WeChat notifications
It seems WeChat always mark its notifications as LocalOnly. The reason may be to avoid double notifications when using Android Wear watches, since WeChat has a standalone Android Wear app. Do not ignore WeChat notifications even if they're marked as LocalOnly.
This commit is contained in:
parent
7b3e929cd4
commit
2f443ad419
@ -394,7 +394,7 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return shouldIgnoreSource(sbn.getPackageName()) || shouldIgnoreNotification(
|
return shouldIgnoreSource(sbn.getPackageName()) || shouldIgnoreNotification(
|
||||||
sbn.getNotification());
|
sbn.getNotification(), sbn.getPackageName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,15 +432,18 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldIgnoreNotification(Notification notification) {
|
private boolean shouldIgnoreNotification(Notification notification, String source) {
|
||||||
|
|
||||||
MediaSessionCompat.Token mediaSession = NotificationCompat.getMediaSession(notification);
|
MediaSessionCompat.Token mediaSession = NotificationCompat.getMediaSession(notification);
|
||||||
//try to handle media session notifications
|
//try to handle media session notifications
|
||||||
if (mediaSession != null && handleMediaSessionNotification(mediaSession))
|
if (mediaSession != null && handleMediaSessionNotification(mediaSession))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
NotificationType type = AppNotificationType.getInstance().get(source);
|
||||||
//ignore notifications marked as LocalOnly https://developer.android.com/reference/android/app/Notification.html#FLAG_LOCAL_ONLY
|
//ignore notifications marked as LocalOnly https://developer.android.com/reference/android/app/Notification.html#FLAG_LOCAL_ONLY
|
||||||
if (NotificationCompat.getLocalOnly(notification))
|
if (NotificationCompat.getLocalOnly(notification) &&
|
||||||
|
//WeChat always marks its notifications as LocalOnly, do not ignore them
|
||||||
|
type != NotificationType.WECHAT)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
|
Loading…
Reference in New Issue
Block a user