Auto cancel error notifications

pull/146/head
M66B 6 years ago
parent 335d51a4df
commit d7bb43f167

@ -20,6 +20,7 @@ package eu.faircode.email;
*/
import android.Manifest;
import android.app.NotificationManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
@ -1244,9 +1245,12 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
db.beginTransaction();
EntityMessage message = db.message().getMessage(id);
if (message.uid == null && !TextUtils.isEmpty(message.error)) // outbox
if (message.uid == null && !TextUtils.isEmpty(message.error)) {
// outbox
db.message().deleteMessage(id);
else {
NotificationManager nm = context.getSystemService(NotificationManager.class);
nm.cancel("send", message.account.intValue());
} else {
db.message().setMessageUiHide(message.id, true);
EntityOperation.queue(db, message, EntityOperation.DELETE);
}

@ -25,6 +25,7 @@ import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
import android.app.Activity;
import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@ -778,6 +779,11 @@ public class FragmentAccount extends FragmentEx {
if (reload)
ServiceSynchronize.reload(getContext(), "save account");
if (!synchronize) {
NotificationManager nm = getContext().getSystemService(NotificationManager.class);
nm.cancel("receive", account.id.intValue());
}
return null;
}

Loading…
Cancel
Save