mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-24 12:40:24 +00:00
Reduce DB updates on send path, move support SDK up to 24
// FREEBIE
This commit is contained in:
@@ -204,14 +204,12 @@ public abstract class CursorRecyclerViewAdapter<VH extends RecyclerView.ViewHold
|
||||
public void onChanged() {
|
||||
super.onChanged();
|
||||
valid = true;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInvalidated() {
|
||||
super.onInvalidated();
|
||||
valid = false;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class EncryptingSmsDatabase extends SmsDatabase {
|
||||
OutgoingTextMessage message, boolean forceSms,
|
||||
long timestamp)
|
||||
{
|
||||
long type = Types.BASE_OUTBOX_TYPE;
|
||||
long type = Types.BASE_SENDING_TYPE;
|
||||
|
||||
if (masterSecret.getMasterSecret().isPresent()) {
|
||||
message = message.withBody(getEncryptedBody(masterSecret.getMasterSecret().get(), message.getMessageBody()));
|
||||
|
||||
@@ -382,11 +382,11 @@ public class MmsDatabase extends MessagingDatabase {
|
||||
notifyConversationListeners(threadId);
|
||||
}
|
||||
|
||||
public void markAsSending(long messageId) {
|
||||
long threadId = getThreadIdForMessage(messageId);
|
||||
updateMailboxBitmask(messageId, Types.BASE_TYPE_MASK, Types.BASE_SENDING_TYPE, Optional.of(threadId));
|
||||
notifyConversationListeners(threadId);
|
||||
}
|
||||
// public void markAsSending(long messageId) {
|
||||
// long threadId = getThreadIdForMessage(messageId);
|
||||
// updateMailboxBitmask(messageId, Types.BASE_TYPE_MASK, Types.BASE_SENDING_TYPE, Optional.of(threadId));
|
||||
// notifyConversationListeners(threadId);
|
||||
// }
|
||||
|
||||
public void markAsSentFailed(long messageId) {
|
||||
long threadId = getThreadIdForMessage(messageId);
|
||||
@@ -394,9 +394,9 @@ public class MmsDatabase extends MessagingDatabase {
|
||||
notifyConversationListeners(threadId);
|
||||
}
|
||||
|
||||
public void markAsSent(long messageId) {
|
||||
public void markAsSent(long messageId, boolean secure) {
|
||||
long threadId = getThreadIdForMessage(messageId);
|
||||
updateMailboxBitmask(messageId, Types.BASE_TYPE_MASK, Types.BASE_SENT_TYPE, Optional.of(threadId));
|
||||
updateMailboxBitmask(messageId, Types.BASE_TYPE_MASK, Types.BASE_SENT_TYPE | (secure ? Types.PUSH_MESSAGE_BIT | Types.SECURE_MESSAGE_BIT : 0), Optional.of(threadId));
|
||||
notifyConversationListeners(threadId);
|
||||
}
|
||||
|
||||
@@ -414,17 +414,17 @@ public class MmsDatabase extends MessagingDatabase {
|
||||
notifyConversationListeners(threadId);
|
||||
}
|
||||
|
||||
public void markAsSecure(long messageId) {
|
||||
updateMailboxBitmask(messageId, 0, Types.SECURE_MESSAGE_BIT, Optional.<Long>absent());
|
||||
}
|
||||
// public void markAsSecure(long messageId) {
|
||||
// updateMailboxBitmask(messageId, 0, Types.SECURE_MESSAGE_BIT, Optional.<Long>absent());
|
||||
// }
|
||||
|
||||
public void markAsInsecure(long messageId) {
|
||||
updateMailboxBitmask(messageId, Types.SECURE_MESSAGE_BIT, 0, Optional.<Long>absent());
|
||||
}
|
||||
|
||||
public void markAsPush(long messageId) {
|
||||
updateMailboxBitmask(messageId, 0, Types.PUSH_MESSAGE_BIT, Optional.<Long>absent());
|
||||
}
|
||||
// public void markAsPush(long messageId) {
|
||||
// updateMailboxBitmask(messageId, 0, Types.PUSH_MESSAGE_BIT, Optional.<Long>absent());
|
||||
// }
|
||||
|
||||
public void markAsDecryptFailed(long messageId, long threadId) {
|
||||
updateMailboxBitmask(messageId, Types.ENCRYPTION_MASK, Types.ENCRYPTION_REMOTE_FAILED_BIT, Optional.of(threadId));
|
||||
@@ -847,12 +847,12 @@ public class MmsDatabase extends MessagingDatabase {
|
||||
long threadId, boolean forceSms)
|
||||
throws MmsException
|
||||
{
|
||||
long type = Types.BASE_OUTBOX_TYPE;
|
||||
long type = Types.BASE_SENDING_TYPE;
|
||||
|
||||
if (masterSecret.getMasterSecret().isPresent()) type |= Types.ENCRYPTION_SYMMETRIC_BIT;
|
||||
else type |= Types.ENCRYPTION_ASYMMETRIC_BIT;
|
||||
|
||||
if (message.isSecure()) type |= Types.SECURE_MESSAGE_BIT;
|
||||
if (message.isSecure()) type |= (Types.SECURE_MESSAGE_BIT | Types.PUSH_MESSAGE_BIT);
|
||||
if (forceSms) type |= Types.MESSAGE_FORCE_SMS_BIT;
|
||||
|
||||
if (message.isGroup()) {
|
||||
|
||||
@@ -228,12 +228,8 @@ public class SmsDatabase extends MessagingDatabase {
|
||||
updateTypeBitmask(id, Types.BASE_TYPE_MASK, Types.BASE_PENDING_INSECURE_SMS_FALLBACK);
|
||||
}
|
||||
|
||||
public void markAsSending(long id) {
|
||||
updateTypeBitmask(id, Types.BASE_TYPE_MASK, Types.BASE_SENDING_TYPE);
|
||||
}
|
||||
|
||||
public void markAsSent(long id) {
|
||||
updateTypeBitmask(id, Types.BASE_TYPE_MASK, Types.BASE_SENT_TYPE);
|
||||
public void markAsSent(long id, boolean isSecure) {
|
||||
updateTypeBitmask(id, Types.BASE_TYPE_MASK, Types.BASE_SENT_TYPE | (isSecure ? Types.PUSH_MESSAGE_BIT | Types.SECURE_MESSAGE_BIT : 0));
|
||||
}
|
||||
|
||||
public void markExpireStarted(long id) {
|
||||
@@ -575,7 +571,7 @@ public class SmsDatabase extends MessagingDatabase {
|
||||
long type, boolean forceSms, long date)
|
||||
{
|
||||
if (message.isKeyExchange()) type |= Types.KEY_EXCHANGE_BIT;
|
||||
else if (message.isSecureMessage()) type |= Types.SECURE_MESSAGE_BIT;
|
||||
else if (message.isSecureMessage()) type |= (Types.SECURE_MESSAGE_BIT | Types.PUSH_MESSAGE_BIT);
|
||||
else if (message.isEndSession()) type |= Types.END_SESSION_BIT;
|
||||
if (forceSms) type |= Types.MESSAGE_FORCE_SMS_BIT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user