1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 02:37:16 +00:00

Notify alerts

This commit is contained in:
M66B 2018-12-04 20:33:28 +01:00
parent 6ea74b20b1
commit a749e155aa

View file

@ -714,7 +714,7 @@ public class ServiceSynchronize extends LifecycleService {
EntityLog.log(this, action + " " + Helper.formatThrowable(ex));
if (ex instanceof SendFailedException) {
if ((ex instanceof SendFailedException) || (ex instanceof AlertException)) {
NotificationManager nm = getSystemService(NotificationManager.class);
nm.notify(action, 1, getNotificationError(action, ex).build());
}
@ -779,6 +779,7 @@ public class ServiceSynchronize extends LifecycleService {
EntityLog.log(ServiceSynchronize.this, account.name + " " + type + ": " + e.getMessage());
if (e.getMessageType() == StoreEvent.ALERT) {
db.account().setAccountError(account.id, e.getMessage());
reportError(account.name, null, new AlertException(e.getMessage()));
state.error();
}
} finally {
@ -2696,4 +2697,17 @@ public class ServiceSynchronize extends LifecycleService {
return "[running=" + running + "]";
}
}
private class AlertException extends Throwable {
private String alert;
AlertException(String alert) {
this.alert = alert;
}
@Override
public String getMessage() {
return alert;
}
}
}