feat: Simplify animations across multiple screens by replacing slide transitions with fade animations for improved user experience
This commit is contained in:
@@ -106,7 +106,16 @@ data class DialogEntity(
|
||||
val verified: Int = 0, // Верифицирован
|
||||
|
||||
@ColumnInfo(name = "i_have_sent", defaultValue = "0")
|
||||
val iHaveSent: Int = 0 // Отправлял ли я сообщения в этот диалог (0/1)
|
||||
val iHaveSent: Int = 0, // Отправлял ли я сообщения в этот диалог (0/1)
|
||||
|
||||
@ColumnInfo(name = "last_message_from_me", defaultValue = "0")
|
||||
val lastMessageFromMe: Int = 0, // Последнее сообщение от меня (0/1)
|
||||
|
||||
@ColumnInfo(name = "last_message_delivered", defaultValue = "0")
|
||||
val lastMessageDelivered: Int = 0, // Статус доставки последнего сообщения (0=WAITING, 1=DELIVERED, 2=ERROR)
|
||||
|
||||
@ColumnInfo(name = "last_message_read", defaultValue = "0")
|
||||
val lastMessageRead: Int = 0 // Прочитано последнее сообщение (0/1)
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -465,7 +474,10 @@ interface DialogDao {
|
||||
is_online,
|
||||
last_seen,
|
||||
verified,
|
||||
i_have_sent
|
||||
i_have_sent,
|
||||
last_message_from_me,
|
||||
last_message_delivered,
|
||||
last_message_read
|
||||
)
|
||||
SELECT
|
||||
:account AS account,
|
||||
@@ -525,7 +537,31 @@ interface DialogDao {
|
||||
(SELECT i_have_sent FROM dialogs WHERE account = :account AND opponent_key = :opponentKey),
|
||||
0
|
||||
)
|
||||
END AS i_have_sent
|
||||
END AS i_have_sent,
|
||||
COALESCE(
|
||||
(SELECT from_me FROM messages
|
||||
WHERE account = :account
|
||||
AND ((from_public_key = :opponentKey AND to_public_key = :account)
|
||||
OR (from_public_key = :account AND to_public_key = :opponentKey))
|
||||
ORDER BY timestamp DESC LIMIT 1),
|
||||
0
|
||||
) AS last_message_from_me,
|
||||
COALESCE(
|
||||
(SELECT delivered FROM messages
|
||||
WHERE account = :account
|
||||
AND ((from_public_key = :opponentKey AND to_public_key = :account)
|
||||
OR (from_public_key = :account AND to_public_key = :opponentKey))
|
||||
ORDER BY timestamp DESC LIMIT 1),
|
||||
0
|
||||
) AS last_message_delivered,
|
||||
COALESCE(
|
||||
(SELECT read FROM messages
|
||||
WHERE account = :account
|
||||
AND ((from_public_key = :opponentKey AND to_public_key = :account)
|
||||
OR (from_public_key = :account AND to_public_key = :opponentKey))
|
||||
ORDER BY timestamp DESC LIMIT 1),
|
||||
0
|
||||
) AS last_message_read
|
||||
WHERE EXISTS (
|
||||
SELECT 1 FROM messages
|
||||
WHERE account = :account
|
||||
@@ -557,7 +593,10 @@ interface DialogDao {
|
||||
is_online,
|
||||
last_seen,
|
||||
verified,
|
||||
i_have_sent
|
||||
i_have_sent,
|
||||
last_message_from_me,
|
||||
last_message_delivered,
|
||||
last_message_read
|
||||
)
|
||||
SELECT
|
||||
:account AS account,
|
||||
@@ -598,7 +637,24 @@ interface DialogDao {
|
||||
(SELECT verified FROM dialogs WHERE account = :account AND opponent_key = :account),
|
||||
0
|
||||
) AS verified,
|
||||
1 AS i_have_sent
|
||||
1 AS i_have_sent,
|
||||
1 AS last_message_from_me,
|
||||
COALESCE(
|
||||
(SELECT delivered FROM messages
|
||||
WHERE account = :account
|
||||
AND from_public_key = :account
|
||||
AND to_public_key = :account
|
||||
ORDER BY timestamp DESC LIMIT 1),
|
||||
0
|
||||
) AS last_message_delivered,
|
||||
COALESCE(
|
||||
(SELECT read FROM messages
|
||||
WHERE account = :account
|
||||
AND from_public_key = :account
|
||||
AND to_public_key = :account
|
||||
ORDER BY timestamp DESC LIMIT 1),
|
||||
0
|
||||
) AS last_message_read
|
||||
WHERE EXISTS (
|
||||
SELECT 1 FROM messages
|
||||
WHERE account = :account
|
||||
|
||||
@@ -4,6 +4,8 @@ import android.content.Context
|
||||
import androidx.room.Database
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
|
||||
@Database(
|
||||
entities = [
|
||||
@@ -12,7 +14,7 @@ import androidx.room.RoomDatabase
|
||||
DialogEntity::class,
|
||||
BlacklistEntity::class
|
||||
],
|
||||
version = 4,
|
||||
version = 5,
|
||||
exportSchema = false
|
||||
)
|
||||
abstract class RosettaDatabase : RoomDatabase() {
|
||||
@@ -24,6 +26,15 @@ abstract class RosettaDatabase : RoomDatabase() {
|
||||
companion object {
|
||||
@Volatile
|
||||
private var INSTANCE: RosettaDatabase? = null
|
||||
|
||||
private val MIGRATION_4_5 = object : Migration(4, 5) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
// Добавляем новые столбцы для индикаторов прочтения
|
||||
database.execSQL("ALTER TABLE dialogs ADD COLUMN last_message_from_me INTEGER NOT NULL DEFAULT 0")
|
||||
database.execSQL("ALTER TABLE dialogs ADD COLUMN last_message_delivered INTEGER NOT NULL DEFAULT 0")
|
||||
database.execSQL("ALTER TABLE dialogs ADD COLUMN last_message_read INTEGER NOT NULL DEFAULT 0")
|
||||
}
|
||||
}
|
||||
|
||||
fun getDatabase(context: Context): RosettaDatabase {
|
||||
return INSTANCE ?: synchronized(this) {
|
||||
@@ -33,7 +44,8 @@ abstract class RosettaDatabase : RoomDatabase() {
|
||||
"rosetta_secure.db"
|
||||
)
|
||||
.setJournalMode(JournalMode.WRITE_AHEAD_LOGGING) // WAL mode for performance
|
||||
.fallbackToDestructiveMigration() // Для разработки
|
||||
.addMigrations(MIGRATION_4_5)
|
||||
.fallbackToDestructiveMigration() // Для разработки - только если миграция не найдена
|
||||
.build()
|
||||
INSTANCE = instance
|
||||
instance
|
||||
|
||||
Reference in New Issue
Block a user