Skip to content

Commit

Permalink
Resend on new contact
Browse files Browse the repository at this point in the history
  • Loading branch information
cammellos committed Sep 30, 2021
1 parent 4645e84 commit a73aaab
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.89.1
0.89.2
20 changes: 20 additions & 0 deletions protocol/messenger_contacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ func (m *Messenger) AddContact(ctx context.Context, pubKey string) (*MessengerRe
return nil, err
}

// Publish contact code
err = m.publishContactCode()
if err != nil {
return nil, err
}

return response, nil
}

Expand Down Expand Up @@ -229,6 +235,20 @@ func (m *Messenger) saveContact(contact *Contact) error {

// Reregister only when data has changed
if shouldReregisterForPushNotifications {
// Reset last published time for ChatIdentity so new contact can receive data
contactCodeTopic := transport.ContactCodeTopic(&m.identity.PublicKey)
m.logger.Debug("contact state changed ResetWhenChatIdentityLastPublished")
err = m.persistence.ResetWhenChatIdentityLastPublished(contactCodeTopic)
if err != nil {
m.logger.Error("ResetWhenChatIdentityLastPublished error", zap.Error(err))
return err
}
// Publish contact code
err := m.publishContactCode()
if err != nil {
return err
}

return m.reregisterForPushNotifications()
}

Expand Down

0 comments on commit a73aaab

Please sign in to comment.