Widget: fixed showing unified account messages (QA)

This commit is contained in:
M66B 2020-01-24 15:32:35 +01:00
parent aed65976ca
commit 2ba5a88cea
2 changed files with 6 additions and 8 deletions

View File

@ -384,6 +384,7 @@ public interface DaoMessage {
" JOIN account_view AS account ON account.id = message.account" +
" JOIN folder_view AS folder ON folder.id = message.folder" +
" WHERE account.`synchronize`" +
" AND (:account IS NULL OR account.id = :account)" +
" AND ((:folder IS NULL AND folder.unified) OR folder.id = :folder)" +
" AND NOT message.ui_hide" +
" AND message.ui_snoozed IS NULL" +
@ -393,7 +394,7 @@ public interface DaoMessage {
", CASE WHEN message.thread IS NULL OR NOT :threading THEN message.id ELSE message.thread END" +
" ORDER BY message.received DESC")
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
List<TupleMessageWidget> getWidgetUnified(Long folder, boolean threading, boolean unseen, boolean flagged);
List<TupleMessageWidget> getWidgetUnified(Long account, Long folder, boolean threading, boolean unseen, boolean flagged);
@Query("SELECT uid FROM message" +
" WHERE folder = :folder" +

View File

@ -84,13 +84,10 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
try {
db.beginTransaction();
if (folder < 0 && account > 0) {
EntityFolder inbox = db.folder().getFolderByType(account, EntityFolder.INBOX);
if (inbox != null)
folder = inbox.id;
}
messages = db.message().getWidgetUnified(folder < 0 ? null : folder, threading, unseen, flagged);
messages = db.message().getWidgetUnified(
account < 0 ? null : account,
folder < 0 ? null : folder,
threading, unseen, flagged);
db.setTransactionSuccessful();
} finally {