Flash on new messages only

pull/199/head
M66B 4 years ago
parent 1e2f8098cb
commit 14dfd61d2e

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

Loading…
Cancel
Save