mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-07-07 14:35:29 +01:00
Refresh thread snippet after view-once attachment is viewed.
Co-authored-by: Greyson Parrelli <greyson@signal.org>
This commit is contained in:
committed by
Michelle Tang
parent
02d245ac0c
commit
74935c963a
@@ -1364,6 +1364,7 @@ class AttachmentTable(
|
||||
|
||||
val filePathsToDelete: MutableSet<String> = mutableSetOf()
|
||||
val contentTypesToDelete: MutableSet<String> = mutableSetOf()
|
||||
var threadId: Long = -1
|
||||
|
||||
writableDatabase.withinTransaction { db ->
|
||||
db.select(DATA_FILE, CONTENT_TYPE, ID)
|
||||
@@ -1411,12 +1412,16 @@ class AttachmentTable(
|
||||
|
||||
AppDependencies.databaseObserver.notifyAttachmentDeletedObservers()
|
||||
|
||||
val threadId = messages.getThreadIdForMessage(messageId)
|
||||
threadId = messages.getThreadIdForMessage(messageId)
|
||||
if (threadId > 0) {
|
||||
notifyConversationListeners(threadId)
|
||||
}
|
||||
}
|
||||
|
||||
if (threadId > 0) {
|
||||
SignalDatabase.threads.updateSnippetContentTypeSilently(threadId, messageId, MediaUtil.VIEW_ONCE)
|
||||
}
|
||||
|
||||
deleteDataFiles(filePathsToDelete, contentTypesToDelete)
|
||||
}
|
||||
|
||||
|
||||
@@ -305,6 +305,14 @@ class ThreadTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
|
||||
.run()
|
||||
}
|
||||
|
||||
fun updateSnippetContentTypeSilently(threadId: Long, snippetMessageId: Long, mimeType: String) {
|
||||
writableDatabase
|
||||
.update(TABLE_NAME)
|
||||
.values(SNIPPET_CONTENT_TYPE to mimeType)
|
||||
.where("$ID = ? AND $SNIPPET_MESSAGE_ID = ?", threadId, snippetMessageId)
|
||||
.run()
|
||||
}
|
||||
|
||||
fun updateSnippet(threadId: Long, snippet: String?, attachment: Uri?, date: Long, type: Long, unarchive: Boolean) {
|
||||
if (isSilentType(type)) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user