Added snoozing messages

This commit is contained in:
M66B
2019-01-07 15:05:24 +00:00
parent 0bcb335203
commit e3e0f58197
17 changed files with 1622 additions and 20 deletions

View File

@@ -63,6 +63,7 @@ public interface DaoMessage {
" JOIN folder ON folder.id = message.folder" +
" WHERE account.`synchronize`" +
" AND (NOT message.ui_hide OR :debug)" +
" AND (:snoozed OR ui_snoozed IS NULL)" +
" GROUP BY account.id, CASE WHEN message.thread IS NULL OR NOT :threading THEN message.id ELSE message.thread END" +
" HAVING SUM(unified) > 0" +
" ORDER BY" +
@@ -73,7 +74,7 @@ public interface DaoMessage {
" ELSE 0" +
" END DESC, message.received DESC")
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
DataSource.Factory<Integer, TupleMessageEx> pagedUnifiedInbox(boolean threading, String sort, boolean debug);
DataSource.Factory<Integer, TupleMessageEx> pagedUnifiedInbox(boolean threading, String sort, boolean snoozed, boolean debug);
String unseen_folder = "SUM(CASE WHEN message.ui_seen" +
" OR (folder.id <> :folder AND folder.type = '" + EntityFolder.ARCHIVE + "')" +
@@ -102,6 +103,7 @@ public interface DaoMessage {
" JOIN folder f ON f.id = :folder" +
" WHERE (message.account = f.account OR folder.type = '" + EntityFolder.OUTBOX + "')" +
" AND (NOT message.ui_hide OR :debug)" +
" AND (:snoozed OR :found OR ui_snoozed IS NULL)" +
" AND (NOT :found OR ui_found = :found)" +
" GROUP BY CASE WHEN message.thread IS NULL OR NOT :threading THEN message.id ELSE message.thread END" +
" HAVING SUM(CASE WHEN folder.id = :folder THEN 1 ELSE 0 END) > 0" +
@@ -113,7 +115,7 @@ public interface DaoMessage {
" ELSE 0" +
" END DESC, message.received DESC")
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
DataSource.Factory<Integer, TupleMessageEx> pagedFolder(long folder, boolean threading, String sort, boolean found, boolean debug);
DataSource.Factory<Integer, TupleMessageEx> pagedFolder(long folder, boolean threading, String sort, boolean snoozed, boolean found, boolean debug);
@Query("SELECT message.*" +
", account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor, account.notify AS accountNotify" +
@@ -258,6 +260,9 @@ public interface DaoMessage {
" AND NOT uid IS NULL")
List<Long> getUids(long folder, Long received);
@Query("SELECT * FROM message WHERE NOT ui_snoozed IS NULL")
List<EntityMessage> getSnoozed();
@Insert
long insertMessage(EntityMessage message);
@@ -319,6 +324,10 @@ public interface DaoMessage {
@Query("UPDATE message SET ui_found = 0")
int resetSearch();
@Query("UPDATE message SET ui_snoozed = :wakeup" +
" WHERE id = :id")
int setMessageSnoozed(long id, Long wakeup);
@Query("DELETE FROM message WHERE id = :id")
int deleteMessage(long id);