mirror of https://github.com/M66B/FairEmail.git
Fixed double notification sound on older Android versions
This commit is contained in:
parent
10d6f10fde
commit
74f3d55ad9
|
@ -231,14 +231,19 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int headers = 0;
|
||||||
|
for (Integer id : added)
|
||||||
|
if (id < 0)
|
||||||
|
headers++;
|
||||||
|
|
||||||
Log.i(Helper.TAG, "Notification account=" + account +
|
Log.i(Helper.TAG, "Notification account=" + account +
|
||||||
" notifications=" + notifications.size() +
|
" notifications=" + notifications.size() + " all=" + all.size() +
|
||||||
" all=" + all.size() + " added=" + added.size() + " removed=" + removed.size());
|
" added=" + added.size() + " removed=" + removed.size() + " headers=" + headers);
|
||||||
|
|
||||||
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
|
||||||
if (notifications.size() == 0 ||
|
if (notifications.size() == 0 ||
|
||||||
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O && added.size() > 0))
|
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O && headers > 0))
|
||||||
nm.cancel("unseen:" + account, 0);
|
nm.cancel("unseen:" + account, 0);
|
||||||
|
|
||||||
for (Integer id : removed)
|
for (Integer id : removed)
|
||||||
|
|
Loading…
Reference in New Issue