diff --git a/app/src/main/java/eu/faircode/email/DaoMessage.java b/app/src/main/java/eu/faircode/email/DaoMessage.java index 71a255a434..f5d51c0e7a 100644 --- a/app/src/main/java/eu/faircode/email/DaoMessage.java +++ b/app/src/main/java/eu/faircode/email/DaoMessage.java @@ -112,6 +112,7 @@ public interface DaoMessage { " WHEN 'size' = :sort1 THEN -SUM(message.total)" + " WHEN 'attachments' = :sort1 THEN -SUM(message.attachments)" + " WHEN 'snoozed' = :sort1 THEN SUM(CASE WHEN message.ui_snoozed IS NULL THEN 0 ELSE 1 END) = 0" + + " WHEN 'touched' = :sort1 THEN IFNULL(-message.last_attempt, 0)" + " ELSE 0" + " END" + ", CASE" + @@ -191,6 +192,7 @@ public interface DaoMessage { " WHEN 'size' = :sort1 THEN -SUM(message.total)" + " WHEN 'attachments' = :sort1 THEN -SUM(message.attachments)" + " WHEN 'snoozed' = :sort1 THEN SUM(CASE WHEN message.ui_snoozed IS NULL THEN 0 ELSE 1 END) = 0" + + " WHEN 'touched' = :sort1 THEN IFNULL(-message.last_attempt, 0)" + " ELSE 0" + " END" + ", CASE" + diff --git a/app/src/main/java/eu/faircode/email/ViewModelMessages.java b/app/src/main/java/eu/faircode/email/ViewModelMessages.java index 42848d88e5..cc06c63786 100644 --- a/app/src/main/java/eu/faircode/email/ViewModelMessages.java +++ b/app/src/main/java/eu/faircode/email/ViewModelMessages.java @@ -184,7 +184,7 @@ public class ViewModelMessages extends ViewModel { db.message().pagedUnified( null, args.threading, false, - "time", "", false, + criteria == null || criteria.touched == null ? "time" : "touched", "", false, false, false, false, false, false, null, true, @@ -194,7 +194,7 @@ public class ViewModelMessages extends ViewModel { builder = new LivePagedListBuilder<>( db.message().pagedFolder( args.folder, args.threading, - "time", "", false, + criteria == null || criteria.touched == null ? "time" : "touched", "", false, false, false, false, false, false, null, true,