mirror of https://github.com/M66B/FairEmail.git
Check primary drafts on accounts setup
This commit is contained in:
parent
856066c941
commit
6fe104a3bc
|
@ -120,13 +120,6 @@ public interface DaoFolder {
|
|||
" GROUP BY folder.id")
|
||||
LiveData<List<TupleFolderNav>> liveNavigation();
|
||||
|
||||
@Query("SELECT folder.* FROM folder" +
|
||||
" JOIN account ON account.id = folder.account" +
|
||||
" WHERE account.synchronize" +
|
||||
" AND account.`primary`" +
|
||||
" AND folder.type = '" + EntityFolder.DRAFTS + "'")
|
||||
LiveData<EntityFolder> livePrimaryDrafts();
|
||||
|
||||
@Query("SELECT COUNT(id) FROM folder" +
|
||||
" WHERE sync_state = 'syncing'" +
|
||||
" AND folder.type <> '" + EntityFolder.OUTBOX + "'")
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue