Added a signal to emit after the AccountPayloadManager processes the multiaccounts.Account (#3228)

This commit is contained in:
Samuel Hawksby-Robinson 2023-02-27 11:46:46 +00:00 committed by GitHub
parent d0cc036d48
commit 90d4dde64b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -4,16 +4,18 @@ package pairing
type EventType string
const (
// Both Sender and Receiver
// both client and server
EventConnectionError EventType = "connection-error"
EventConnectionSuccess EventType = "connection-success"
EventTransferError EventType = "transfer-error"
EventTransferSuccess EventType = "transfer-success"
// Only receiver side
EventProcessSuccess EventType = "process-success"
EventProcessError EventType = "process-error"
// Only Receiver side
EventReceivedAccount EventType = "received-account"
EventProcessSuccess EventType = "process-success"
EventProcessError EventType = "process-error"
)
// Event is a type for transfer events.
@ -21,6 +23,7 @@ type Event struct {
Type EventType `json:"type"`
Error string `json:"error,omitempty"`
Action Action `json:"action"`
Data any `json:"data,omitempty"`
}
type Action int

View File

@ -19,6 +19,7 @@ import (
"github.com/status-im/status-go/params"
"github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/signal"
)
var (
@ -253,6 +254,8 @@ func (apm *AccountPayloadManager) Receive(data []byte) error {
zap.Binary("accountPayloadMarshaller.Received()", apm.Received()),
)
signal.SendLocalPairingEvent(Event{Type: EventReceivedAccount, Action: ActionPairingAccount, Data: apm.accountPayload.multiaccount})
return apm.payloadRepository.StoreToSource()
}