Allow manual cleanup

This commit is contained in:
M66B 2018-12-05 17:34:48 +01:00
parent 2ea38acdb7
commit 60a76298fb
2 changed files with 21 additions and 2 deletions

View File

@ -233,6 +233,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
case R.string.menu_faq:
onDebugInfo();
return true;
case R.string.menu_privacy:
onCleanup();
return true;
case R.string.menu_about:
onShowLog();
return true;
@ -1020,6 +1023,21 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}.load(this, new Bundle());
}
private void onCleanup() {
new SimpleTask<Void>() {
@Override
protected Void onLoad(Context context, Bundle args) throws Throwable {
JobDaily.cleanup(ActivityView.this);
return null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
}
}.load(this, new Bundle());
}
private void onShowLog() {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getSupportFragmentManager().popBackStack("logs", FragmentManager.POP_BACK_STACK_INCLUSIVE);

View File

@ -90,8 +90,9 @@ public class JobDaily extends JobService {
keep_time = 0;
int messages = db.message().deleteMessagesBefore(folder.id, keep_time, false);
Log.i(Helper.TAG, "Cleanup folder=" + folder.account + ":" + folder.name +
" before=" + new Date(keep_time) + " deleted=" + messages);
if (messages > 0)
Log.i(Helper.TAG, "Cleanup folder=" + folder.account + "/" + folder.name +
" before=" + new Date(keep_time) + " deleted=" + messages);
}
// Cleanup message files