Resend on new contact

This commit is contained in:
Andrea Maria Piana 2021-09-29 09:21:05 +01:00
parent d9ea6a910e
commit 51493d61bd
2 changed files with 21 additions and 1 deletions

View File

@ -1 +1 @@
0.89.1
0.89.2

View File

@ -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
}
@ -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()
}