From 611a326ffae2a2015bd6067f4741870f8c9cfb40 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 28 Nov 2018 18:29:46 +0100 Subject: [PATCH] Set account error when --- .../main/java/eu/faircode/email/ServiceSynchronize.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 81f9d8df90..ddbd2f812d 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -609,6 +609,10 @@ public class ServiceSynchronize extends LifecycleService { } private Notification.Builder getNotificationError(String action, Throwable ex) { + return getNotificationError(action, new Date().getTime(), ex); + } + + private Notification.Builder getNotificationError(String action, long when, Throwable ex) { // Build pending intent Intent intent = new Intent(this, ActivitySetup.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); @@ -632,6 +636,7 @@ public class ServiceSynchronize extends LifecycleService { .setContentText(text) .setContentIntent(pi) .setAutoCancel(false) + .setWhen(when) .setShowWhen(true) .setPriority(Notification.PRIORITY_MAX) .setOnlyAlertOnce(true) @@ -822,7 +827,8 @@ public class ServiceSynchronize extends LifecycleService { long now = new Date().getTime(); if (now - account.last_connected > ACCOUNT_ERROR_AFTER * 60 * 1000L) { NotificationManager nm = getSystemService(NotificationManager.class); - nm.notify("receive", account.id.intValue(), getNotificationError(account.name, ex).build()); + nm.notify("receive", account.id.intValue(), + getNotificationError(account.name, account.last_connected, ex).build()); } }