Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Delete messages + fix fonts #59

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions app/schemas/tech.relaycorp.letro.storage.LetroDatabase/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "94e396e1f0c1805cb42e862839856f3f",
"identityHash": "995ffbad136ec40b0cd0e789b1f925c3",
"entities": [
{
"tableName": "account",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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')"
]
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package tech.relaycorp.letro.messages.storage.entity

import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
import java.util.UUID

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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/java/tech/relaycorp/letro/ui/theme/Type.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
),
)

Expand Down