Last touched

pull/215/head
M66B 8 months ago
parent 1fad4ad80c
commit 04fe7b3743

File diff suppressed because it is too large Load Diff

@ -8540,6 +8540,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
same = false;
log("last_attempt changed " + prev.last_attempt + "/" + next.last_attempt, next.id);
}
// last_touched
// accountPop
if (!Objects.equals(prev.accountName, next.accountName)) {

@ -68,7 +68,7 @@ import javax.mail.internet.InternetAddress;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 292,
version = 293,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -2956,6 +2956,12 @@ public abstract class DB extends RoomDatabase {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `identity` ADD COLUMN `envelopeFrom` TEXT");
}
}).addMigrations(new Migration(292, 293) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `message` ADD COLUMN `last_touched` INTEGER");
}
}).addMigrations(new Migration(998, 999) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {

@ -105,7 +105,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)" +
" WHEN 'touched' = :sort1 THEN IFNULL(-message.last_touched, 0)" +
" ELSE 0" +
" END" +
", CASE" +
@ -182,7 +182,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)" +
" WHEN 'touched' = :sort1 THEN IFNULL(-message.last_touched, 0)" +
" ELSE 0" +
" END" +
", CASE" +
@ -379,10 +379,10 @@ public interface DaoMessage {
" AND (:size IS NULL OR total > :size)" +
" AND (:after IS NULL OR received > :after)" +
" AND (:before IS NULL OR received < :before)" +
" AND (:touched IS NULL OR last_attempt > :touched)" +
" AND (:touched IS NULL OR last_touched > :touched)" +
" AND NOT message.folder IN (:exclude)" +
" GROUP BY message.id" +
" ORDER BY CASE WHEN :touched IS NULL THEN received ELSE last_attempt END DESC" +
" ORDER BY CASE WHEN :touched IS NULL THEN received ELSE last_touched END DESC" +
" LIMIT :limit OFFSET :offset")
List<TupleMatch> matchMessages(
Long account, Long folder, long[] exclude, String find,
@ -925,6 +925,9 @@ public interface DaoMessage {
@Query("UPDATE message SET last_attempt = :last_attempt WHERE id = :id AND NOT (last_attempt IS :last_attempt)")
int setMessageLastAttempt(long id, Long last_attempt);
@Query("UPDATE message SET last_touched = :last_touched WHERE id = :id AND NOT (last_touched IS :last_touched)")
int setMessageLastTouched(long id, Long last_touched);
@Query("UPDATE message SET ui_ignored = 1" +
" WHERE NOT ui_ignored" +
" AND account IN (" +

@ -261,7 +261,8 @@ public class EntityMessage implements Serializable {
public Integer revisions; // compose
public String warning; // persistent
public String error; // volatile
public Long last_attempt; // send / last touched
public Long last_attempt; // send
public Long last_touched;
static String generateMessageId() {
return generateMessageId("localhost");

@ -7831,7 +7831,7 @@ public class FragmentMessages extends FragmentBase
}
if (!EntityFolder.OUTBOX.equals(folder.type))
db.message().setMessageLastAttempt(message.id, new Date().getTime());
db.message().setMessageLastTouched(message.id, new Date().getTime());
db.setTransactionSuccessful();
} finally {

Loading…
Cancel
Save