Remove problematic getLastMessage()

This commit is contained in:
andrew 2023-08-07 10:26:20 +09:30
parent b487d5aa64
commit f70aa9155b

View File

@ -951,7 +951,13 @@ public class ThreadDatabase extends Database {
readReceiptCount = 0; readReceiptCount = 0;
} }
MessageRecord lastMessage = count > 0 ? getLastMessage(threadId) : null; MessageRecord lastMessage = null;
if (count > 0) {
MmsSmsDatabase mmsSmsDatabase = DatabaseComponent.get(context).mmsSmsDatabase();
long messageTimestamp = mmsSmsDatabase.getLastMessageTimestamp(threadId);
lastMessage = mmsSmsDatabase.getMessageForTimestamp(messageTimestamp);
}
return new ThreadRecord(body, snippetUri, lastMessage, recipient, date, count, return new ThreadRecord(body, snippetUri, lastMessage, recipient, date, count,
unreadCount, unreadMentionCount, threadId, deliveryReceiptCount, status, type, unreadCount, unreadMentionCount, threadId, deliveryReceiptCount, status, type,
@ -978,10 +984,4 @@ public class ThreadDatabase extends Database {
} }
} }
} }
private MessageRecord getLastMessage(long threadId) {
MmsSmsDatabase mmsSmsDatabase = DatabaseComponent.get(context).mmsSmsDatabase();
long messageTimestamp = mmsSmsDatabase.getLastMessageTimestamp(threadId);
return mmsSmsDatabase.getMessageForTimestamp(messageTimestamp);
}
} }