db: indices and keyset windows for hot queries
- Commit
e9ed6a38287db55d8650a28437d2f241ae675cf1- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-21 00:42 UTC (15 days ago)
- Parents
25d4156
Query-plan evidence showed SCAN + temp B-tree on the hot paths: communicate's three cached-message tables (index on conversationId+timestamp, keyset LIMIT windows instead of unbounded loads), securemail (folder/date index + preview projection so lists stop loading bodies; reader loads by id), email (folder/date, account/folder/date and threadId indices, v23), photos (favourites COVERING index, uri index, v22), and ManyManyMatching (leftID/type + rightID/type, music v6). Whole-table filter-in-memory paths in findfamily and launcher became DAO queries. EXPLAIN QUERY PLAN before/after confirms SEARCH-using-index everywhere except launcher's small table (deliberately unindexed). Migrations and regenerated schemas for each bumped database; migration-test fixtures extended where synthetic tables lacked real columns. Verified: email 578, photos 794, findfamily 530, launcher 316, music 132, library 203 tests pass. Two failing suites are other rounds' fallout (securemail friendly-error strings, communicate permission test) handled separately.
Diff
communicate/schemas/com.vayunmathur.communicate.data.rcs.RcsDatabase/4.json
diff --git a/communicate/schemas/com.vayunmathur.communicate.data.rcs.RcsDatabase/4.json b/communicate/schemas/com.vayunmathur.communicate.data.rcs.RcsDatabase/4.jsonnew file mode 100644index 0000000000..987a1f70b2--- /dev/null+++ b/communicate/schemas/com.vayunmathur.communicate.data.rcs.RcsDatabase/4.json@@ -0,0 +1,286 @@+{+ "formatVersion": 1,+ "database": {+ "version": 4,+ "identityHash": "3d0fe0033f8ef4378d492f380672f144",+ "entities": [+ {+ "tableName": "rcs_conversation",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`remoteId` TEXT NOT NULL, `isGroup` INTEGER NOT NULL, `name` TEXT, `participants` TEXT NOT NULL, `unreadCount` INTEGER NOT NULL, `lastMessageTimestamp` INTEGER NOT NULL, PRIMARY KEY(`remoteId`))",+ "fields": [+ {+ "fieldPath": "remoteId",+ "columnName": "remoteId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "isGroup",+ "columnName": "isGroup",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "participants",+ "columnName": "participants",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "unreadCount",+ "columnName": "unreadCount",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMessageTimestamp",+ "columnName": "lastMessageTimestamp",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "remoteId"+ ]+ }+ },+ {+ "tableName": "rcs_cached_message",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`messageId` TEXT NOT NULL, `conversationId` TEXT NOT NULL, `body` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, `outgoing` INTEGER NOT NULL, `senderId` TEXT NOT NULL, `ftUrl` TEXT, `ftMime` TEXT, `status` INTEGER NOT NULL, `imdnId` TEXT NOT NULL, PRIMARY KEY(`messageId`))",+ "fields": [+ {+ "fieldPath": "messageId",+ "columnName": "messageId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "conversationId",+ "columnName": "conversationId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "body",+ "columnName": "body",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "timestamp",+ "columnName": "timestamp",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "outgoing",+ "columnName": "outgoing",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "senderId",+ "columnName": "senderId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "ftUrl",+ "columnName": "ftUrl",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "ftMime",+ "columnName": "ftMime",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "imdnId",+ "columnName": "imdnId",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "messageId"+ ]+ },+ "indices": [+ {+ "name": "index_rcs_cached_message_conversationId_timestamp",+ "unique": false,+ "columnNames": [+ "conversationId",+ "timestamp"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_rcs_cached_message_conversationId_timestamp` ON `${TABLE_NAME}` (`conversationId`, `timestamp`)"+ }+ ]+ },+ {+ "tableName": "rcs_mls_identity",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`e164` TEXT NOT NULL, `identity` BLOB NOT NULL, `updatedAt` INTEGER NOT NULL, `verified` INTEGER NOT NULL, PRIMARY KEY(`e164`))",+ "fields": [+ {+ "fieldPath": "e164",+ "columnName": "e164",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "identity",+ "columnName": "identity",+ "affinity": "BLOB",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updatedAt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "verified",+ "columnName": "verified",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "e164"+ ]+ }+ },+ {+ "tableName": "rcs_mls_group",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`groupIdHex` TEXT NOT NULL, `conversationId` TEXT NOT NULL, `storage` BLOB NOT NULL, `updatedAt` INTEGER NOT NULL, `members` TEXT NOT NULL, PRIMARY KEY(`groupIdHex`))",+ "fields": [+ {+ "fieldPath": "groupIdHex",+ "columnName": "groupIdHex",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "conversationId",+ "columnName": "conversationId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "storage",+ "columnName": "storage",+ "affinity": "BLOB",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updatedAt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "members",+ "columnName": "members",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "groupIdHex"+ ]+ }+ },+ {+ "tableName": "rcs_outbox",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`messageId` TEXT NOT NULL, `conversationId` TEXT NOT NULL, `kind` TEXT NOT NULL, `body` TEXT NOT NULL, `attachments` TEXT NOT NULL, `attempts` INTEGER NOT NULL, `nextRetryMs` INTEGER NOT NULL, `expiryMs` INTEGER NOT NULL, `createdAt` INTEGER NOT NULL, PRIMARY KEY(`messageId`))",+ "fields": [+ {+ "fieldPath": "messageId",+ "columnName": "messageId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "conversationId",+ "columnName": "conversationId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "kind",+ "columnName": "kind",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "body",+ "columnName": "body",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "attachments",+ "columnName": "attachments",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "attempts",+ "columnName": "attempts",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "nextRetryMs",+ "columnName": "nextRetryMs",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "expiryMs",+ "columnName": "expiryMs",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "createdAt",+ "columnName": "createdAt",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "messageId"+ ]+ }+ }+ ],+ "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, '3d0fe0033f8ef4378d492f380672f144')"+ ]+ }+}\ No newline at end of file
communicate/schemas/com.vayunmathur.communicate.data.signal.SignalDatabase/6.json
diff --git a/communicate/schemas/com.vayunmathur.communicate.data.signal.SignalDatabase/6.json b/communicate/schemas/com.vayunmathur.communicate.data.signal.SignalDatabase/6.jsonnew file mode 100644index 0000000000..ad5ce42d53--- /dev/null+++ b/communicate/schemas/com.vayunmathur.communicate.data.signal.SignalDatabase/6.json@@ -0,0 +1,694 @@+{+ "formatVersion": 1,+ "database": {+ "version": 6,+ "identityHash": "f3dd0547532726f096a1ef5dc3a1e2c7",+ "entities": [+ {+ "tableName": "signal_devices",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`deviceId` TEXT NOT NULL, `phoneNumber` TEXT NOT NULL, `pushName` TEXT NOT NULL, `platform` TEXT NOT NULL, `lastSeen` INTEGER NOT NULL, `jid` TEXT NOT NULL, `timezone` TEXT NOT NULL, `loggedInAt` INTEGER NOT NULL, PRIMARY KEY(`deviceId`))",+ "fields": [+ {+ "fieldPath": "deviceId",+ "columnName": "deviceId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "phoneNumber",+ "columnName": "phoneNumber",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "pushName",+ "columnName": "pushName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "platform",+ "columnName": "platform",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastSeen",+ "columnName": "lastSeen",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "jid",+ "columnName": "jid",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "timezone",+ "columnName": "timezone",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "loggedInAt",+ "columnName": "loggedInAt",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "deviceId"+ ]+ }+ },+ {+ "tableName": "signal_sessions",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`jid` TEXT NOT NULL, `sessionData` BLOB NOT NULL, `timestamp` INTEGER NOT NULL, `isPreKey` INTEGER NOT NULL, PRIMARY KEY(`jid`))",+ "fields": [+ {+ "fieldPath": "jid",+ "columnName": "jid",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "sessionData",+ "columnName": "sessionData",+ "affinity": "BLOB",+ "notNull": true+ },+ {+ "fieldPath": "timestamp",+ "columnName": "timestamp",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isPreKey",+ "columnName": "isPreKey",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "jid"+ ]+ }+ },+ {+ "tableName": "signal_conversation",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chatId` TEXT NOT NULL, `isGroup` INTEGER NOT NULL, `name` TEXT, `participants` TEXT NOT NULL, `unreadCount` INTEGER NOT NULL, `lastMessageTimestamp` INTEGER NOT NULL, `archived` INTEGER NOT NULL, `pinned` INTEGER NOT NULL, `groupMasterKey` BLOB, `groupRevision` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`chatId`))",+ "fields": [+ {+ "fieldPath": "chatId",+ "columnName": "chatId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "isGroup",+ "columnName": "isGroup",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "participants",+ "columnName": "participants",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "unreadCount",+ "columnName": "unreadCount",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastMessageTimestamp",+ "columnName": "lastMessageTimestamp",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "archived",+ "columnName": "archived",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "pinned",+ "columnName": "pinned",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "groupMasterKey",+ "columnName": "groupMasterKey",+ "affinity": "BLOB"+ },+ {+ "fieldPath": "groupRevision",+ "columnName": "groupRevision",+ "affinity": "INTEGER",+ "notNull": true,+ "defaultValue": "0"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "chatId"+ ]+ }+ },+ {+ "tableName": "signal_cached_message",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`messageId` TEXT NOT NULL, `conversationId` TEXT NOT NULL, `body` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, `outgoing` INTEGER NOT NULL, `senderId` TEXT NOT NULL, `isEdited` INTEGER NOT NULL, `isRevoked` INTEGER NOT NULL, `mediaUrl` TEXT, `mediaMime` TEXT, `serviceData` TEXT, `status` INTEGER NOT NULL, PRIMARY KEY(`messageId`))",+ "fields": [+ {+ "fieldPath": "messageId",+ "columnName": "messageId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "conversationId",+ "columnName": "conversationId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "body",+ "columnName": "body",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "timestamp",+ "columnName": "timestamp",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "outgoing",+ "columnName": "outgoing",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "senderId",+ "columnName": "senderId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "isEdited",+ "columnName": "isEdited",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isRevoked",+ "columnName": "isRevoked",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "mediaUrl",+ "columnName": "mediaUrl",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "mediaMime",+ "columnName": "mediaMime",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "serviceData",+ "columnName": "serviceData",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "messageId"+ ]+ },+ "indices": [+ {+ "name": "index_signal_cached_message_conversationId_timestamp",+ "unique": false,+ "columnNames": [+ "conversationId",+ "timestamp"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_signal_cached_message_conversationId_timestamp` ON `${TABLE_NAME}` (`conversationId`, `timestamp`)"+ }+ ]+ },+ {+ "tableName": "signal_cached_reaction",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`messageId` TEXT NOT NULL, `emoji` TEXT NOT NULL, `senderId` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, PRIMARY KEY(`messageId`, `senderId`))",+ "fields": [+ {+ "fieldPath": "messageId",+ "columnName": "messageId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "emoji",+ "columnName": "emoji",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "senderId",+ "columnName": "senderId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "timestamp",+ "columnName": "timestamp",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "messageId",+ "senderId"+ ]+ }+ },+ {+ "tableName": "signal_contact",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`aci` TEXT NOT NULL, `phoneE164` TEXT NOT NULL, `displayName` TEXT NOT NULL, `onSignal` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, `pni` TEXT NOT NULL DEFAULT '', PRIMARY KEY(`aci`))",+ "fields": [+ {+ "fieldPath": "aci",+ "columnName": "aci",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "phoneE164",+ "columnName": "phoneE164",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "displayName",+ "columnName": "displayName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "onSignal",+ "columnName": "onSignal",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updatedAt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "pni",+ "columnName": "pni",+ "affinity": "TEXT",+ "notNull": true,+ "defaultValue": "''"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "aci"+ ]+ }+ },+ {+ "tableName": "signal_e2e_sessions",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`address` TEXT NOT NULL, `deviceId` INTEGER NOT NULL, `record` BLOB NOT NULL, PRIMARY KEY(`address`, `deviceId`))",+ "fields": [+ {+ "fieldPath": "address",+ "columnName": "address",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "deviceId",+ "columnName": "deviceId",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "record",+ "columnName": "record",+ "affinity": "BLOB",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "address",+ "deviceId"+ ]+ }+ },+ {+ "tableName": "signal_e2e_identities",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`address` TEXT NOT NULL, `identityKey` BLOB NOT NULL, PRIMARY KEY(`address`))",+ "fields": [+ {+ "fieldPath": "address",+ "columnName": "address",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "identityKey",+ "columnName": "identityKey",+ "affinity": "BLOB",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "address"+ ]+ }+ },+ {+ "tableName": "signal_e2e_pre_keys",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `record` BLOB NOT NULL, `uploaded` INTEGER NOT NULL, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "record",+ "columnName": "record",+ "affinity": "BLOB",+ "notNull": true+ },+ {+ "fieldPath": "uploaded",+ "columnName": "uploaded",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "signal_e2e_signed_pre_keys",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `record` BLOB NOT NULL, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "record",+ "columnName": "record",+ "affinity": "BLOB",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "signal_e2e_kyber_pre_keys",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `record` BLOB NOT NULL, `lastResort` INTEGER NOT NULL, `uploaded` INTEGER NOT NULL, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "record",+ "columnName": "record",+ "affinity": "BLOB",+ "notNull": true+ },+ {+ "fieldPath": "lastResort",+ "columnName": "lastResort",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "uploaded",+ "columnName": "uploaded",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "signal_e2e_kyber_used_base_keys",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`kyberPreKeyId` INTEGER NOT NULL, `signedPreKeyId` INTEGER NOT NULL, `baseKeyB64` TEXT NOT NULL, PRIMARY KEY(`kyberPreKeyId`, `signedPreKeyId`, `baseKeyB64`))",+ "fields": [+ {+ "fieldPath": "kyberPreKeyId",+ "columnName": "kyberPreKeyId",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "signedPreKeyId",+ "columnName": "signedPreKeyId",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "baseKeyB64",+ "columnName": "baseKeyB64",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "kyberPreKeyId",+ "signedPreKeyId",+ "baseKeyB64"+ ]+ }+ },+ {+ "tableName": "signal_e2e_sender_keys",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`address` TEXT NOT NULL, `deviceId` INTEGER NOT NULL, `distributionId` TEXT NOT NULL, `record` BLOB NOT NULL, PRIMARY KEY(`address`, `deviceId`, `distributionId`))",+ "fields": [+ {+ "fieldPath": "address",+ "columnName": "address",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "deviceId",+ "columnName": "deviceId",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "distributionId",+ "columnName": "distributionId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "record",+ "columnName": "record",+ "affinity": "BLOB",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "address",+ "deviceId",+ "distributionId"+ ]+ }+ },+ {+ "tableName": "signal_sender_certificate",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `record` BLOB NOT NULL, `expiration` INTEGER NOT NULL, `includesE164` INTEGER NOT NULL, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "record",+ "columnName": "record",+ "affinity": "BLOB",+ "notNull": true+ },+ {+ "fieldPath": "expiration",+ "columnName": "expiration",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "includesE164",+ "columnName": "includesE164",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "signal_profile_keys",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`address` TEXT NOT NULL, `profileKey` BLOB NOT NULL, PRIMARY KEY(`address`))",+ "fields": [+ {+ "fieldPath": "address",+ "columnName": "address",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "profileKey",+ "columnName": "profileKey",+ "affinity": "BLOB",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "address"+ ]+ }+ },+ {+ "tableName": "signal_call_log",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`callId` TEXT NOT NULL, `peerId` TEXT NOT NULL, `peerName` TEXT NOT NULL, `outgoing` INTEGER NOT NULL, `video` INTEGER NOT NULL, `startTime` INTEGER NOT NULL, `durationSeconds` INTEGER NOT NULL, `outcome` TEXT NOT NULL, PRIMARY KEY(`callId`))",+ "fields": [+ {+ "fieldPath": "callId",+ "columnName": "callId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "peerId",+ "columnName": "peerId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "peerName",+ "columnName": "peerName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "outgoing",+ "columnName": "outgoing",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "video",+ "columnName": "video",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "startTime",+ "columnName": "startTime",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "durationSeconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "outcome",+ "columnName": "outcome",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "callId"+ ]+ }+ }+ ],+ "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, 'f3dd0547532726f096a1ef5dc3a1e2c7')"+ ]+ }+}\ No newline at end of file
communicate/schemas/com.vayunmathur.communicate.data.whatsapp.WhatsAppDatabase/5.json
diff --git a/communicate/schemas/com.vayunmathur.communicate.data.whatsapp.WhatsAppDatabase/5.json b/communicate/schemas/com.vayunmathur.communicate.data.whatsapp.WhatsAppDatabase/5.jsonnew file mode 100644index 0000000000..0679eb0b1e--- /dev/null+++ b/communicate/schemas/com.vayunmathur.communicate.data.whatsapp.WhatsAppDatabase/5.json@@ -0,0 +1,769 @@+{+ "formatVersion": 1,+ "database": {+ "version": 5,+ "identityHash": "2c41f8d9d0410459fcc084da3980fc07",+ "entities": [+ {+ "tableName": "whatsapp_devices",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`deviceId` TEXT NOT NULL, `phoneNumber` TEXT NOT NULL, `pushName` TEXT NOT NULL, `platform` TEXT NOT NULL, `lastSeen` INTEGER NOT NULL, `jid` TEXT NOT NULL, `timezone` TEXT NOT NULL, `loggedInAt` INTEGER NOT NULL, `phoneLastSeen` INTEGER NOT NULL, `phoneLastPinged` INTEGER NOT NULL, `businessName` TEXT NOT NULL, PRIMARY KEY(`deviceId`))",+ "fields": [+ {+ "fieldPath": "deviceId",+ "columnName": "deviceId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "phoneNumber",+ "columnName": "phoneNumber",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "pushName",+ "columnName": "pushName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "platform",+ "columnName": "platform",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastSeen",+ "columnName": "lastSeen",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "jid",+ "columnName": "jid",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "timezone",+ "columnName": "timezone",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "loggedInAt",+ "columnName": "loggedInAt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "phoneLastSeen",+ "columnName": "phoneLastSeen",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "phoneLastPinged",+ "columnName": "phoneLastPinged",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "businessName",+ "columnName": "businessName",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "deviceId"+ ]+ }+ },+ {+ "tableName": "whatsapp_sessions",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`jid` TEXT NOT NULL, `sessionData` BLOB NOT NULL, `timestamp` INTEGER NOT NULL, `isPreKey` INTEGER NOT NULL, PRIMARY KEY(`jid`))",+ "fields": [+ {+ "fieldPath": "jid",+ "columnName": "jid",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "sessionData",+ "columnName": "sessionData",+ "affinity": "BLOB",+ "notNull": true+ },+ {+ "fieldPath": "timestamp",+ "columnName": "timestamp",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isPreKey",+ "columnName": "isPreKey",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "jid"+ ]+ }+ },+ {+ "tableName": "whatsapp_history_sync_conversation",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chatJid` TEXT NOT NULL, `userLoginId` TEXT NOT NULL, `lastMessageTimestamp` INTEGER NOT NULL, `archived` INTEGER NOT NULL, `pinned` INTEGER NOT NULL, `muteEndTime` INTEGER NOT NULL, `endOfHistoryTransferType` INTEGER NOT NULL, `ephemeralExpiration` INTEGER NOT NULL, `ephemeralSettingTimestamp` INTEGER NOT NULL, `markedAsUnread` INTEGER NOT NULL, `unreadCount` INTEGER NOT NULL, `isGroup` INTEGER NOT NULL, `name` TEXT, `participants` TEXT NOT NULL, PRIMARY KEY(`chatJid`))",+ "fields": [+ {+ "fieldPath": "chatJid",+ "columnName": "chatJid",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "userLoginId",+ "columnName": "userLoginId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lastMessageTimestamp",+ "columnName": "lastMessageTimestamp",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "archived",+ "columnName": "archived",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "pinned",+ "columnName": "pinned",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "muteEndTime",+ "columnName": "muteEndTime",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "endOfHistoryTransferType",+ "columnName": "endOfHistoryTransferType",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "ephemeralExpiration",+ "columnName": "ephemeralExpiration",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "ephemeralSettingTimestamp",+ "columnName": "ephemeralSettingTimestamp",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "markedAsUnread",+ "columnName": "markedAsUnread",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "unreadCount",+ "columnName": "unreadCount",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isGroup",+ "columnName": "isGroup",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "participants",+ "columnName": "participants",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "chatJid"+ ]+ }+ },+ {+ "tableName": "whatsapp_media_backfill_request",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`messageId` TEXT NOT NULL, `userLoginId` TEXT NOT NULL, `portalId` TEXT NOT NULL, `portalReceiver` TEXT NOT NULL, `mediaKey` BLOB NOT NULL, `status` INTEGER NOT NULL, `error` TEXT NOT NULL, PRIMARY KEY(`messageId`))",+ "fields": [+ {+ "fieldPath": "messageId",+ "columnName": "messageId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "userLoginId",+ "columnName": "userLoginId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "portalId",+ "columnName": "portalId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "portalReceiver",+ "columnName": "portalReceiver",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "mediaKey",+ "columnName": "mediaKey",+ "affinity": "BLOB",+ "notNull": true+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "error",+ "columnName": "error",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "messageId"+ ]+ }+ },+ {+ "tableName": "whatsapp_avatar_cache",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`entityJid` TEXT NOT NULL, `avatarId` TEXT NOT NULL, `directPath` TEXT NOT NULL, `expiry` INTEGER NOT NULL, `gone` INTEGER NOT NULL, PRIMARY KEY(`entityJid`, `avatarId`))",+ "fields": [+ {+ "fieldPath": "entityJid",+ "columnName": "entityJid",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "avatarId",+ "columnName": "avatarId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "directPath",+ "columnName": "directPath",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "expiry",+ "columnName": "expiry",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "gone",+ "columnName": "gone",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "entityJid",+ "avatarId"+ ]+ }+ },+ {+ "tableName": "whatsapp_poll_option",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`msgId` TEXT NOT NULL, `optionHash` TEXT NOT NULL, `optionName` TEXT NOT NULL, PRIMARY KEY(`msgId`, `optionHash`))",+ "fields": [+ {+ "fieldPath": "msgId",+ "columnName": "msgId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "optionHash",+ "columnName": "optionHash",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "optionName",+ "columnName": "optionName",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "msgId",+ "optionHash"+ ]+ }+ },+ {+ "tableName": "whatsapp_poll_secret",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`msgId` TEXT NOT NULL, `secret` TEXT NOT NULL, PRIMARY KEY(`msgId`))",+ "fields": [+ {+ "fieldPath": "msgId",+ "columnName": "msgId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "secret",+ "columnName": "secret",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "msgId"+ ]+ }+ },+ {+ "tableName": "whatsapp_e2e_sessions",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`address` TEXT NOT NULL, `deviceId` INTEGER NOT NULL, `record` BLOB NOT NULL, PRIMARY KEY(`address`, `deviceId`))",+ "fields": [+ {+ "fieldPath": "address",+ "columnName": "address",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "deviceId",+ "columnName": "deviceId",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "record",+ "columnName": "record",+ "affinity": "BLOB",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "address",+ "deviceId"+ ]+ }+ },+ {+ "tableName": "whatsapp_e2e_identities",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`address` TEXT NOT NULL, `identityKey` BLOB NOT NULL, PRIMARY KEY(`address`))",+ "fields": [+ {+ "fieldPath": "address",+ "columnName": "address",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "identityKey",+ "columnName": "identityKey",+ "affinity": "BLOB",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "address"+ ]+ }+ },+ {+ "tableName": "whatsapp_e2e_pre_keys",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `record` BLOB NOT NULL, `uploaded` INTEGER NOT NULL, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "record",+ "columnName": "record",+ "affinity": "BLOB",+ "notNull": true+ },+ {+ "fieldPath": "uploaded",+ "columnName": "uploaded",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "whatsapp_e2e_signed_pre_keys",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `record` BLOB NOT NULL, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "record",+ "columnName": "record",+ "affinity": "BLOB",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "whatsapp_e2e_sender_keys",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`address` TEXT NOT NULL, `deviceId` INTEGER NOT NULL, `distributionId` TEXT NOT NULL, `record` BLOB NOT NULL, PRIMARY KEY(`address`, `deviceId`, `distributionId`))",+ "fields": [+ {+ "fieldPath": "address",+ "columnName": "address",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "deviceId",+ "columnName": "deviceId",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "distributionId",+ "columnName": "distributionId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "record",+ "columnName": "record",+ "affinity": "BLOB",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "address",+ "deviceId",+ "distributionId"+ ]+ }+ },+ {+ "tableName": "whatsapp_cached_message",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`messageId` TEXT NOT NULL, `conversationJid` TEXT NOT NULL, `body` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, `outgoing` INTEGER NOT NULL, `senderJid` TEXT NOT NULL, `senderName` TEXT NOT NULL, `isEdited` INTEGER NOT NULL, `isRevoked` INTEGER NOT NULL, `quotedMessageId` TEXT, `mediaUrl` TEXT, `mediaMime` TEXT, `mediaName` TEXT, `serviceData` TEXT, `status` INTEGER NOT NULL, PRIMARY KEY(`messageId`))",+ "fields": [+ {+ "fieldPath": "messageId",+ "columnName": "messageId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "conversationJid",+ "columnName": "conversationJid",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "body",+ "columnName": "body",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "timestamp",+ "columnName": "timestamp",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "outgoing",+ "columnName": "outgoing",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "senderJid",+ "columnName": "senderJid",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "senderName",+ "columnName": "senderName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "isEdited",+ "columnName": "isEdited",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isRevoked",+ "columnName": "isRevoked",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "quotedMessageId",+ "columnName": "quotedMessageId",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "mediaUrl",+ "columnName": "mediaUrl",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "mediaMime",+ "columnName": "mediaMime",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "mediaName",+ "columnName": "mediaName",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "serviceData",+ "columnName": "serviceData",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "status",+ "columnName": "status",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "messageId"+ ]+ },+ "indices": [+ {+ "name": "index_whatsapp_cached_message_conversationJid_timestamp",+ "unique": false,+ "columnNames": [+ "conversationJid",+ "timestamp"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_whatsapp_cached_message_conversationJid_timestamp` ON `${TABLE_NAME}` (`conversationJid`, `timestamp`)"+ }+ ]+ },+ {+ "tableName": "whatsapp_cached_reaction",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`messageId` TEXT NOT NULL, `emoji` TEXT NOT NULL, `senderJid` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, PRIMARY KEY(`messageId`, `senderJid`))",+ "fields": [+ {+ "fieldPath": "messageId",+ "columnName": "messageId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "emoji",+ "columnName": "emoji",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "senderJid",+ "columnName": "senderJid",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "timestamp",+ "columnName": "timestamp",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "messageId",+ "senderJid"+ ]+ }+ },+ {+ "tableName": "whatsapp_contact",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`phoneE164` TEXT NOT NULL, `lid` TEXT NOT NULL, `displayName` TEXT NOT NULL, `onWhatsApp` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`phoneE164`))",+ "fields": [+ {+ "fieldPath": "phoneE164",+ "columnName": "phoneE164",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "lid",+ "columnName": "lid",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "displayName",+ "columnName": "displayName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "onWhatsApp",+ "columnName": "onWhatsApp",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updatedAt",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "phoneE164"+ ]+ }+ },+ {+ "tableName": "whatsapp_call_log",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`callId` TEXT NOT NULL, `peerJid` TEXT NOT NULL, `peerName` TEXT NOT NULL, `outgoing` INTEGER NOT NULL, `video` INTEGER NOT NULL, `startTime` INTEGER NOT NULL, `durationSeconds` INTEGER NOT NULL, `outcome` TEXT NOT NULL, PRIMARY KEY(`callId`))",+ "fields": [+ {+ "fieldPath": "callId",+ "columnName": "callId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "peerJid",+ "columnName": "peerJid",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "peerName",+ "columnName": "peerName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "outgoing",+ "columnName": "outgoing",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "video",+ "columnName": "video",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "startTime",+ "columnName": "startTime",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "durationSeconds",+ "columnName": "durationSeconds",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "outcome",+ "columnName": "outcome",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "callId"+ ]+ }+ }+ ],+ "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, '2c41f8d9d0410459fcc084da3980fc07')"+ ]+ }+}\ No newline at end of file
communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositoryRcs.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositoryRcs.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositoryRcs.ktindex 8a4fa083f6..893c29050c 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositoryRcs.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositoryRcs.kt@@ -85,7 +85,7 @@ internal suspend fun CommunicateRepository.loadRcsThreads(context: Context): Lis internal suspend fun CommunicateRepository.loadRcsMessages(context: Context, conversationId: String): List<SmsMessage> = runCatching { val db = RcsDatabase.getDatabase(context)- db.cachedMessageDao().getForConversation(conversationId).map { m ->+ db.cachedMessageDao().getForConversationBefore(conversationId).asReversed().map { m -> SmsMessage( id = (m.messageId.hashCode().toLong() and 0xFFFFFFFFL), threadId = stableThreadId(conversationId),
communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositorySignal.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositorySignal.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositorySignal.ktindex 1e09e98622..7e06d2caf7 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositorySignal.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositorySignal.kt@@ -74,7 +74,7 @@ internal suspend fun CommunicateRepository.loadSignalMessages( conversationId: String): List<SmsMessage> = runCatching { val db = SignalDatabase.getDatabase(context)- db.cachedMessageDao().getForConversation(conversationId).map { m ->+ db.cachedMessageDao().getForConversationBefore(conversationId).asReversed().map { m -> SmsMessage( id = (m.messageId.hashCode().toLong() and 0xFFFFFFFFL), threadId = stableThreadId(conversationId),
communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositoryWhatsApp.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositoryWhatsApp.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositoryWhatsApp.ktindex bb2232f686..a2b73c8735 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositoryWhatsApp.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/CommunicateRepositoryWhatsApp.kt@@ -88,7 +88,7 @@ internal fun CommunicateRepository.parseParticipantsCsv(stored: String?): List<S internal suspend fun CommunicateRepository.loadWhatsAppMessages(context: Context, jid: String): List<SmsMessage> = runCatching { val db = WhatsAppDatabase.getDatabase(context)- db.cachedMessageDao().getForConversation(jid).map { m ->+ db.cachedMessageDao().getForConversationBefore(jid).asReversed().map { m -> SmsMessage( id = (m.messageId.hashCode().toLong() and 0xFFFFFFFFL), threadId = stableThreadId(jid),
communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsDatabase.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsDatabase.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsDatabase.ktindex d3233dd6a3..60f03592a8 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsDatabase.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsDatabase.kt@@ -6,6 +6,7 @@ import androidx.room3.ColumnTypeConverters import androidx.room3.Dao import androidx.room3.Database import androidx.room3.Entity+import androidx.room3.Index import androidx.room3.Insert import androidx.room3.OnConflictStrategy import androidx.room3.PrimaryKey@@ -30,7 +31,7 @@ import com.vayunmathur.library.util.DatabaseMigrations RcsMlsGroup::class, RcsOutboxMessage::class, ],- version = 3,+ version = 4, exportSchema = true, ) @ColumnTypeConverters(RcsTypeConverters::class)@@ -92,7 +93,17 @@ abstract class RcsDatabase : RoomDatabase() { } } - override val migrations = listOf(MIGRATION_1_2, MIGRATION_2_3)+ /** v3 → v4: (conversationId, timestamp) index for keyset conversation windows. */+ private val MIGRATION_3_4 = object : androidx.room3.migration.Migration(3, 4) {+ override suspend fun migrate(connection: androidx.sqlite.SQLiteConnection) {+ connection.execSQL(+ "CREATE INDEX IF NOT EXISTS `index_rcs_cached_message_conversationId_timestamp` " ++ "ON `rcs_cached_message` (`conversationId`, `timestamp`)",+ )+ }+ }++ override val migrations = listOf(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4) /** * Test seam: when set, [getDatabase] returns this instance instead@@ -178,7 +189,7 @@ interface RcsConversationDao { // -- Cached messages -- /** A cached RCS message row, including file-transfer and delivery state. */-@Entity(tableName = "rcs_cached_message")+@Entity(tableName = "rcs_cached_message", indices = [Index(value = ["conversationId", "timestamp"])]) data class RcsCachedMessage( @PrimaryKey val messageId: String, val conversationId: String,@@ -212,6 +223,17 @@ interface RcsCachedMessageDao { @Query("SELECT * FROM rcs_cached_message WHERE conversationId = :id ORDER BY timestamp ASC") suspend fun getForConversation(id: String): List<RcsCachedMessage> + /** Keyset window: newest [limit] before [before], newest first (reverse to render). */+ @Query(+ "SELECT * FROM rcs_cached_message WHERE conversationId = :id AND timestamp < :before " ++ "ORDER BY timestamp DESC LIMIT :limit",+ )+ suspend fun getForConversationBefore(+ id: String,+ before: Long = Long.MAX_VALUE,+ limit: Int = 100,+ ): List<RcsCachedMessage>+ @Query("SELECT * FROM rcs_cached_message WHERE messageId = :messageId LIMIT 1") suspend fun get(messageId: String): RcsCachedMessage?
communicate/src/main/java/com/vayunmathur/communicate/data/signal/SignalDatabase.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/signal/SignalDatabase.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/signal/SignalDatabase.ktindex 43b3ad156a..6b50642ea7 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/signal/SignalDatabase.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/signal/SignalDatabase.kt@@ -7,6 +7,7 @@ import androidx.room3.ColumnTypeConverters import androidx.room3.Dao import androidx.room3.Database import androidx.room3.Entity+import androidx.room3.Index import androidx.room3.Insert import androidx.room3.OnConflictStrategy import androidx.room3.PrimaryKey@@ -42,7 +43,7 @@ import com.vayunmathur.library.util.DatabaseMigrations SignalProfileKey::class, SignalCallLog::class, ],- version = 5,+ version = 6, exportSchema = true ) @ColumnTypeConverters(SignalTypeConverters::class)@@ -139,11 +140,22 @@ abstract class SignalDatabase : RoomDatabase() { } } + /** v5 → v6: (conversationId, timestamp) index for keyset conversation windows. */+ private val MIGRATION_5_6 = object : androidx.room3.migration.Migration(5, 6) {+ override suspend fun migrate(connection: SQLiteConnection) {+ connection.execSQL(+ "CREATE INDEX IF NOT EXISTS `index_signal_cached_message_conversationId_timestamp` " ++ "ON `signal_cached_message` (`conversationId`, `timestamp`)",+ )+ }+ }+ override val migrations = listOf<androidx.room3.migration.Migration>( MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4,- MIGRATION_4_5)+ MIGRATION_4_5,+ MIGRATION_5_6) /** * Test seam: when set, [getDatabase] returns this instance instead@@ -293,7 +305,7 @@ interface SignalConversationDao { // -- Cached messages -- /** A cached Signal message row, including edit/revoke state, media pointer and delivery status. */-@Entity(tableName = "signal_cached_message")+@Entity(tableName = "signal_cached_message", indices = [Index(value = ["conversationId", "timestamp"])]) data class SignalCachedMessage( @PrimaryKey val messageId: String, val conversationId: String,@@ -322,6 +334,21 @@ interface SignalCachedMessageDao { @Query("SELECT * FROM signal_cached_message WHERE conversationId = :id ORDER BY timestamp ASC") suspend fun getForConversation(id: String): List<SignalCachedMessage> + /**+ * Keyset window: the newest [limit] messages before [before] (exclusive),+ * newest first. Callers that render chronologically reverse the result.+ * Served by index_signal_cached_message_conversationId_timestamp.+ */+ @Query(+ "SELECT * FROM signal_cached_message WHERE conversationId = :id AND timestamp < :before " ++ "ORDER BY timestamp DESC LIMIT :limit",+ )+ suspend fun getForConversationBefore(+ id: String,+ before: Long = Long.MAX_VALUE,+ limit: Int = 100,+ ): List<SignalCachedMessage>+ @Query("SELECT * FROM signal_cached_message WHERE messageId = :messageId LIMIT 1") suspend fun get(messageId: String): SignalCachedMessage?
communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppDatabase.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppDatabase.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppDatabase.ktindex c80841ab93..39c19be946 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppDatabase.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/whatsapp/WhatsAppDatabase.kt@@ -6,6 +6,7 @@ import androidx.room3.ColumnTypeConverters import androidx.room3.Database import androidx.room3.Dao import androidx.room3.Entity+import androidx.room3.Index import androidx.room3.Insert import androidx.room3.OnConflictStrategy import androidx.room3.PrimaryKey@@ -51,7 +52,7 @@ import com.vayunmathur.library.util.DatabaseMigrations // communicate v4: call log. WhatsAppCallLog::class, ],- version = 4,+ version = 5, exportSchema = true ) @ColumnTypeConverters(WhatsAppTypeConverters::class)@@ -127,7 +128,17 @@ abstract class WhatsAppDatabase : RoomDatabase() { } } - override val migrations: List<Migration> = listOf(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4)+ /** v4 → v5: (conversationJid, timestamp) index for keyset conversation windows. */+ private val MIGRATION_4_5 = object : Migration(4, 5) {+ override suspend fun migrate(connection: SQLiteConnection) {+ connection.execSQL(+ "CREATE INDEX IF NOT EXISTS `index_whatsapp_cached_message_conversationJid_timestamp` " ++ "ON `whatsapp_cached_message` (`conversationJid`, `timestamp`)",+ )+ }+ }++ override val migrations: List<Migration> = listOf(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, MIGRATION_4_5) /** * Test seam: when set, [getDatabase] returns this instance instead@@ -471,7 +482,7 @@ interface WhatsAppE2ESenderKeyDao { * Cached WhatsApp message for the merged inbox. `serviceData` carries the rich-feature JSON * (reactions/poll/edited/revoked/quoted/group) that [WhatsAppServiceData] serializes. */-@Entity(tableName = "whatsapp_cached_message")+@Entity(tableName = "whatsapp_cached_message", indices = [Index(value = ["conversationJid", "timestamp"])]) data class WhatsAppCachedMessage( @PrimaryKey val messageId: String, val conversationJid: String,@@ -506,6 +517,17 @@ interface WhatsAppCachedMessageDao { @Query("SELECT * FROM whatsapp_cached_message WHERE conversationJid = :jid ORDER BY timestamp ASC") suspend fun getForConversation(jid: String): List<WhatsAppCachedMessage> + /** Keyset window: newest [limit] before [before], newest first (reverse to render). */+ @Query(+ "SELECT * FROM whatsapp_cached_message WHERE conversationJid = :jid AND timestamp < :before " ++ "ORDER BY timestamp DESC LIMIT :limit",+ )+ suspend fun getForConversationBefore(+ jid: String,+ before: Long = Long.MAX_VALUE,+ limit: Int = 100,+ ): List<WhatsAppCachedMessage>+ @Query("SELECT * FROM whatsapp_cached_message WHERE messageId = :messageId LIMIT 1") suspend fun get(messageId: String): WhatsAppCachedMessage?
email/schemas/com.vayunmathur.email.data.EmailDatabase/23.json
diff --git a/email/schemas/com.vayunmathur.email.data.EmailDatabase/23.json b/email/schemas/com.vayunmathur.email.data.EmailDatabase/23.jsonnew file mode 100644index 0000000000..b85a3f1a73--- /dev/null+++ b/email/schemas/com.vayunmathur.email.data.EmailDatabase/23.json@@ -0,0 +1,678 @@+{+ "formatVersion": 1,+ "database": {+ "version": 23,+ "identityHash": "5206c9a643160bbea25d58c9c1a9344c",+ "entities": [+ {+ "tableName": "EmailFolder",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`accountEmail` TEXT NOT NULL, `fullName` TEXT NOT NULL, `name` TEXT NOT NULL, `parentFullName` TEXT, `holdsMessages` INTEGER NOT NULL, `delimiter` TEXT NOT NULL, PRIMARY KEY(`accountEmail`, `fullName`))",+ "fields": [+ {+ "fieldPath": "accountEmail",+ "columnName": "accountEmail",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "fullName",+ "columnName": "fullName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "name",+ "columnName": "name",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "parentFullName",+ "columnName": "parentFullName",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "holdsMessages",+ "columnName": "holdsMessages",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "delimiter",+ "columnName": "delimiter",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "accountEmail",+ "fullName"+ ]+ }+ },+ {+ "tableName": "EmailMessage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`accountEmail` TEXT NOT NULL, `folderName` TEXT NOT NULL, `id` INTEGER NOT NULL, `serverId` TEXT, `threadId` TEXT, `subject` TEXT NOT NULL, `from` TEXT NOT NULL, `to` TEXT, `cc` TEXT, `date` TEXT NOT NULL, `dateMillis` INTEGER NOT NULL, `body` TEXT, `isHtml` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `references` TEXT, `hasAttachments` INTEGER NOT NULL, `snoozedUntil` INTEGER NOT NULL, `listUnsubscribe` TEXT, `listUnsubscribePost` TEXT, `peekContent` TEXT NOT NULL DEFAULT '', PRIMARY KEY(`accountEmail`, `folderName`, `id`))",+ "fields": [+ {+ "fieldPath": "accountEmail",+ "columnName": "accountEmail",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "folderName",+ "columnName": "folderName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "serverId",+ "columnName": "serverId",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "threadId",+ "columnName": "threadId",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "subject",+ "columnName": "subject",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "from",+ "columnName": "from",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "to",+ "columnName": "to",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "cc",+ "columnName": "cc",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "date",+ "columnName": "date",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "dateMillis",+ "columnName": "dateMillis",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "body",+ "columnName": "body",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "isHtml",+ "columnName": "isHtml",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isRead",+ "columnName": "isRead",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "references",+ "columnName": "references",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "hasAttachments",+ "columnName": "hasAttachments",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "snoozedUntil",+ "columnName": "snoozedUntil",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "listUnsubscribe",+ "columnName": "listUnsubscribe",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "listUnsubscribePost",+ "columnName": "listUnsubscribePost",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "peekContent",+ "columnName": "peekContent",+ "affinity": "TEXT",+ "notNull": true,+ "defaultValue": "''"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "accountEmail",+ "folderName",+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_EmailMessage_folderName_dateMillis",+ "unique": false,+ "columnNames": [+ "folderName",+ "dateMillis"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_EmailMessage_folderName_dateMillis` ON `${TABLE_NAME}` (`folderName`, `dateMillis`)"+ },+ {+ "name": "index_EmailMessage_accountEmail_folderName_dateMillis",+ "unique": false,+ "columnNames": [+ "accountEmail",+ "folderName",+ "dateMillis"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_EmailMessage_accountEmail_folderName_dateMillis` ON `${TABLE_NAME}` (`accountEmail`, `folderName`, `dateMillis`)"+ },+ {+ "name": "index_EmailMessage_threadId",+ "unique": false,+ "columnNames": [+ "threadId"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_EmailMessage_threadId` ON `${TABLE_NAME}` (`threadId`)"+ }+ ]+ },+ {+ "tableName": "EmailAccount",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`email` TEXT NOT NULL, `accessToken` TEXT NOT NULL, `refreshToken` TEXT, `expiresAt` INTEGER NOT NULL, `provider` TEXT NOT NULL DEFAULT 'gmail', `imapHost` TEXT NOT NULL DEFAULT 'imap.gmail.com', `imapPort` INTEGER NOT NULL DEFAULT 993, `imapUseSsl` INTEGER NOT NULL DEFAULT 1, `smtpHost` TEXT NOT NULL DEFAULT 'smtp.gmail.com', `smtpPort` INTEGER NOT NULL DEFAULT 465, `smtpUseSsl` INTEGER NOT NULL DEFAULT 1, `username` TEXT NOT NULL DEFAULT '', `authType` TEXT NOT NULL DEFAULT 'oauth2', `passwordEncrypted` BLOB, `passwordIv` BLOB, `signature` TEXT NOT NULL DEFAULT '', `allowInsecureCertificates` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`email`))",+ "fields": [+ {+ "fieldPath": "email",+ "columnName": "email",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "accessToken",+ "columnName": "accessToken",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "refreshToken",+ "columnName": "refreshToken",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "expiresAt",+ "columnName": "expiresAt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "provider",+ "columnName": "provider",+ "affinity": "TEXT",+ "notNull": true,+ "defaultValue": "'gmail'"+ },+ {+ "fieldPath": "imapHost",+ "columnName": "imapHost",+ "affinity": "TEXT",+ "notNull": true,+ "defaultValue": "'imap.gmail.com'"+ },+ {+ "fieldPath": "imapPort",+ "columnName": "imapPort",+ "affinity": "INTEGER",+ "notNull": true,+ "defaultValue": "993"+ },+ {+ "fieldPath": "imapUseSsl",+ "columnName": "imapUseSsl",+ "affinity": "INTEGER",+ "notNull": true,+ "defaultValue": "1"+ },+ {+ "fieldPath": "smtpHost",+ "columnName": "smtpHost",+ "affinity": "TEXT",+ "notNull": true,+ "defaultValue": "'smtp.gmail.com'"+ },+ {+ "fieldPath": "smtpPort",+ "columnName": "smtpPort",+ "affinity": "INTEGER",+ "notNull": true,+ "defaultValue": "465"+ },+ {+ "fieldPath": "smtpUseSsl",+ "columnName": "smtpUseSsl",+ "affinity": "INTEGER",+ "notNull": true,+ "defaultValue": "1"+ },+ {+ "fieldPath": "username",+ "columnName": "username",+ "affinity": "TEXT",+ "notNull": true,+ "defaultValue": "''"+ },+ {+ "fieldPath": "authType",+ "columnName": "authType",+ "affinity": "TEXT",+ "notNull": true,+ "defaultValue": "'oauth2'"+ },+ {+ "fieldPath": "passwordEncrypted",+ "columnName": "passwordEncrypted",+ "affinity": "BLOB"+ },+ {+ "fieldPath": "passwordIv",+ "columnName": "passwordIv",+ "affinity": "BLOB"+ },+ {+ "fieldPath": "signature",+ "columnName": "signature",+ "affinity": "TEXT",+ "notNull": true,+ "defaultValue": "''"+ },+ {+ "fieldPath": "allowInsecureCertificates",+ "columnName": "allowInsecureCertificates",+ "affinity": "INTEGER",+ "notNull": true,+ "defaultValue": "0"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "email"+ ]+ }+ },+ {+ "tableName": "Attachment",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`accountEmail` TEXT NOT NULL, `folderName` TEXT NOT NULL, `messageId` INTEGER NOT NULL, `partId` TEXT NOT NULL, `fileName` TEXT NOT NULL, `mimeType` TEXT NOT NULL, `size` INTEGER NOT NULL, `localUri` TEXT, PRIMARY KEY(`accountEmail`, `messageId`, `partId`))",+ "fields": [+ {+ "fieldPath": "accountEmail",+ "columnName": "accountEmail",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "folderName",+ "columnName": "folderName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "messageId",+ "columnName": "messageId",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "partId",+ "columnName": "partId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "fileName",+ "columnName": "fileName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "mimeType",+ "columnName": "mimeType",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "size",+ "columnName": "size",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "localUri",+ "columnName": "localUri",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "accountEmail",+ "messageId",+ "partId"+ ]+ }+ },+ {+ "tableName": "OutboxEntry",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `accountEmail` TEXT NOT NULL, `to` TEXT NOT NULL, `cc` TEXT, `bcc` TEXT, `subject` TEXT NOT NULL, `body` TEXT NOT NULL, `attachmentLocalPaths` TEXT NOT NULL, `inlineImageJson` TEXT NOT NULL DEFAULT '[]', `inReplyTo` TEXT, `references` TEXT, `createdAt` INTEGER NOT NULL, `lastError` TEXT, `attemptCount` INTEGER NOT NULL, `lastAttemptAt` INTEGER NOT NULL, `scheduledAt` INTEGER NOT NULL, `isHtml` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "accountEmail",+ "columnName": "accountEmail",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "to",+ "columnName": "to",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "cc",+ "columnName": "cc",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "bcc",+ "columnName": "bcc",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "subject",+ "columnName": "subject",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "body",+ "columnName": "body",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "attachmentLocalPaths",+ "columnName": "attachmentLocalPaths",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "inlineImageJson",+ "columnName": "inlineImageJson",+ "affinity": "TEXT",+ "notNull": true,+ "defaultValue": "'[]'"+ },+ {+ "fieldPath": "inReplyTo",+ "columnName": "inReplyTo",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "references",+ "columnName": "references",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "createdAt",+ "columnName": "createdAt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastError",+ "columnName": "lastError",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "attemptCount",+ "columnName": "attemptCount",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "lastAttemptAt",+ "columnName": "lastAttemptAt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "scheduledAt",+ "columnName": "scheduledAt",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isHtml",+ "columnName": "isHtml",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "DraftEntry",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `accountEmail` TEXT NOT NULL, `to` TEXT NOT NULL, `cc` TEXT NOT NULL, `bcc` TEXT NOT NULL, `subject` TEXT NOT NULL, `body` TEXT NOT NULL, `inlineImageJson` TEXT NOT NULL DEFAULT '[]', `updatedAt` INTEGER NOT NULL)",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "accountEmail",+ "columnName": "accountEmail",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "to",+ "columnName": "to",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "cc",+ "columnName": "cc",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "bcc",+ "columnName": "bcc",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "subject",+ "columnName": "subject",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "body",+ "columnName": "body",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "inlineImageJson",+ "columnName": "inlineImageJson",+ "affinity": "TEXT",+ "notNull": true,+ "defaultValue": "'[]'"+ },+ {+ "fieldPath": "updatedAt",+ "columnName": "updatedAt",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "id"+ ]+ }+ },+ {+ "tableName": "BlockedSender",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`address` TEXT NOT NULL, PRIMARY KEY(`address`))",+ "fields": [+ {+ "fieldPath": "address",+ "columnName": "address",+ "affinity": "TEXT",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "address"+ ]+ }+ },+ {+ "tableName": "DeletedUid",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`accountEmail` TEXT NOT NULL, `folderName` TEXT NOT NULL, `uid` INTEGER NOT NULL, PRIMARY KEY(`accountEmail`, `folderName`, `uid`))",+ "fields": [+ {+ "fieldPath": "accountEmail",+ "columnName": "accountEmail",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "folderName",+ "columnName": "folderName",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "uid",+ "columnName": "uid",+ "affinity": "INTEGER",+ "notNull": true+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "accountEmail",+ "folderName",+ "uid"+ ]+ }+ },+ {+ "tableName": "EmailMessageFts",+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`subject` TEXT NOT NULL, `from` TEXT NOT NULL, `body` TEXT, tokenize=unicode61 `remove_diacritics=1`, content=`EmailMessage`)",+ "fields": [+ {+ "fieldPath": "subject",+ "columnName": "subject",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "from",+ "columnName": "from",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "body",+ "columnName": "body",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": true,+ "columnNames": [+ "rowid"+ ]+ },+ "ftsVersion": "FTS4",+ "ftsOptions": {+ "tokenizer": "unicode61",+ "tokenizerArgs": [+ "remove_diacritics=1"+ ],+ "contentTable": "EmailMessage",+ "languageIdColumnName": "",+ "matchInfo": "FTS4",+ "notIndexedColumns": [],+ "prefixSizes": [],+ "preferredOrder": "ASC"+ },+ "contentSyncTriggers": [+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_EmailMessageFts_BEFORE_UPDATE BEFORE UPDATE ON `EmailMessage` BEGIN DELETE FROM `EmailMessageFts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_EmailMessageFts_BEFORE_DELETE BEFORE DELETE ON `EmailMessage` BEGIN DELETE FROM `EmailMessageFts` WHERE `docid`=OLD.`rowid`; END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_EmailMessageFts_AFTER_UPDATE AFTER UPDATE ON `EmailMessage` BEGIN INSERT INTO `EmailMessageFts`(`docid`, `subject`, `from`, `body`) VALUES (NEW.`rowid`, NEW.`subject`, NEW.`from`, NEW.`body`); END",+ "CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_EmailMessageFts_AFTER_INSERT AFTER INSERT ON `EmailMessage` BEGIN INSERT INTO `EmailMessageFts`(`docid`, `subject`, `from`, `body`) VALUES (NEW.`rowid`, NEW.`subject`, NEW.`from`, NEW.`body`); END"+ ]+ }+ ],+ "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, '5206c9a643160bbea25d58c9c1a9344c')"+ ]+ }+}\ No newline at end of file
email/src/main/java/com/vayunmathur/email/data/EmailDatabase.kt
diff --git a/email/src/main/java/com/vayunmathur/email/data/EmailDatabase.kt b/email/src/main/java/com/vayunmathur/email/data/EmailDatabase.ktindex 880999a12a..45cffc1e8e 100644--- a/email/src/main/java/com/vayunmathur/email/data/EmailDatabase.kt+++ b/email/src/main/java/com/vayunmathur/email/data/EmailDatabase.kt@@ -27,7 +27,7 @@ import com.vayunmathur.email.data.Attachment DeletedUid::class, EmailMessageFts::class, ],- version = 22,+ version = 23, exportSchema = true, ) /** Room database holding email folders, messages, accounts and outbox state. */@@ -222,6 +222,21 @@ abstract class EmailDatabase : RoomDatabase() { it.execSQL("INSERT INTO `EmailMessageFts`(`EmailMessageFts`) VALUES('rebuild')") } + /** v22 → v23: indices for folder/unified/thread reads ordered by dateMillis. */+ private val MIGRATION_22_23 = Migration(22, 23) {+ it.execSQL(+ "CREATE INDEX IF NOT EXISTS `index_EmailMessage_folderName_dateMillis` " ++ "ON `EmailMessage` (`folderName`, `dateMillis`)",+ )+ it.execSQL(+ "CREATE INDEX IF NOT EXISTS `index_EmailMessage_accountEmail_folderName_dateMillis` " ++ "ON `EmailMessage` (`accountEmail`, `folderName`, `dateMillis`)",+ )+ it.execSQL(+ "CREATE INDEX IF NOT EXISTS `index_EmailMessage_threadId` ON `EmailMessage` (`threadId`)",+ )+ }+ /** * Every migration for this database, registered with the Room builder via the * [DatabaseMigrations] reflection hook in `openRoomDatabase`. Order is@@ -246,6 +261,7 @@ abstract class EmailDatabase : RoomDatabase() { MIGRATION_19_20, MIGRATION_20_21, MIGRATION_21_22,+ MIGRATION_22_23, ) fun getInstance(context: Context): EmailDatabase =
email/src/main/java/com/vayunmathur/email/data/EmailModels.kt
diff --git a/email/src/main/java/com/vayunmathur/email/data/EmailModels.kt b/email/src/main/java/com/vayunmathur/email/data/EmailModels.ktindex b165dedb40..b58530a354 100644--- a/email/src/main/java/com/vayunmathur/email/data/EmailModels.kt+++ b/email/src/main/java/com/vayunmathur/email/data/EmailModels.kt@@ -2,6 +2,7 @@ package com.vayunmathur.email.data import androidx.room3.ColumnInfo import androidx.room3.Entity+import androidx.room3.Index import androidx.room3.PrimaryKey import androidx.core.text.HtmlCompat import kotlinx.serialization.Serializable@@ -20,7 +21,14 @@ data class EmailFolder( ) @Serializable-@Entity(primaryKeys = ["accountEmail", "folderName", "id"])+@Entity(+ primaryKeys = ["accountEmail", "folderName", "id"],+ indices = [+ Index(value = ["folderName", "dateMillis"]),+ Index(value = ["accountEmail", "folderName", "dateMillis"]),+ Index(value = ["threadId"]),+ ],+) /** A stored email message keyed by account, folder and IMAP UID. */ data class EmailMessage( val accountEmail: String,
email/src/main/java/com/vayunmathur/email/ui/AddAccountFormScreen.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/AddAccountFormScreen.kt b/email/src/main/java/com/vayunmathur/email/ui/AddAccountFormScreen.ktindex 743acb42f0..46eb54fd58 100644--- a/email/src/main/java/com/vayunmathur/email/ui/AddAccountFormScreen.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/AddAccountFormScreen.kt@@ -28,6 +28,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.unit.dp@@ -128,7 +129,7 @@ private fun OutlookOAuthForm( label = { Text(stringResource(R.string.email_address_optional)) }, placeholder = { Text("Optional — pre-fills Microsoft login") }, singleLine = true,- keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email),+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email, imeAction = ImeAction.Next), modifier = Modifier.fillMaxWidth(), ) @@ -153,7 +154,7 @@ private fun OutlookOAuthForm( label = { Text(stringResource(R.string.app_password)) }, singleLine = true, visualTransformation = if (appPasswordVisible) androidx.compose.ui.text.input.VisualTransformation.None else PasswordVisualTransformation(),- keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password, imeAction = ImeAction.Done), trailingIcon = { TextButton(onClick = { appPasswordVisible = !appPasswordVisible }) { Text(if (appPasswordVisible) stringResource(R.string.hide) else stringResource(R.string.show))@@ -234,14 +235,14 @@ private fun PasswordForm( ) { if (preset.instructions.isNotEmpty()) { InstructionsCard(preset = preset) } - OutlinedTextField(value = email, onValueChange = { email = it.trim() }, label = { Text(stringResource(R.string.email_address)) }, singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email), modifier = Modifier.fillMaxWidth())+ OutlinedTextField(value = email, onValueChange = { email = it.trim() }, label = { Text(stringResource(R.string.email_address)) }, singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email, imeAction = ImeAction.Next), modifier = Modifier.fillMaxWidth()) if (preset.id == PROVIDER_CUSTOM) { Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.clickable { useDifferentUsername = !useDifferentUsername }) { Checkbox(checked = useDifferentUsername, onCheckedChange = { useDifferentUsername = it }) Text(stringResource(R.string.username_is_not_my_email), style = MaterialTheme.typography.bodyMedium) } if (useDifferentUsername) {- OutlinedTextField(value = username, onValueChange = { username = it.trim() }, label = { Text(stringResource(R.string.username)) }, singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Ascii), modifier = Modifier.fillMaxWidth())+ OutlinedTextField(value = username, onValueChange = { username = it.trim() }, label = { Text(stringResource(R.string.username)) }, singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Ascii, imeAction = ImeAction.Next), modifier = Modifier.fillMaxWidth()) } } OutlinedTextField(@@ -250,7 +251,10 @@ private fun PasswordForm( label = { Text(if (preset.id == PROVIDER_CUSTOM) stringResource(R.string.password) else stringResource(R.string.app_password)) }, singleLine = true, visualTransformation = if (passwordVisible) androidx.compose.ui.text.input.VisualTransformation.None else PasswordVisualTransformation(),- keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),+ keyboardOptions = KeyboardOptions(+ keyboardType = KeyboardType.Password,+ imeAction = if (preset.id == PROVIDER_CUSTOM) ImeAction.Next else ImeAction.Done,+ ), trailingIcon = { TextButton(onClick = { passwordVisible = !passwordVisible }) { Text(if (passwordVisible) stringResource(R.string.hide) else stringResource(R.string.show)) } },@@ -261,7 +265,7 @@ private fun PasswordForm( Text(stringResource(R.string.imap_incoming), style = MaterialTheme.typography.titleSmall, fontWeight = FontWeight.SemiBold) AddAccountSection(host = imapHost, onHostChange = { imapHost = it.trim() }, port = imapPort, onPortChange = { imapPort = it.filter(Char::isDigit) }, useSsl = imapUseSsl, onSslChange = { imapUseSsl = it }) Text(stringResource(R.string.smtp_outgoing), style = MaterialTheme.typography.titleSmall, fontWeight = FontWeight.SemiBold)- AddAccountSection(host = smtpHost, onHostChange = { smtpHost = it.trim() }, port = smtpPort, onPortChange = { smtpPort = it.filter(Char::isDigit) }, useSsl = smtpUseSsl, onSslChange = { smtpUseSsl = it })+ AddAccountSection(host = smtpHost, onHostChange = { smtpHost = it.trim() }, port = smtpPort, onPortChange = { smtpPort = it.filter(Char::isDigit) }, useSsl = smtpUseSsl, onSslChange = { smtpUseSsl = it }, portImeAction = ImeAction.Done) Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.clickable { allowInsecureCerts = !allowInsecureCerts }) { Checkbox(checked = allowInsecureCerts, onCheckedChange = { allowInsecureCerts = it }) Text(stringResource(R.string.allow_insecure_certificates), style = MaterialTheme.typography.bodyMedium)
email/src/main/java/com/vayunmathur/email/ui/AddAccountSection.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/AddAccountSection.kt b/email/src/main/java/com/vayunmathur/email/ui/AddAccountSection.ktindex f409e1b35d..5218ed5569 100644--- a/email/src/main/java/com/vayunmathur/email/ui/AddAccountSection.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/AddAccountSection.kt@@ -10,6 +10,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp import com.vayunmathur.email.R@@ -28,10 +29,10 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @Composable-fun AddAccountSection(host: String, onHostChange: (String) -> Unit, port: String, onPortChange: (String) -> Unit, useSsl: Boolean, onSslChange: (Boolean) -> Unit) {+fun AddAccountSection(host: String, onHostChange: (String) -> Unit, port: String, onPortChange: (String) -> Unit, useSsl: Boolean, onSslChange: (Boolean) -> Unit, portImeAction: ImeAction = ImeAction.Next) { Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {- OutlinedTextField(value = host, onValueChange = onHostChange, label = { Text(stringResource(R.string.host_label)) }, singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri), modifier = Modifier.weight(2f))- OutlinedTextField(value = port, onValueChange = onPortChange, label = { Text(stringResource(R.string.port_label)) }, singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), modifier = Modifier.weight(1f))+ OutlinedTextField(value = host, onValueChange = onHostChange, label = { Text(stringResource(R.string.host_label)) }, singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri, imeAction = ImeAction.Next), modifier = Modifier.weight(2f))+ OutlinedTextField(value = port, onValueChange = onPortChange, label = { Text(stringResource(R.string.port_label)) }, singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number, imeAction = portImeAction), modifier = Modifier.weight(1f)) } Row(verticalAlignment = Alignment.CenterVertically) { Text(stringResource(R.string.security), modifier = Modifier.padding(end = 8.dp))
email/src/main/java/com/vayunmathur/email/ui/ComposerHeader.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/ComposerHeader.kt b/email/src/main/java/com/vayunmathur/email/ui/ComposerHeader.ktindex f242d70374..cc9926f509 100644--- a/email/src/main/java/com/vayunmathur/email/ui/ComposerHeader.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/ComposerHeader.kt@@ -10,6 +10,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.foundation.text.KeyboardOptions+import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp import com.vayunmathur.email.R@@ -100,7 +101,7 @@ fun ComposerHeaderSection( label = { Text(stringResource(R.string.to_label)) }, trailingIcon = { IconButton(onClick = { onPickContact(0) }) { com.vayunmathur.library.ui.IconAdd() } }, singleLine = true,- keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email),+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email, imeAction = ImeAction.Next), textStyle = MaterialTheme.typography.bodyMedium, modifier = Modifier.weight(1f), )@@ -111,7 +112,7 @@ fun ComposerHeaderSection( value = cc, onValueChange = onCcChange, label = { Text(stringResource(R.string.cc)) }, trailingIcon = { IconButton(onClick = { onPickContact(1) }) { com.vayunmathur.library.ui.IconAdd() } }, singleLine = true,- keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email),+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email, imeAction = ImeAction.Next), textStyle = MaterialTheme.typography.bodyMedium, modifier = Modifier.fillMaxWidth(), )@@ -119,7 +120,7 @@ fun ComposerHeaderSection( value = bcc, onValueChange = onBccChange, label = { Text(stringResource(R.string.bcc)) }, trailingIcon = { IconButton(onClick = { onPickContact(2) }) { com.vayunmathur.library.ui.IconAdd() } }, singleLine = true,- keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email),+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email, imeAction = ImeAction.Next), textStyle = MaterialTheme.typography.bodyMedium, modifier = Modifier.fillMaxWidth(), )
email/src/main/java/com/vayunmathur/email/ui/ComposerScreen.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/ComposerScreen.kt b/email/src/main/java/com/vayunmathur/email/ui/ComposerScreen.ktindex 50fc9fbd1b..ebbf422ad2 100644--- a/email/src/main/java/com/vayunmathur/email/ui/ComposerScreen.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/ComposerScreen.kt@@ -30,6 +30,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalResources import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vayunmathur.email.R@@ -252,6 +253,10 @@ fun ComposerScreen( DropdownMenuItem(text = { Text(stringResource(R.string.tomorrow_8_am)) }, onClick = { schedule(scheduleTime(8, sameDay = false)) }) } }+ // Mirror securemail's ComposeScreen gate: Send needs at least+ // one recipient and a non-blank body (HTML stripped for the check).+ val hasRecipient = to.isNotBlank() || cc.isNotBlank() || bcc.isNotBlank()+ val hasBody = bodyController.html.replace(Regex("<[^>]*>"), "").isNotBlank() IconButton(onClick = { val acc = fromAccount ?: return@IconButton sending = true@@ -279,7 +284,7 @@ fun ComposerScreen( onBack() } )- }, enabled = !sending && fromAccount != null) {+ }, enabled = !sending && fromAccount != null && hasRecipient && hasBody) { if (sending) CircularProgressIndicator(modifier = Modifier.size(24.dp)) else IconSend() }@@ -326,6 +331,7 @@ fun ComposerScreen( onValueChange = { subject = it }, label = stringResource(R.string.subject_label), modifier = Modifier.fillMaxWidth(),+ imeAction = ImeAction.Next, sharedTextKey = draftId?.let { "email-draft-subject-$it" }, )
email/src/test/java/com/vayunmathur/email/data/EmailMigrationsW5Test.kt
diff --git a/email/src/test/java/com/vayunmathur/email/data/EmailMigrationsW5Test.kt b/email/src/test/java/com/vayunmathur/email/data/EmailMigrationsW5Test.ktindex f86af62e38..c813771a14 100644--- a/email/src/test/java/com/vayunmathur/email/data/EmailMigrationsW5Test.kt+++ b/email/src/test/java/com/vayunmathur/email/data/EmailMigrationsW5Test.kt@@ -15,7 +15,7 @@ class EmailMigrationsW5Test { private fun openV4(): SQLiteConnection { val conn = AndroidSQLiteDriver().open(":memory:")- conn.execSQL("CREATE TABLE EmailMessage (accountEmail TEXT NOT NULL, folderName TEXT NOT NULL, id INTEGER NOT NULL, subject TEXT, `from` TEXT, body TEXT)")+ conn.execSQL("CREATE TABLE EmailMessage (accountEmail TEXT NOT NULL, folderName TEXT NOT NULL, id INTEGER NOT NULL, threadId TEXT, subject TEXT, `from` TEXT, body TEXT)") conn.execSQL("CREATE TABLE EmailAccount (email TEXT NOT NULL PRIMARY KEY)") conn.execSQL("CREATE TABLE EmailFolder (accountEmail TEXT NOT NULL, fullName TEXT NOT NULL, parentFullName TEXT)") conn.execSQL("CREATE TABLE Attachment (accountEmail TEXT NOT NULL, folderName TEXT NOT NULL, messageId INTEGER NOT NULL)")@@ -54,7 +54,7 @@ class EmailMigrationsW5Test { @Test fun migrationChainIsCompleteAndOrdered() { assertEquals(- (4..21).map { it to it + 1 },+ (4..22).map { it to it + 1 }, EmailDatabase.migrations.map { it.startVersion to it.endVersion }.sortedBy { it.first }, ) }@@ -86,7 +86,7 @@ class EmailMigrationsW5Test { } @Test- fun v4DatabaseUpgradesToV22Shape() {+ fun v4DatabaseUpgradesToV23Shape() { val conn = openV4() migrate(conn, 4) assertTrue(tableExists(conn, "OutboxEntry"))
findfamily/src/main/java/com/vayunmathur/findfamily/data/FindFamilyRepository.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/data/FindFamilyRepository.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/data/FindFamilyRepository.ktindex 6d1d50a8bf..d1ca42e599 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/data/FindFamilyRepository.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/data/FindFamilyRepository.kt@@ -180,6 +180,9 @@ internal class NoShowAlertStore(private val dao: NoShowAlertDao) { val allFlow: Flow<List<NoShowAlert>> get() = dao.getAllFlow() suspend fun get(id: Long): NoShowAlert? = dao.get(id) suspend fun getAll(): List<NoShowAlert> = dao.getAll()+ suspend fun getByWatchedUserId(watchedUserId: Long): List<NoShowAlert> = dao.getByWatchedUserId(watchedUserId)+ suspend fun getByWaypointId(waypointId: Long): List<NoShowAlert> = dao.getByWaypointId(waypointId)+ suspend fun getPending(): List<NoShowAlert> = dao.getPending() suspend fun getDue(nowEpochSeconds: Long): List<NoShowAlert> = dao.getDue(nowEpochSeconds) suspend fun upsert(alert: NoShowAlert): Long = dao.upsert(alert) suspend fun delete(alert: NoShowAlert): Int = dao.delete(alert)
findfamily/src/main/java/com/vayunmathur/findfamily/data/NoShowAlertDao.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/data/NoShowAlertDao.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/data/NoShowAlertDao.ktindex c1aabd9509..8dec555b6c 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/data/NoShowAlertDao.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/data/NoShowAlertDao.kt@@ -18,6 +18,16 @@ interface NoShowAlertDao { @Query("SELECT * FROM NoShowAlert") suspend fun getAll(): List<NoShowAlert> + @Query("SELECT * FROM NoShowAlert WHERE watchedUserId = :watchedUserId")+ suspend fun getByWatchedUserId(watchedUserId: Long): List<NoShowAlert>++ @Query("SELECT * FROM NoShowAlert WHERE waypointId = :waypointId")+ suspend fun getByWaypointId(waypointId: Long): List<NoShowAlert>++ /** Not-yet-fired alerts (the scheduler's pending set). */+ @Query("SELECT * FROM NoShowAlert WHERE fired = 0")+ suspend fun getPending(): List<NoShowAlert>+ @Query("SELECT * FROM NoShowAlert WHERE id = :id") suspend fun get(id: Long): NoShowAlert?
findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyViewModel.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyViewModel.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyViewModel.ktindex db3b0bdfb0..82375141f5 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyViewModel.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyViewModel.kt@@ -139,8 +139,7 @@ class FindFamilyViewModel( // Cancel pending no-show work before the cascade deletes its rows, // so no orphan WorkManager job fires for a removed person. runCatching {- repository.noShowAlertStore.getAll()- .filter { it.watchedUserId == user.id }+ repository.noShowAlertStore.getByWatchedUserId(user.id) .forEach { NoShowCheckScheduler.cancel(ctx, it.id) } } repository.deleteUser(user)@@ -210,8 +209,7 @@ class FindFamilyViewModel( fun deleteWaypoint(waypoint: Waypoint) { viewModelScope.launch(Dispatchers.IO) { runCatching {- repository.noShowAlertStore.getAll()- .filter { it.waypointId == waypoint.id }+ repository.noShowAlertStore.getByWaypointId(waypoint.id) .forEach { NoShowCheckScheduler.cancel(ctx, it.id) } } repository.waypointStore.delete(waypoint)
findfamily/src/main/java/com/vayunmathur/findfamily/platform/NoShowCheckScheduler.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/NoShowCheckScheduler.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/NoShowCheckScheduler.ktindex 0d2b453fe2..bc931bf3b2 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/NoShowCheckScheduler.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/NoShowCheckScheduler.kt@@ -190,7 +190,7 @@ object NoShowCheckScheduler { */ suspend fun rescheduleAll(context: Context) { val repository = FindFamilyRepository.get(context.applicationContext)- val pending = repository.noShowAlertStore.getAll().filter { !it.fired }+ val pending = repository.noShowAlertStore.getPending() for (alert in pending) { runCatching { schedule(context, alert) } .onFailure { e -> Log.status(TAG, "reschedule alert ${alert.id} failed", e) }
launcher/src/main/java/com/vayunmathur/launcher/data/LauncherDatabase.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/data/LauncherDatabase.kt b/launcher/src/main/java/com/vayunmathur/launcher/data/LauncherDatabase.ktindex 0fdcae1ffd..553396a6d0 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/data/LauncherDatabase.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/data/LauncherDatabase.kt@@ -43,6 +43,10 @@ interface LauncherItemDao { @Query("SELECT * FROM launcher_items WHERE containerId = :folderId ORDER BY rank") suspend fun getFolderChildren(folderId: Long): List<LauncherItemEntity> + /** All folder rows (for the empty-folder sweep), filtered in SQL not in memory. */+ @Query("SELECT * FROM launcher_items WHERE itemType = 'FOLDER'")+ suspend fun getFolders(): List<LauncherItemEntity>+ @Query("SELECT COUNT(*) FROM launcher_items WHERE containerId = :folderId") suspend fun countFolderChildren(folderId: Long): Int
launcher/src/main/java/com/vayunmathur/launcher/data/LauncherRepository.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/data/LauncherRepository.kt b/launcher/src/main/java/com/vayunmathur/launcher/data/LauncherRepository.ktindex be1e9192c0..1855b37a7d 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/data/LauncherRepository.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/data/LauncherRepository.kt@@ -385,7 +385,7 @@ class LauncherRepository private constructor(context: Context) : } private suspend fun collapseEmptyFolders() {- val folders = dao.getAll().filter { it.itemType == LauncherItemType.FOLDER }+ val folders = dao.getFolders() for (folder in folders) { val children = dao.getFolderChildren(folder.id) if (!FolderRules.shouldCollapse(children.size)) continue
library/src/main/java/com/vayunmathur/library/util/RoomViewModel.kt
diff --git a/library/src/main/java/com/vayunmathur/library/util/RoomViewModel.kt b/library/src/main/java/com/vayunmathur/library/util/RoomViewModel.ktindex 88910d8c2d..3363498a48 100644--- a/library/src/main/java/com/vayunmathur/library/util/RoomViewModel.kt+++ b/library/src/main/java/com/vayunmathur/library/util/RoomViewModel.kt@@ -4,6 +4,7 @@ import androidx.room3.ColumnTypeConverter import androidx.room3.Dao import androidx.room3.Delete import androidx.room3.Entity+import androidx.room3.Index import androidx.room3.PrimaryKey import androidx.room3.Query import androidx.room3.RoomDatabase@@ -24,7 +25,12 @@ interface DatabaseItem { } /** Join row linking a left id to a right id under a typed many-to-many relation. */-@Entity+@Entity(+ indices = [+ Index(value = ["leftID", "type"]),+ Index(value = ["rightID", "type"]),+ ],+) data class ManyManyMatching( val leftID: Long, val rightID: Long,
library/ui/src/main/java/com/vayunmathur/library/ui/FormComponents.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/FormComponents.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/FormComponents.ktindex 444623c1dc..30ab3982f1 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/FormComponents.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/FormComponents.kt@@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width+import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue@@ -22,6 +23,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier+import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.VisualTransformation @@ -57,6 +59,8 @@ fun LabeledTextField( readOnly: Boolean = false, singleLine: Boolean = true, keyboardType: KeyboardType = KeyboardType.Text,+ imeAction: ImeAction = ImeAction.Default,+ keyboardActions: KeyboardActions = KeyboardActions.Default, visualTransformation: VisualTransformation = VisualTransformation.None, isError: Boolean = false, supportingText: String? = null,@@ -85,6 +89,8 @@ fun LabeledTextField( readOnly = readOnly, singleLine = singleLine, keyboardType = keyboardType,+ imeAction = imeAction,+ keyboardActions = keyboardActions, visualTransformation = visualTransformation, isError = isError, placeholder = placeholder,@@ -106,7 +112,8 @@ fun LabeledTextField( supportingText = supportingText?.let { { Text(it) } }, isError = isError, visualTransformation = visualTransformation,- keyboardOptions = KeyboardOptions(keyboardType = keyboardType),+ keyboardOptions = KeyboardOptions(keyboardType = keyboardType, imeAction = imeAction),+ keyboardActions = keyboardActions, singleLine = singleLine, ) }@@ -130,6 +137,8 @@ private fun SharedTextLabeledField( readOnly: Boolean, singleLine: Boolean, keyboardType: KeyboardType,+ imeAction: ImeAction = ImeAction.Default,+ keyboardActions: KeyboardActions = KeyboardActions.Default, visualTransformation: VisualTransformation, isError: Boolean, placeholder: String?,@@ -144,7 +153,8 @@ private fun SharedTextLabeledField( enabled = enabled, readOnly = readOnly, textStyle = LocalTextStyle.current.copy(color = MaterialTheme.colorScheme.onSurface),- keyboardOptions = KeyboardOptions(keyboardType = keyboardType),+ keyboardOptions = KeyboardOptions(keyboardType = keyboardType, imeAction = imeAction),+ keyboardActions = keyboardActions, singleLine = singleLine, visualTransformation = visualTransformation, interactionSource = interactionSource,
office/src/main/java/com/vayunmathur/office/platform/OfficeViewModel.kt
diff --git a/office/src/main/java/com/vayunmathur/office/platform/OfficeViewModel.kt b/office/src/main/java/com/vayunmathur/office/platform/OfficeViewModel.ktindex 4c8bb1ef5a..31d58ceca1 100644--- a/office/src/main/java/com/vayunmathur/office/platform/OfficeViewModel.kt+++ b/office/src/main/java/com/vayunmathur/office/platform/OfficeViewModel.kt@@ -198,7 +198,7 @@ class OfficeViewModel(application: Application) : AndroidViewModel(application) // --- Auto-save --- internal var autoSaveJob: Job? = null- internal var autoSaveEnabledMutable = MutableStateFlow(false)+ internal var autoSaveEnabledMutable = MutableStateFlow(true) val autoSaveEnabled: StateFlow<Boolean> = autoSaveEnabledMutable internal var autoSaveIntervalMs: Long = 60_000L // default 1 minute @@ -225,7 +225,8 @@ class OfficeViewModel(application: Application) : AndroidViewModel(application) // --- Settings --- fun loadSettings(context: Context) { val prefs = context.getSharedPreferences("office_settings", Context.MODE_PRIVATE)- val autoSave = prefs.getBoolean("auto_save", false)+ // Default on for new installs; a stored value (Settings toggle) always wins.+ val autoSave = prefs.getBoolean("auto_save", true) val interval = prefs.getInt("auto_save_interval", DEFAULT_AUTO_SAVE_SECONDS) setAutoSave(autoSave, interval) val themeName = prefs.getString("document_theme_mode", DocumentThemeMode.UNCHANGED.name)@@ -287,7 +288,7 @@ class OfficeViewModel(application: Application) : AndroidViewModel(application) fun getAutoSaveEnabled(context: Context): Boolean { return context.getSharedPreferences("office_settings", Context.MODE_PRIVATE)- .getBoolean("auto_save", false)+ .getBoolean("auto_save", true) } // --- Undo/Redo ---
photos/src/main/java/com/vayunmathur/photos/data/PhotosRepository.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/data/PhotosRepository.kt b/photos/src/main/java/com/vayunmathur/photos/data/PhotosRepository.ktindex 67f976245a..03fc9a7fb4 100644--- a/photos/src/main/java/com/vayunmathur/photos/data/PhotosRepository.kt+++ b/photos/src/main/java/com/vayunmathur/photos/data/PhotosRepository.kt@@ -21,7 +21,7 @@ open class PhotosRepository internal constructor(context: Context) : // ------------------------------------------------------------------ fun getAllFlow(): Flow<List<Photo>> = photoDao.getAllFlow() fun getFavoritesFlow(): Flow<List<Photo>> = photoDao.getFavoritesFlow()- suspend fun getAllForSync(): List<Photo> = photoDao.getAllForSync()+ open suspend fun getAllForSync(): List<Photo> = photoDao.getAllForSync() fun getByIdFlow(id: Long): Flow<Photo?> = photoDao.getByIdFlow(id) fun getOCRCountFlow(): Flow<Int> = photoDao.getOCRCountFlow() fun getClipCountFlow(): Flow<Int> = photoDao.getClipCountFlow()
photos/src/test/java/com/vayunmathur/photos/data/PhotosFavoritesDataTest.kt
diff --git a/photos/src/test/java/com/vayunmathur/photos/data/PhotosFavoritesDataTest.kt b/photos/src/test/java/com/vayunmathur/photos/data/PhotosFavoritesDataTest.ktindex 16b26acbab..e2b6473a0a 100644--- a/photos/src/test/java/com/vayunmathur/photos/data/PhotosFavoritesDataTest.kt+++ b/photos/src/test/java/com/vayunmathur/photos/data/PhotosFavoritesDataTest.kt@@ -104,9 +104,9 @@ class PhotosFavoritesDataTest { } @Test- fun migrationListEndsAtVersion21() {+ fun migrationListEndsAtVersion22() { val last = PhotoDatabase.migrations.last()- assertEquals(20 to 21, last.startVersion to last.endVersion)+ assertEquals(21 to 22, last.startVersion to last.endVersion) } @Test
photos/src/test/java/com/vayunmathur/photos/util/PhotosFavoritesSyncTest.kt
diff --git a/photos/src/test/java/com/vayunmathur/photos/util/PhotosFavoritesSyncTest.kt b/photos/src/test/java/com/vayunmathur/photos/util/PhotosFavoritesSyncTest.ktindex 461e32d1d7..46fe976e08 100644--- a/photos/src/test/java/com/vayunmathur/photos/util/PhotosFavoritesSyncTest.kt+++ b/photos/src/test/java/com/vayunmathur/photos/util/PhotosFavoritesSyncTest.kt@@ -44,6 +44,7 @@ class PhotosFavoritesSyncTest { val upsertedBatches = mutableListOf<List<Photo>>() val favoriteWrites = mutableListOf<Pair<List<Long>, Boolean>>() override suspend fun getAll(): List<Photo> = all+ override suspend fun getAllForSync(): List<Photo> = all override suspend fun deleteByIds(ids: List<Long>) { deletedBatches += ids }
photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1SyncTest.kt
diff --git a/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1SyncTest.kt b/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1SyncTest.ktindex 79a783816d..ba8b109fd0 100644--- a/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1SyncTest.kt+++ b/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1SyncTest.kt@@ -49,6 +49,7 @@ class PhotosSlice1SyncTest { val deletedBatches = mutableListOf<List<Long>>() val upsertedBatches = mutableListOf<List<Photo>>() override suspend fun getAll(): List<Photo> = all+ override suspend fun getAllForSync(): List<Photo> = all override suspend fun deleteByIds(ids: List<Long>) { deletedBatches += ids }
photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1WorkersTest.kt
diff --git a/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1WorkersTest.kt b/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1WorkersTest.ktindex 6feadf7dcf..bcbd195608 100644--- a/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1WorkersTest.kt+++ b/photos/src/test/java/com/vayunmathur/photos/util/PhotosSlice1WorkersTest.kt@@ -24,6 +24,7 @@ import com.vayunmathur.photos.data.MIGRATION_17_18 import com.vayunmathur.photos.data.MIGRATION_18_19 import com.vayunmathur.photos.data.MIGRATION_19_20 import com.vayunmathur.photos.data.MIGRATION_20_21+import com.vayunmathur.photos.data.MIGRATION_21_22 import com.vayunmathur.photos.data.MIGRATION_1_2 import com.vayunmathur.photos.data.MIGRATION_2_3 import com.vayunmathur.photos.data.MIGRATION_3_4@@ -86,7 +87,7 @@ class PhotosSlice1WorkersTest { // Minimal v1 Photo table: the columns the early migrations index // or update, before any ALTER ran. connection.execSQL(- "CREATE TABLE Photo (id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL DEFAULT '', " ++ "CREATE TABLE Photo (id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL DEFAULT '', uri TEXT NOT NULL DEFAULT '', " + "date INTEGER NOT NULL, exifSet INTEGER NOT NULL DEFAULT 0, duration INTEGER)", ) connection.execSQL("INSERT INTO Photo (id, date) VALUES (1, 1000), (2, 2000)")@@ -140,9 +141,9 @@ class PhotosSlice1WorkersTest { } @Test- fun migrationListIsContiguousFrom1To21() {+ fun migrationListIsContiguousFrom1To22() { val versions = PhotoDatabase.migrations.map { it.startVersion to it.endVersion }- assertEquals((1..20).map { it to it + 1 }, versions)+ assertEquals((1..21).map { it to it + 1 }, versions) } // ---- Worker scheduling ----
securemail/schemas/com.vayunmathur.securemail.data.MailDatabase/6.json
diff --git a/securemail/schemas/com.vayunmathur.securemail.data.MailDatabase/6.json b/securemail/schemas/com.vayunmathur.securemail.data.MailDatabase/6.jsonnew file mode 100644index 0000000000..74fdea52b5--- /dev/null+++ b/securemail/schemas/com.vayunmathur.securemail.data.MailDatabase/6.json@@ -0,0 +1,281 @@+{+ "formatVersion": 1,+ "database": {+ "version": 6,+ "identityHash": "8a8f532ed641f25143d4914458ad6f93",+ "entities": [+ {+ "tableName": "StoredMessage",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `from` TEXT NOT NULL, `toJson` TEXT NOT NULL, `dateMillis` INTEGER NOT NULL, `messageId` TEXT NOT NULL, `blobBase64` TEXT NOT NULL, `decryptedBody` TEXT, `decryptedSubject` TEXT, `verifiedSigner` TEXT, `unencrypted` INTEGER NOT NULL, `isRead` INTEGER NOT NULL, `folder` TEXT NOT NULL, `decryptedHtml` TEXT, `deliveredTo` TEXT, PRIMARY KEY(`id`))",+ "fields": [+ {+ "fieldPath": "id",+ "columnName": "id",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "from",+ "columnName": "from",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "toJson",+ "columnName": "toJson",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "dateMillis",+ "columnName": "dateMillis",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "messageId",+ "columnName": "messageId",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "blobBase64",+ "columnName": "blobBase64",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "decryptedBody",+ "columnName": "decryptedBody",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "decryptedSubject",+ "columnName": "decryptedSubject",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "verifiedSigner",+ "columnName": "verifiedSigner",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "unencrypted",+ "columnName": "unencrypted",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "isRead",+ "columnName": "isRead",+ "affinity": "INTEGER",+ "notNull": true+ },+ {+ "fieldPath": "folder",+ "columnName": "folder",+ "affinity": "TEXT",+ "notNull": true+ },+ {+ "fieldPath": "decryptedHtml",+ "columnName": "decryptedHtml",+ "affinity": "TEXT"+ },+ {+ "fieldPath": "deliveredTo",+ "columnName": "deliveredTo",+ "affinity": "TEXT"+ }+ ],+ "primaryKey": {+ "autoGenerate": false,+ "columnNames": [+ "id"+ ]+ },+ "indices": [+ {+ "name": "index_StoredMessage_folder_dateMillis",+ "unique": false,+ "columnNames": [+ "folder",+ "dateMillis"+ ],+ "orders": [],+ "createSql": "CREATE INDEX IF NOT EXISTS `index_StoredMessage_folder_dateMillis` ON `${TABLE_NAME}` (`folder`, `dateMillis`)"+ }+ ]+ },+ {+ "tableName": "CachedKey",+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`address` TEXT NOT NULL, `armoredPublic` TEXT NOT NULL, `fingerprintHex` TEXT NOT NULL, `source` TEXT NOT NULL, `updatedMillis` INTEGER NOT NULL, PRIMARY KEY(`address`))",+ "fields": [+ {+ "fieldPath": "address",+ "c
Diff truncated.