Browse Source

Make new email relative to stored time

main
M66B 6 years ago
parent
commit
d3245ef77f
3 changed files with 13 additions and 4 deletions
  1. +9
    -3
      app/schemas/eu.faircode.email.DB/1.json
  2. +1
    -1
      app/src/main/java/eu/faircode/email/DaoAccount.java
  3. +3
    -0
      app/src/main/java/eu/faircode/email/EntityMessage.java

+ 9
- 3
app/schemas/eu.faircode.email.DB/1.json View File

@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "fc698ded287d449f2781e8efa338554d",
"identityHash": "6213f410bff60ef85d8608f09052327d",
"entities": [
{
"tableName": "identity",
@ -301,7 +301,7 @@
},
{
"tableName": "message",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` INTEGER, `folder` INTEGER NOT NULL, `identity` INTEGER, `replying` INTEGER, `uid` INTEGER, `msgid` TEXT, `references` TEXT, `inreplyto` TEXT, `thread` TEXT, `from` TEXT, `to` TEXT, `cc` TEXT, `bcc` TEXT, `reply` TEXT, `subject` TEXT, `body` TEXT, `sent` INTEGER, `received` INTEGER NOT NULL, `seen` INTEGER NOT NULL, `ui_seen` INTEGER NOT NULL, `ui_hide` INTEGER NOT NULL, `error` TEXT, FOREIGN KEY(`account`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`folder`) REFERENCES `folder`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`identity`) REFERENCES `identity`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`replying`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` INTEGER, `folder` INTEGER NOT NULL, `identity` INTEGER, `replying` INTEGER, `uid` INTEGER, `msgid` TEXT, `references` TEXT, `inreplyto` TEXT, `thread` TEXT, `from` TEXT, `to` TEXT, `cc` TEXT, `bcc` TEXT, `reply` TEXT, `subject` TEXT, `body` TEXT, `sent` INTEGER, `received` INTEGER NOT NULL, `stored` INTEGER NOT NULL, `seen` INTEGER NOT NULL, `ui_seen` INTEGER NOT NULL, `ui_hide` INTEGER NOT NULL, `error` TEXT, FOREIGN KEY(`account`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`folder`) REFERENCES `folder`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`identity`) REFERENCES `identity`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`replying`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
@ -417,6 +417,12 @@
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "stored",
"columnName": "stored",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seen",
"columnName": "seen",
@ -764,7 +770,7 @@
],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"fc698ded287d449f2781e8efa338554d\")"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"6213f410bff60ef85d8608f09052327d\")"
]
}
}

+ 1
- 1
app/src/main/java/eu/faircode/email/DaoAccount.java View File

@ -54,7 +54,7 @@ public interface DaoAccount {
" JOIN account ON account.id = message.account" +
" JOIN folder ON folder.id = message.folder" +
" WHERE NOT message.ui_seen AND NOT message.ui_hide" +
" AND (account.seen_until IS NULL OR message.received > account.seen_until)" +
" AND (account.seen_until IS NULL OR message.stored > account.seen_until)" +
" AND folder.type = '" + EntityFolder.INBOX + "') AS unseen" +
", (SELECT COUNT(message.id) FROM message" +
" JOIN folder ON folder.id = message.folder" +


+ 3
- 0
app/src/main/java/eu/faircode/email/EntityMessage.java View File

@ -19,6 +19,7 @@ package eu.faircode.email;
Copyright 2018 by Marcel Bokhorst (M66B)
*/
import java.util.Date;
import java.util.Random;
import javax.mail.Address;
@ -80,6 +81,8 @@ public class EntityMessage {
@NonNull
public Long received; // compose = stored
@NonNull
public Long stored = new Date().getTime();
@NonNull
public Boolean seen;
@NonNull
public Boolean ui_seen;


Loading…
Cancel
Save