get messenger from account service when local pairing (#3069)

This commit is contained in:
frank 2023-01-11 19:30:54 +08:00 committed by GitHub
parent 04de916cba
commit dc87d6bb0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -1353,9 +1353,9 @@ func (b *GethStatusBackend) SignGroupMembership(content string) (string, error)
func (b *GethStatusBackend) Messenger() *protocol.Messenger {
node := b.StatusNode()
if node != nil {
wakuExtService := node.WakuExtService()
if wakuExtService != nil {
return wakuExtService.Messenger()
accountService := node.AccountService()
if accountService != nil {
return accountService.GetMessenger()
}
}
return nil

View File

@ -30,7 +30,7 @@ func NewSyncRawMessageHandler(backend *api.GethStatusBackend) *SyncRawMessageHan
func (s *SyncRawMessageHandler) PrepareRawMessage(keyUID string) ([]byte, error) {
messenger := s.backend.Messenger()
if messenger == nil {
return nil, fmt.Errorf("messenger is nil when handlePairingSyncDeviceSend")
return nil, fmt.Errorf("messenger is nil when PrepareRawMessage")
}
currentAccount, err := s.backend.GetActiveAccount()
@ -112,6 +112,9 @@ func (s *SyncRawMessageHandler) HandleRawMessage(account *multiaccounts.Account,
}
messenger := s.backend.Messenger()
if messenger == nil {
return fmt.Errorf("messenger is nil when HandleRawMessage")
}
return messenger.HandleSyncRawMessages(rawMessages)
}

View File

@ -78,3 +78,7 @@ func (s *Service) GetAccountsByKeyUID(keyUID string) ([]*accounts.Account, error
func (s *Service) GetSettings() (settings.Settings, error) {
return s.db.GetSettings()
}
func (s *Service) GetMessenger() *protocol.Messenger {
return s.messenger
}