Update thread after attachment downloads.

fork-5.53.8
Greyson Parrelli 2021-10-22 14:52:37 -04:00
rodzic 4578c33968
commit 7cac62f3f2
2 zmienionych plików z 13 dodań i 2 usunięć

Wyświetl plik

@ -626,7 +626,10 @@ public class AttachmentDatabase extends Database {
//noinspection ResultOfMethodCallIgnored
dataInfo.file.delete();
} else {
notifyConversationListeners(DatabaseFactory.getMmsDatabase(context).getThreadIdForMessage(mmsId));
long threadId = DatabaseFactory.getMmsDatabase(context).getThreadIdForMessage(mmsId);
DatabaseFactory.getThreadDatabase(context).updateSnippetUriSilently(threadId, PartAuthority.getAttachmentDataUri(attachmentId));
notifyConversationListeners(threadId);
notifyConversationListListeners();
}

Wyświetl plik

@ -226,6 +226,14 @@ public class ThreadDatabase extends Database {
}
}
public void updateSnippetUriSilently(long threadId, @Nullable Uri attachment) {
ContentValues contentValues = new ContentValues();
contentValues.put(SNIPPET_URI, attachment != null ? attachment.toString() : null);
SQLiteDatabase db = databaseHelper.getSignalWritableDatabase();
db.update(TABLE_NAME, contentValues, ID_WHERE, SqlUtil.buildArgs(threadId));
}
public void updateSnippet(long threadId, String snippet, @Nullable Uri attachment, long date, long type, boolean unarchive) {
if (isSilentType(type)) {
return;
@ -242,7 +250,7 @@ public class ThreadDatabase extends Database {
}
SQLiteDatabase db = databaseHelper.getSignalWritableDatabase();
db.update(TABLE_NAME, contentValues, ID + " = ?", new String[] {threadId + ""});
db.update(TABLE_NAME, contentValues, ID_WHERE, SqlUtil.buildArgs(threadId));
notifyConversationListListeners();
}