mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-12 04:57:43 +00:00
feat: add removing of the sent/received messages
This commit is contained in:
@@ -379,9 +379,9 @@ class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context,
|
||||
SessionMetaProtocol.addTimestamp(timestamp)
|
||||
}
|
||||
|
||||
// override fun removeReceivedMessageTimestamps(timestamps: Set<Long>) {
|
||||
// TODO("Not yet implemented")
|
||||
// }
|
||||
override fun removeReceivedMessageTimestamps(timestamps: Set<Long>) {
|
||||
SessionMetaProtocol.removeTimestamps(timestamps)
|
||||
}
|
||||
|
||||
override fun getMessageIdInDatabase(timestamp: Long, author: String): Long? {
|
||||
val database = DatabaseFactory.getMmsSmsDatabase(context)
|
||||
|
@@ -49,6 +49,7 @@ import org.thoughtcrime.securesms.database.model.MediaMmsMessageRecord;
|
||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||
import org.thoughtcrime.securesms.database.model.MmsMessageRecord;
|
||||
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
||||
import org.thoughtcrime.securesms.loki.protocol.SessionMetaProtocol;
|
||||
import org.thoughtcrime.securesms.mms.Slide;
|
||||
import org.thoughtcrime.securesms.mms.SlideDeck;
|
||||
|
||||
@@ -410,6 +411,7 @@ public class ThreadDatabase extends Database {
|
||||
deleteThread(threadId);
|
||||
notifyConversationListeners(threadId);
|
||||
notifyConversationListListeners();
|
||||
SessionMetaProtocol.clearReceivedMessages();
|
||||
}
|
||||
|
||||
public boolean hasThread(long threadId) {
|
||||
|
@@ -24,6 +24,15 @@ object SessionMetaProtocol {
|
||||
timestamps.add(timestamp)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun clearReceivedMessages() {
|
||||
timestamps.clear()
|
||||
}
|
||||
|
||||
fun removeTimestamps(timestamps: Set<Long>) {
|
||||
this.timestamps.removeAll(timestamps)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun shouldIgnoreMessage(timestamp: Long): Boolean {
|
||||
val shouldIgnoreMessage = timestamps.contains(timestamp)
|
||||
|
Reference in New Issue
Block a user