Skip to content

Commit

Permalink
fix: Encode profile picture correctly when pairing with new contact
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea committed Apr 25, 2024
1 parent d2aecb3 commit c5fa6a9
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import tech.relaycorp.letro.awala.message.MessageType
import tech.relaycorp.letro.awala.processor.ServerMessageProcessor
import tech.relaycorp.letro.contacts.model.ContactPairingStatus
import tech.relaycorp.letro.contacts.pairing.notification.ContactPairingNotificationManager
import tech.relaycorp.letro.contacts.pairing.server.photo.parser.ContactPhotoUpdatedMessageEncoder
import tech.relaycorp.letro.contacts.storage.dao.ContactsDao
import tech.relaycorp.letro.utils.Logger
import java.io.File
Expand All @@ -20,6 +21,7 @@ class ContactPairingAuthorizationProcessor @Inject constructor(
private val contactsDao: ContactsDao,
private val contactPairingNotificationManager: ContactPairingNotificationManager,
private val accountsDao: AccountDao,
private val messageEncoder: ContactPhotoUpdatedMessageEncoder,
parser: ContactPairingAuthorizationParser,
logger: Logger,
) : ServerMessageProcessor<AwalaIncomingMessageContent.ContactPairingAuthorization>(parser, logger) {
Expand Down Expand Up @@ -69,7 +71,10 @@ class ContactPairingAuthorizationProcessor @Inject constructor(
awalaManager.sendMessage(
outgoingMessage = AwalaOutgoingMessage(
type = MessageType.ContactPhotoUpdated,
content = avatarFile.readBytes(),
content = messageEncoder.encode(
photo = avatarFile.readBytes(),
extension = avatarFile.extension,
),
),
recipient = AwalaEndpoint.Private(
nodeId = contact.contactEndpointId,
Expand Down

0 comments on commit c5fa6a9

Please sign in to comment.