mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-26 15:40:59 +01:00
Check primary drafts on accounts setup
This commit is contained in:
@@ -286,13 +286,25 @@ public class FragmentSetup extends FragmentBase {
|
||||
btnInbox.setEnabled(done);
|
||||
|
||||
prefs.edit().putBoolean("has_accounts", done).apply();
|
||||
}
|
||||
});
|
||||
|
||||
db.folder().livePrimaryDrafts().observe(getViewLifecycleOwner(), new Observer<EntityFolder>() {
|
||||
@Override
|
||||
public void onChanged(EntityFolder draft) {
|
||||
tvNoPrimaryDrafts.setVisibility(draft == null ? View.VISIBLE : View.GONE);
|
||||
if (done)
|
||||
new SimpleTask<EntityFolder>() {
|
||||
@Override
|
||||
protected EntityFolder onExecute(Context context, Bundle args) {
|
||||
DB db = DB.getInstance(context);
|
||||
return db.folder().getPrimaryDrafts();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, EntityFolder drafts) {
|
||||
tvNoPrimaryDrafts.setVisibility(drafts == null ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getFragmentManager(), ex);
|
||||
}
|
||||
}.execute(FragmentSetup.this, new Bundle(), "setup:drafts");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user