localnotifications

package
v0.73.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2021 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CategoryTransaction PushCategory = "transaction"
	CategoryMessage     PushCategory = "newMessage"

	TypeTransaction NotificationType = "transaction"
	TypeMessage     NotificationType = "message"
)

Variables

This section is empty.

Functions

func SendMessageNotifications added in v0.68.4

func SendMessageNotifications(mnb []protocol.MessageNotificationBody)

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(s *Service) *API

func (*API) NotificationPreferences

func (api *API) NotificationPreferences(ctx context.Context) ([]NotificationPreference, error)

func (*API) SwitchWalletNotifications

func (api *API) SwitchWalletNotifications(ctx context.Context, preference bool) error

type CustomEvent

type CustomEvent struct{}

CustomEvent - structure used to pass custom user set messages to bus

type Database

type Database struct {
	// contains filtered or unexported fields
}

func NewDB

func NewDB(db *sql.DB, network uint64) *Database

func (*Database) ChangeWalletPreference

func (db *Database) ChangeWalletPreference(preference bool) error

func (*Database) GetPreferences

func (db *Database) GetPreferences() (rst []NotificationPreference, err error)

func (*Database) GetWalletPreference

func (db *Database) GetWalletPreference() (rst NotificationPreference, err error)

type MessageEvent

type MessageEvent struct{}

MessageEvent - structure used to pass messages from chat to bus

type Notification

type Notification struct {
	ID            common.Hash `json:"id"`
	Platform      float32     `json:"platform,omitempty"`
	Body          interface{}
	BodyType      NotificationType `json:"bodyType"`
	Category      PushCategory     `json:"category,omitempty"`
	Deeplink      string           `json:"deepLink,omitempty"`
	Image         string           `json:"imageUrl,omitempty"`
	IsScheduled   bool             `json:"isScheduled,omitempty"`
	ScheduledTime string           `json:"scheduleTime,omitempty"`
}

func (*Notification) MarshalJSON added in v0.68.4

func (n *Notification) MarshalJSON() ([]byte, error)

func (*Notification) UnmarshalJSON added in v0.68.4

func (n *Notification) UnmarshalJSON(data []byte) error

type NotificationPreference

type NotificationPreference struct {
	Enabled    bool   `json:"enabled"`
	Service    string `json:"service"`
	Event      string `json:"event,omitempty"`
	Identifier string `json:"identifier,omitempty"`
}

type NotificationType added in v0.68.4

type NotificationType string

type PushCategory

type PushCategory string

type Service

type Service struct {
	WatchingEnabled bool
	// contains filtered or unexported fields
}

Service keeps the state of message bus

func NewService

func NewService(appDB *sql.DB, network uint64) *Service

func (*Service) APIs

func (s *Service) APIs() []rpc.API

APIs returns list of available RPC APIs.

func (*Service) IsStarted

func (s *Service) IsStarted() bool

func (*Service) IsWatchingWallet

func (s *Service) IsWatchingWallet() bool

IsWatchingWallet - check if local-notifications are subscribed to wallet updates

func (*Service) Protocols

func (s *Service) Protocols() []p2p.Protocol

Protocols returns list of p2p protocols.

func (*Service) Start

func (s *Service) Start(_ *p2p.Server) error

Start Worker which processes all incoming messages

func (*Service) StartWalletWatcher

func (s *Service) StartWalletWatcher()

StartWalletWatcher - Forward wallet events to notifications

func (*Service) Stop

func (s *Service) Stop() error

Stop worker

func (*Service) StopWalletWatcher

func (s *Service) StopWalletWatcher()

StopWalletWatcher - stops watching for new wallet events

func (*Service) SubscribeWallet

func (s *Service) SubscribeWallet(publisher *event.Feed) error

SubscribeWallet - Subscribes to wallet signals

type TransactionEvent

type TransactionEvent struct {
	Type                      string                      `json:"type"`
	BlockNumber               *big.Int                    `json:"block-number"`
	Accounts                  []common.Address            `json:"accounts"`
	NewTransactionsPerAccount map[common.Address]int      `json:"new-transactions"`
	ERC20                     bool                        `json:"erc20"`
	MaxKnownBlocks            map[common.Address]*big.Int `json:"max-known-blocks"`
}

TransactionEvent - structure used to pass messages from wallet to bus

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL