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

View File

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