Refactor image handling and decoding logic

- Introduced a maximum bitmap decode dimension to prevent excessive memory usage.
- Enhanced base64 to bitmap conversion by extracting payload and applying EXIF orientation.
- Improved error handling for image downloads and decoding processes.
- Simplified media picker and chat input components to manage keyboard visibility more effectively.
- Updated color selection grid to adaptively adjust based on available width.
- Added safety checks for notifications and call actions in profile screens.
- Optimized bitmap decoding in uriToBase64Image to handle large images more efficiently.
This commit is contained in:
2026-02-20 02:45:00 +05:00
parent 5cf8b2866f
commit 88e2084f8b
26 changed files with 943 additions and 464 deletions

View File

@@ -94,7 +94,7 @@ interface MessageDao {
"""
SELECT * FROM messages
WHERE account = :account AND dialog_key = :dialogKey
ORDER BY timestamp DESC
ORDER BY timestamp DESC, message_id DESC
LIMIT :limit OFFSET :offset
"""
)
@@ -116,7 +116,7 @@ interface MessageDao {
WHERE account = :account
AND from_public_key = :account
AND to_public_key = :account
ORDER BY timestamp DESC
ORDER BY timestamp DESC, message_id DESC
LIMIT :limit OFFSET :offset
"""
)
@@ -142,7 +142,7 @@ interface MessageDao {
"""
SELECT * FROM messages
WHERE account = :account AND dialog_key = :dialogKey
ORDER BY timestamp ASC
ORDER BY timestamp ASC, message_id ASC
"""
)
fun getMessagesFlow(account: String, dialogKey: String): Flow<List<MessageEntity>>
@@ -175,7 +175,7 @@ interface MessageDao {
"""
SELECT * FROM messages
WHERE account = :account AND dialog_key = :dialogKey
ORDER BY timestamp DESC
ORDER BY timestamp DESC, message_id DESC
LIMIT :limit
"""
)
@@ -234,7 +234,7 @@ interface MessageDao {
AND dialog_key = :dialogKey
AND from_public_key = :fromPublicKey
AND timestamp BETWEEN :timestampFrom AND :timestampTo
ORDER BY timestamp ASC
ORDER BY timestamp ASC, message_id ASC
LIMIT 1
"""
)
@@ -316,7 +316,7 @@ interface MessageDao {
WHERE account = :account
AND ((from_public_key = :opponent AND to_public_key = :account)
OR (from_public_key = :account AND to_public_key = :opponent))
ORDER BY timestamp DESC, id DESC LIMIT 1
ORDER BY timestamp DESC, message_id DESC LIMIT 1
"""
)
suspend fun getLastMessageDebug(account: String, opponent: String): MessageEntity?
@@ -331,7 +331,7 @@ interface MessageDao {
WHERE account = :account
AND ((from_public_key = :opponent AND to_public_key = :account)
OR (from_public_key = :account AND to_public_key = :opponent))
ORDER BY timestamp DESC, id DESC LIMIT 1
ORDER BY timestamp DESC, message_id DESC LIMIT 1
"""
)
suspend fun getLastMessageStatus(account: String, opponent: String): LastMessageStatus?
@@ -346,7 +346,7 @@ interface MessageDao {
WHERE account = :account
AND ((from_public_key = :opponent AND to_public_key = :account)
OR (from_public_key = :account AND to_public_key = :opponent))
ORDER BY timestamp DESC, id DESC LIMIT 1
ORDER BY timestamp DESC, message_id DESC LIMIT 1
"""
)
suspend fun getLastMessageAttachments(account: String, opponent: String): String?
@@ -535,7 +535,7 @@ interface DialogDao {
"""
SELECT * FROM messages
WHERE account = :account AND dialog_key = :dialogKey
ORDER BY timestamp DESC, id DESC LIMIT 1
ORDER BY timestamp DESC, message_id DESC LIMIT 1
"""
)
suspend fun getLastMessageByDialogKey(account: String, dialogKey: String): MessageEntity?