mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-20 08:57:44 +00:00
fix: open groups update the sent timestamp locally to be the returned group
This commit is contained in:
@@ -281,6 +281,15 @@ public class MmsDatabase extends MessagingDatabase {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateSentTimestamp(long messageId, long newTimestamp, long threadId) {
|
||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||
db.execSQL("UPDATE " + TABLE_NAME + " SET " + DATE_SENT + " = ? " +
|
||||
"WHERE " + ID + " = ?",
|
||||
new String[] {newTimestamp + "", messageId + ""});
|
||||
notifyConversationListeners(threadId);
|
||||
notifyConversationListListeners();
|
||||
}
|
||||
|
||||
public long getThreadIdForMessage(long id) {
|
||||
String sql = "SELECT " + THREAD_ID + " FROM " + TABLE_NAME + " WHERE " + ID + " = ?";
|
||||
String[] sqlArgs = new String[] {id+""};
|
||||
|
@@ -20,8 +20,6 @@ package org.thoughtcrime.securesms.database;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Pair;
|
||||
|
||||
@@ -320,6 +318,15 @@ public class SmsDatabase extends MessagingDatabase {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void updateSentTimestamp(long messageId, long newTimestamp, long threadId) {
|
||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||
db.execSQL("UPDATE " + TABLE_NAME + " SET " + DATE_SENT + " = ? " +
|
||||
"WHERE " + ID + " = ?",
|
||||
new String[] {newTimestamp + "", messageId + ""});
|
||||
notifyConversationListeners(threadId);
|
||||
notifyConversationListListeners();
|
||||
}
|
||||
|
||||
public Pair<Long, Long> updateBundleMessageBody(long messageId, String body) {
|
||||
long type = Types.BASE_INBOX_TYPE | Types.SECURE_MESSAGE_BIT | Types.PUSH_MESSAGE_BIT;
|
||||
return updateMessageBodyAndType(messageId, body, Types.TOTAL_MASK, type);
|
||||
|
@@ -27,12 +27,11 @@ import org.session.libsignal.messages.SignalServiceGroup
|
||||
import org.session.libsignal.utilities.KeyHelper
|
||||
import org.session.libsignal.utilities.guava.Optional
|
||||
import org.thoughtcrime.securesms.ApplicationContext
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
|
||||
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper
|
||||
import org.thoughtcrime.securesms.jobs.RetrieveProfileAvatarJob
|
||||
import org.thoughtcrime.securesms.groups.OpenGroupManager
|
||||
import org.thoughtcrime.securesms.util.SessionMetaProtocol
|
||||
import org.thoughtcrime.securesms.jobs.RetrieveProfileAvatarJob
|
||||
import org.thoughtcrime.securesms.mms.PartAuthority
|
||||
import org.thoughtcrime.securesms.util.SessionMetaProtocol
|
||||
|
||||
class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper), StorageProtocol {
|
||||
|
||||
@@ -284,6 +283,21 @@ class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context,
|
||||
return database.getMessageFor(timestamp, address)?.getId()
|
||||
}
|
||||
|
||||
override fun updateSentTimestamp(
|
||||
messageID: Long,
|
||||
isMms: Boolean,
|
||||
openGroupSentTimestamp: Long,
|
||||
threadId: Long
|
||||
) {
|
||||
if (isMms) {
|
||||
val mmsDb = DatabaseFactory.getMmsDatabase(context)
|
||||
mmsDb.updateSentTimestamp(messageID, openGroupSentTimestamp, threadId)
|
||||
} else {
|
||||
val smsDb = DatabaseFactory.getSmsDatabase(context)
|
||||
smsDb.updateSentTimestamp(messageID, openGroupSentTimestamp, threadId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun markAsSent(timestamp: Long, author: String) {
|
||||
val database = DatabaseFactory.getMmsSmsDatabase(context)
|
||||
val messageRecord = database.getMessageFor(timestamp, author) ?: return
|
||||
|
Reference in New Issue
Block a user