Show unread count per account

This commit is contained in:
M66B
2018-12-16 17:39:15 +01:00
parent c402a97016
commit 3b2ee071f7
10 changed files with 77 additions and 23 deletions

View File

@@ -41,8 +41,18 @@ public interface DaoAccount {
@Query("SELECT * FROM account")
LiveData<List<EntityAccount>> liveAccounts();
@Query("SELECT * FROM account WHERE synchronize = :synchronize")
LiveData<List<EntityAccount>> liveAccounts(boolean synchronize);
@Query("SELECT *" +
", (SELECT COUNT(message.id)" +
" FROM message" +
" JOIN folder ON folder.id = message.folder" +
" WHERE message.account = account.id" +
" AND folder.type <> '" + EntityFolder.ARCHIVE + "'" +
" AND folder.type <> '" + EntityFolder.TRASH + "'" +
" AND folder.type <> '" + EntityFolder.DRAFTS + "'" +
" AND NOT ui_seen) AS unseen" +
" FROM account" +
" WHERE synchronize = :synchronize")
LiveData<List<TupleAccountEx>> liveAccounts(boolean synchronize);
@Query("SELECT * FROM account WHERE id = :id")
EntityAccount getAccount(long id);