mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25: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 }
|
||||
Log.d("Loki", "Received a contact sync message.")
|
||||
val contactsInputStream = DeviceContactsInputStream(message.contactsStream.asStream().inputStream)
|
||||
val contactPublicKeys = contactsInputStream.readAll().map { it.number }
|
||||
for (contactPublicKey in contactPublicKeys) {
|
||||
val contacts = contactsInputStream.readAll()
|
||||
for (contact in contacts) {
|
||||
val contactPublicKey = contact.number
|
||||
if (contactPublicKey == userPublicKey || !PublicKeyValidation.isValid(contactPublicKey)) { return }
|
||||
val applicationContext = context.applicationContext as ApplicationContext
|
||||
applicationContext.sendSessionRequestIfNeeded(contactPublicKey)
|
||||
DatabaseFactory.getRecipientDatabase(context).setBlocked(recipient(context, contactPublicKey), contact.isBlocked)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user