diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index 80e47a346a..0b4dbe3c6e 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -977,7 +977,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB new SimpleTask() { @Override protected Void onExecute(Context context, Bundle args) { - JobDaily.cleanup(ActivityView.this); + JobDaily.cleanup(ActivityView.this, true); return null; } diff --git a/app/src/main/java/eu/faircode/email/JobDaily.java b/app/src/main/java/eu/faircode/email/JobDaily.java index f6a30dbccf..4ab051d0ce 100644 --- a/app/src/main/java/eu/faircode/email/JobDaily.java +++ b/app/src/main/java/eu/faircode/email/JobDaily.java @@ -64,19 +64,19 @@ public class JobDaily extends JobService { executor.submit(new Runnable() { @Override public void run() { - cleanup(getApplicationContext()); + cleanup(getApplicationContext(), false); } }); return false; } - static void cleanup(Context context) { + static void cleanup(Context context, boolean manual) { DB db = DB.getInstance(context); try { db.beginTransaction(); - Log.i("Start daily job"); + Log.i("Start daily job manual=" + manual); // Cleanup folders Log.i("Cleanup kept messages"); @@ -141,11 +141,12 @@ public class JobDaily extends JobService { File[] images = new File(context.getCacheDir(), "images").listFiles(); if (images != null) for (File file : images) - if (file.isFile() && (now - file.lastModified()) > CACHE_IMAGE_DURATION) { - Log.i("Deleting " + file); - if (!file.delete()) - Log.w("Error deleting " + file); - } + if (file.isFile()) + if (manual || now - file.lastModified() > CACHE_IMAGE_DURATION) { + Log.i("Deleting " + file); + if (!file.delete()) + Log.w("Error deleting " + file); + } Log.i("Cleanup log"); long before = now - KEEP_LOG_DURATION;