diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index f71d14262b..f0358adbf8 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -915,10 +915,6 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe // show or hide loading indicator binding.loader.isVisible = state.showLoader - - if (state.isMessageRequestAccepted == true) { - binding.messageRequestBar.visibility = View.GONE - } } } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt index 5f24566017..cf0ab176e6 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt @@ -41,10 +41,8 @@ import org.session.libsignal.utilities.AccountId import org.thoughtcrime.securesms.audio.AudioSlidePlayer import org.thoughtcrime.securesms.conversation.v2.menus.ConversationMenuHelper import org.thoughtcrime.securesms.database.GroupDatabase -import org.thoughtcrime.securesms.database.ThreadDatabase import org.thoughtcrime.securesms.database.LokiMessageDatabase import org.thoughtcrime.securesms.database.ReactionDatabase -import org.thoughtcrime.securesms.database.Storage import org.thoughtcrime.securesms.database.ThreadDatabase import org.thoughtcrime.securesms.database.model.MessageId import org.thoughtcrime.securesms.database.model.MessageRecord diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/MmsDatabase.kt b/app/src/main/java/org/thoughtcrime/securesms/database/MmsDatabase.kt index 0e5f858dd4..5fe29979bd 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/MmsDatabase.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/MmsDatabase.kt @@ -1219,7 +1219,12 @@ class MmsDatabase(context: Context, databaseHelper: SQLCipherOpenHelper) : Messa var cursor: Cursor? = null try { val db = databaseHelper.readableDatabase - var where = "$THREAD_ID = ? AND $DATE_SENT < $date" + var where = + THREAD_ID + " = ? AND (CASE (" + MESSAGE_BOX + " & " + MmsSmsColumns.Types.BASE_TYPE_MASK + ") " + for (outgoingType in MmsSmsColumns.Types.OUTGOING_MESSAGE_TYPES) { + where += " WHEN $outgoingType THEN $DATE_SENT < $date" + } + where += " ELSE $DATE_RECEIVED < $date END)" if (onlyMedia) where += " AND $PART_COUNT >= 1" cursor = db.query( TABLE_NAME, diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt index 3c4e302a34..af4845b564 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt @@ -1779,8 +1779,7 @@ open class Storage @Inject constructor( val messageId = if (localId != null && localId > 0 && isMms != null) { // bail early is the message is marked as deleted - val messagingDatabase: MessagingDatabase = if (isMms == true) DatabaseComponent.get(context).mmsDatabase() - else DatabaseComponent.get(context).smsDatabase() + val messagingDatabase: MessagingDatabase = if (isMms == true) mmsDatabase else smsDatabase if(messagingDatabase.getMessageRecord(localId)?.isDeleted == true) return MessageId(localId, isMms) diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java b/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java index 4ba8ed4ae4..8868173b00 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java @@ -308,7 +308,7 @@ public class ThreadDatabase extends Database { public void trimThreadBefore(long threadId, long timestamp) { Log.i("ThreadDatabase", "Trimming thread: " + threadId + " before :"+timestamp); DatabaseComponent.get(context).smsDatabase().deleteMessagesInThreadBeforeDate(threadId, timestamp); - DatabaseComponent.get(context).mmsDatabase().deleteMessagesInThreadBeforeDate(threadId, timestamp); + DatabaseComponent.get(context).mmsDatabase().deleteMessagesInThreadBeforeDate(threadId, timestamp, false); update(threadId, false); notifyConversationListeners(threadId); }