Update ordering query to display content in expected order.

This commit is contained in:
Alex Hart
2022-04-07 12:39:51 -03:00
committed by Cody Henthorne
parent 8d6beb92cb
commit 6354cb194c
2 changed files with 58 additions and 3 deletions

View File

@@ -691,9 +691,11 @@ public class MmsDatabase extends MessageDatabase {
+ "WHERE is_story > 0 AND remote_deleted = 0\n"
+ "ORDER BY\n"
+ "is_unread DESC,\n"
+ "CASE WHEN is_outgoing = 0 AND viewed_receipt_count = 0 THEN mms.date END DESC,\n"
+ "CASE WHEN is_outgoing = 0 AND viewed_receipt_count > 0 THEN receipt_timestamp END DESC,\n"
+ "CASE WHEN is_outgoing = 1 THEN mms.date END DESC";
+ "CASE\n"
+ "WHEN is_outgoing = 0 AND viewed_receipt_count = 0 THEN mms.date\n"
+ "WHEN is_outgoing = 0 AND viewed_receipt_count > 0 THEN receipt_timestamp\n"
+ "WHEN is_outgoing = 1 THEN mms.date\n"
+ "END DESC";
List<StoryResult> results;
try (Cursor cursor = db.rawQuery(query, null)) {