mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-12 08:13:14 +00:00
feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record
This commit is contained in:
@@ -2,6 +2,7 @@ package org.session.libsession.database
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import network.loki.messenger.libsession_util.ConfigBase
|
||||
import org.session.libsession.messaging.BlindedIdMapping
|
||||
import org.session.libsession.messaging.calls.CallMessageType
|
||||
import org.session.libsession.messaging.contacts.Contact
|
||||
@@ -31,6 +32,7 @@ import org.session.libsession.utilities.recipients.Recipient.RecipientSettings
|
||||
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||
import org.session.libsignal.messages.SignalServiceAttachmentPointer
|
||||
import org.session.libsignal.messages.SignalServiceGroup
|
||||
import network.loki.messenger.libsession_util.util.Contact as LibSessionContact
|
||||
|
||||
interface StorageProtocol {
|
||||
|
||||
@@ -164,6 +166,7 @@ interface StorageProtocol {
|
||||
fun setContact(contact: Contact)
|
||||
fun getRecipientForThread(threadId: Long): Recipient?
|
||||
fun getRecipientSettings(address: Address): RecipientSettings?
|
||||
fun addLibSessionContacts(contacts: List<LibSessionContact>)
|
||||
fun addContacts(contacts: List<ConfigurationMessage.Contact>)
|
||||
|
||||
// Attachments
|
||||
@@ -202,4 +205,7 @@ interface StorageProtocol {
|
||||
fun deleteReactions(messageId: Long, mms: Boolean)
|
||||
fun unblock(toUnblock: List<Recipient>)
|
||||
fun blockedContacts(): List<Recipient>
|
||||
|
||||
// Shared configs
|
||||
fun notifyConfigUpdates(forConfigObject: ConfigBase)
|
||||
}
|
||||
|
||||
@@ -161,7 +161,6 @@ class Poller(private val configFactory: ConfigFactoryProtocol) {
|
||||
}
|
||||
// process new results
|
||||
configFactory.persist(forConfigObject)
|
||||
configFactory.notifyUpdates(forConfigObject)
|
||||
}
|
||||
|
||||
private fun poll(snode: Snode, deferred: Deferred<Unit, Exception>): Promise<Unit, Exception> {
|
||||
|
||||
@@ -11,7 +11,10 @@ interface ConfigFactoryProtocol {
|
||||
val convoVolatile: ConversationVolatileConfig?
|
||||
fun persist(forConfigObject: ConfigBase)
|
||||
fun appendHash(configObject: ConfigBase, hash: String)
|
||||
fun notifyUpdates(forConfigObject: ConfigBase)
|
||||
fun getHashesFor(forConfigObject: ConfigBase): List<String>
|
||||
fun removeHashesFor(config: ConfigBase, deletedHashes: Set<String>): Boolean
|
||||
}
|
||||
|
||||
interface ConfigFactoryUpdateListener {
|
||||
fun notifyUpdates(forConfigObject: ConfigBase)
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package org.session.libsession.utilities
|
||||
import org.session.libsignal.messages.SignalServiceGroup
|
||||
import org.session.libsignal.utilities.Hex
|
||||
import java.io.IOException
|
||||
import kotlin.jvm.Throws
|
||||
|
||||
object GroupUtil {
|
||||
const val CLOSED_GROUP_PREFIX = "__textsecure_group__!"
|
||||
@@ -97,4 +96,10 @@ object GroupUtil {
|
||||
fun doubleDecodeGroupID(groupID: String): ByteArray {
|
||||
return getDecodedGroupIDAsData(getDecodedGroupID(groupID))
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@Throws(IOException::class)
|
||||
fun doubleDecodeGroupId(groupID: String): String {
|
||||
return Hex.toStringCondensed(getDecodedGroupIDAsData(getDecodedGroupID(groupID)))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user