diff --git a/app/schemas/tech.relaycorp.letro.storage.LetroDatabase/1.json b/app/schemas/tech.relaycorp.letro.storage.LetroDatabase/1.json index c59af219..f644c9dc 100644 --- a/app/schemas/tech.relaycorp.letro.storage.LetroDatabase/1.json +++ b/app/schemas/tech.relaycorp.letro.storage.LetroDatabase/1.json @@ -2,7 +2,7 @@ "formatVersion": 1, "database": { "version": 1, - "identityHash": "94e396e1f0c1805cb42e862839856f3f", + "identityHash": "995ffbad136ec40b0cd0e789b1f925c3", "entities": [ { "tableName": "account", @@ -161,12 +161,22 @@ "keyId" ] }, - "indices": [], + "indices": [ + { + "name": "index_conversations_conversationId", + "unique": true, + "columnNames": [ + "conversationId" + ], + "orders": [], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_conversations_conversationId` ON `${TABLE_NAME}` (`conversationId`)" + } + ], "foreignKeys": [] }, { "tableName": "messages", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `conversationId` BLOB NOT NULL, `text` TEXT NOT NULL, `ownerVeraId` TEXT NOT NULL, `recipientVeraId` TEXT NOT NULL, `senderVeraId` TEXT NOT NULL, `sentAt` TEXT NOT NULL)", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `conversationId` BLOB NOT NULL, `text` TEXT NOT NULL, `ownerVeraId` TEXT NOT NULL, `recipientVeraId` TEXT NOT NULL, `senderVeraId` TEXT NOT NULL, `sentAt` TEXT NOT NULL, FOREIGN KEY(`conversationId`) REFERENCES `conversations`(`conversationId`) ON UPDATE NO ACTION ON DELETE CASCADE )", "fields": [ { "fieldPath": "id", @@ -218,13 +228,25 @@ ] }, "indices": [], - "foreignKeys": [] + "foreignKeys": [ + { + "table": "conversations", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "conversationId" + ], + "referencedColumns": [ + "conversationId" + ] + } + ] } ], "views": [], "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, '94e396e1f0c1805cb42e862839856f3f')" + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '995ffbad136ec40b0cd0e789b1f925c3')" ] } } \ No newline at end of file diff --git a/app/src/main/java/tech/relaycorp/letro/messages/storage/entity/Conversation.kt b/app/src/main/java/tech/relaycorp/letro/messages/storage/entity/Conversation.kt index 50dbf660..3067f01f 100644 --- a/app/src/main/java/tech/relaycorp/letro/messages/storage/entity/Conversation.kt +++ b/app/src/main/java/tech/relaycorp/letro/messages/storage/entity/Conversation.kt @@ -1,6 +1,7 @@ package tech.relaycorp.letro.messages.storage.entity import androidx.room.Entity +import androidx.room.Index import androidx.room.PrimaryKey import java.util.UUID @@ -8,6 +9,7 @@ const val TABLE_NAME_CONVERSATIONS = "conversations" @Entity( tableName = TABLE_NAME_CONVERSATIONS, + indices = [Index("conversationId", unique = true)], ) /** * @param keyId - primary key for the conversations table. Autogenerated. diff --git a/app/src/main/java/tech/relaycorp/letro/messages/storage/entity/Message.kt b/app/src/main/java/tech/relaycorp/letro/messages/storage/entity/Message.kt index 5f09ea37..028fea81 100644 --- a/app/src/main/java/tech/relaycorp/letro/messages/storage/entity/Message.kt +++ b/app/src/main/java/tech/relaycorp/letro/messages/storage/entity/Message.kt @@ -1,6 +1,7 @@ package tech.relaycorp.letro.messages.storage.entity import androidx.room.Entity +import androidx.room.ForeignKey import androidx.room.PrimaryKey import java.time.LocalDateTime import java.util.UUID @@ -9,6 +10,14 @@ const val TABLE_NAME_MESSAGES = "messages" @Entity( tableName = TABLE_NAME_MESSAGES, + foreignKeys = [ + ForeignKey( + entity = Conversation::class, + parentColumns = ["conversationId"], + childColumns = ["conversationId"], + onDelete = ForeignKey.CASCADE, + ), + ], ) /** * @param id - primary key for the messages table. Autogenerated. diff --git a/app/src/main/java/tech/relaycorp/letro/ui/theme/Type.kt b/app/src/main/java/tech/relaycorp/letro/ui/theme/Type.kt index bb501881..aa3c978f 100644 --- a/app/src/main/java/tech/relaycorp/letro/ui/theme/Type.kt +++ b/app/src/main/java/tech/relaycorp/letro/ui/theme/Type.kt @@ -38,9 +38,9 @@ val Typography = Typography( headlineSmall = TextStyle( fontFamily = Inter, fontWeight = FontWeight.SemiBold, - fontSize = 22.sp, - lineHeight = 28.sp, - letterSpacing = (-0.3).sp, + fontSize = 24.sp, + lineHeight = 30.sp, + letterSpacing = (-0.25).sp, ), titleLarge = TextStyle( fontFamily = Inter, @@ -68,7 +68,7 @@ val Typography = Typography( fontWeight = FontWeight.Medium, fontSize = 14.sp, lineHeight = 20.sp, - letterSpacing = (-0.25).sp, + letterSpacing = (-0.1).sp, ), labelMedium = TextStyle( fontFamily = Inter, @@ -88,21 +88,21 @@ val Typography = Typography( fontFamily = Inter, fontWeight = FontWeight.Normal, fontSize = 18.sp, - lineHeight = 24.sp, - letterSpacing = 0.05.sp, + lineHeight = 26.sp, + letterSpacing = (-0.15).sp, ), bodyMedium = TextStyle( fontFamily = Inter, fontWeight = FontWeight.Normal, fontSize = 16.sp, - lineHeight = 20.sp, + lineHeight = 22.sp, letterSpacing = (-0.25).sp, ), bodySmall = TextStyle( fontFamily = Inter, fontWeight = FontWeight.Normal, - fontSize = 14.sp, - lineHeight = 16.sp, + fontSize = 13.sp, + lineHeight = 17.sp, ), )