Skip to content

Commit

Permalink
fix inserting the same contact multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
migulyaev committed Sep 12, 2023
1 parent 46da2ad commit fb249e4
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,19 @@ class ContactsRepositoryImpl @Inject constructor(
)

if (existingContact == null || existingContact.status <= ContactPairingStatus.REQUEST_SENT) {
contactsDao.insert(
contact.copy(
status = ContactPairingStatus.REQUEST_SENT,
),
)
if (existingContact == null) {
contactsDao.insert(
contact.copy(
status = ContactPairingStatus.REQUEST_SENT,
),
)
} else {
contactsDao.update(
contact.copy(
status = ContactPairingStatus.REQUEST_SENT
)
)
}
awalaManager.sendMessage(
outgoingMessage = AwalaOutgoingMessage(
type = MessageType.ContactPairingRequest,
Expand Down

0 comments on commit fb249e4

Please sign in to comment.