mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 10:35:19 +00:00
Handle syncing of blocked contacts
This commit is contained in:
parent
662d9c7c63
commit
5344d6aa64
@ -93,11 +93,13 @@ object SyncMessagesProtocol {
|
|||||||
if (!allUserDevices.contains(content.sender)) { return }
|
if (!allUserDevices.contains(content.sender)) { return }
|
||||||
Log.d("Loki", "Received a contact sync message.")
|
Log.d("Loki", "Received a contact sync message.")
|
||||||
val contactsInputStream = DeviceContactsInputStream(message.contactsStream.asStream().inputStream)
|
val contactsInputStream = DeviceContactsInputStream(message.contactsStream.asStream().inputStream)
|
||||||
val contactPublicKeys = contactsInputStream.readAll().map { it.number }
|
val contacts = contactsInputStream.readAll()
|
||||||
for (contactPublicKey in contactPublicKeys) {
|
for (contact in contacts) {
|
||||||
|
val contactPublicKey = contact.number
|
||||||
if (contactPublicKey == userPublicKey || !PublicKeyValidation.isValid(contactPublicKey)) { return }
|
if (contactPublicKey == userPublicKey || !PublicKeyValidation.isValid(contactPublicKey)) { return }
|
||||||
val applicationContext = context.applicationContext as ApplicationContext
|
val applicationContext = context.applicationContext as ApplicationContext
|
||||||
applicationContext.sendSessionRequestIfNeeded(contactPublicKey)
|
applicationContext.sendSessionRequestIfNeeded(contactPublicKey)
|
||||||
|
DatabaseFactory.getRecipientDatabase(context).setBlocked(recipient(context, contactPublicKey), contact.isBlocked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user