mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-11 12:37:26 +00:00
Fix compilation issues
This commit is contained in:
@@ -35,6 +35,7 @@ import org.session.libsession.messaging.sending_receiving.handleVisibleMessage
|
||||
import org.session.libsession.messaging.utilities.Data
|
||||
import org.session.libsession.messaging.utilities.SodiumUtilities
|
||||
import org.session.libsession.utilities.SSKEnvironment
|
||||
import org.session.libsession.utilities.UserConfigType
|
||||
import org.session.libsignal.protos.UtilProtos
|
||||
import org.session.libsignal.utilities.AccountId
|
||||
import org.session.libsignal.utilities.IdPrefix
|
||||
@@ -103,24 +104,23 @@ class BatchMessageReceiveJob(
|
||||
executeAsync(dispatcherName)
|
||||
}
|
||||
|
||||
private fun isHidden(message: Message): Boolean{
|
||||
private fun isHidden(message: Message): Boolean {
|
||||
// if the contact is marked as hidden for 1on1 messages
|
||||
// and the message's sentTimestamp is earlier than the sentTimestamp of the last config
|
||||
val config = MessagingModuleConfiguration.shared.configFactory
|
||||
val configFactory = MessagingModuleConfiguration.shared.configFactory
|
||||
val publicKey = MessagingModuleConfiguration.shared.storage.getUserPublicKey()
|
||||
if(config.contacts == null || message.sentTimestamp == null || publicKey == null) return false
|
||||
val contactConfigTimestamp = config.getConfigTimestamp(config.contacts!!, publicKey)
|
||||
if(message.groupPublicKey == null && // not a group
|
||||
message.openGroupServerMessageID == null && // not a community
|
||||
// not marked as hidden
|
||||
config.contacts?.get(message.senderOrSync)?.priority == ConfigBase.PRIORITY_HIDDEN &&
|
||||
// the message's sentTimestamp is earlier than the sentTimestamp of the last config
|
||||
message.sentTimestamp!! < contactConfigTimestamp
|
||||
) {
|
||||
return true
|
||||
}
|
||||
if (message.sentTimestamp == null || publicKey == null) return false
|
||||
|
||||
return false
|
||||
val contactConfigTimestamp = configFactory.getConfigTimestamp(UserConfigType.CONTACTS, publicKey)
|
||||
|
||||
return configFactory.withUserConfigs { configs ->
|
||||
message.groupPublicKey == null && // not a group
|
||||
message.openGroupServerMessageID == null && // not a community
|
||||
// not marked as hidden
|
||||
configs.contacts.get(message.senderOrSync)?.priority == ConfigBase.PRIORITY_HIDDEN &&
|
||||
// the message's sentTimestamp is earlier than the sentTimestamp of the last config
|
||||
message.sentTimestamp!! < contactConfigTimestamp
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun executeAsync(dispatcherName: String) {
|
||||
|
@@ -5,7 +5,6 @@ import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.onStart
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
import network.loki.messenger.libsession_util.ConfigBase
|
||||
import network.loki.messenger.libsession_util.MutableConfig
|
||||
import network.loki.messenger.libsession_util.MutableContacts
|
||||
import network.loki.messenger.libsession_util.MutableConversationVolatileConfig
|
||||
@@ -196,8 +195,18 @@ interface MutableGroupConfigs : GroupConfigs {
|
||||
|
||||
|
||||
sealed interface ConfigUpdateNotification {
|
||||
/**
|
||||
* The user configs have been modified locally.
|
||||
*/
|
||||
data object UserConfigsModified : ConfigUpdateNotification
|
||||
data class UserConfigsMerged(val timestamp: Long) : ConfigUpdateNotification
|
||||
|
||||
/**
|
||||
* The user configs have been merged from the server.
|
||||
*/
|
||||
data class UserConfigsMerged(
|
||||
val configType: UserConfigType,
|
||||
val timestamp: Long
|
||||
) : ConfigUpdateNotification
|
||||
|
||||
data class GroupConfigsUpdated(val groupId: AccountId) : ConfigUpdateNotification
|
||||
}
|
||||
|
Reference in New Issue
Block a user