Notify alerts

pull/146/head
M66B 6 years ago
parent 6ea74b20b1
commit a749e155aa

@ -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;
}
}
}

Loading…
Cancel
Save