1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-18 13:21:02 +00:00

Flash on new messages only

This commit is contained in:
M66B 2021-06-22 20:06:06 +02:00
parent 1e2f8098cb
commit 14dfd61d2e

View file

@ -3973,6 +3973,7 @@ class Core {
}
// Difference
boolean flash = false;
for (long group : groupMessages.keySet()) {
List<Long> add = new ArrayList<>();
List<Long> update = new ArrayList<>();
@ -4001,8 +4002,10 @@ class Core {
update.add(id);
}
remove.remove(-id);
} else
} else {
flash = true;
add.add(id);
}
Log.i("Notify adding=" + id + " existing=" + existing);
}
}
@ -4083,15 +4086,15 @@ class Core {
}
}
}
}
if (notify_screen_on && notifications.size() > 0) {
Log.i("Notify screen on");
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakeLock = pm.newWakeLock(
PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP,
BuildConfig.APPLICATION_ID + ":notification");
wakeLock.acquire(SCREEN_ON_DURATION);
}
if (notify_screen_on && flash) {
Log.i("Notify screen on");
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakeLock = pm.newWakeLock(
PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP,
BuildConfig.APPLICATION_ID + ":notification");
wakeLock.acquire(SCREEN_ON_DURATION);
}
}