From aa3f4a49909433ce72313b65f06131b192f2c188 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 9 Feb 2019 12:19:23 +0000 Subject: [PATCH] Refactoring --- .../eu/faircode/email/ServiceSynchronize.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index cea25fb602..f5de58f415 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -338,18 +338,6 @@ public class ServiceSynchronize extends LifecycleService { break; case "clear": - executor.submit(new Runnable() { - @Override - public void run() { - try { - DB.getInstance(ServiceSynchronize.this).message().ignoreAll(); - } catch (Throwable ex) { - Log.e(ex); - } - } - }); - break; - case "seen": case "archive": case "trash": @@ -362,12 +350,16 @@ public class ServiceSynchronize extends LifecycleService { try { db.beginTransaction(); - long id = Long.parseLong(parts[1]); + long id = (parts.length > 1 ? Long.parseLong(parts[1]) : -1); EntityMessage message = db.message().getMessage(id); - if (message == null) + if (id > 0 && message == null) return; switch (parts[0]) { + case "clear": + db.message().ignoreAll(); + break; + case "seen": EntityOperation.queue(ServiceSynchronize.this, db, message, EntityOperation.SEEN, true); break;