localnotifications

package
v0.142.5 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CategoryTransaction            PushCategory = "transaction"
	CategoryMessage                PushCategory = "newMessage"
	CategoryGroupInvite            PushCategory = "groupInvite"
	CategoryCommunityRequestToJoin              = "communityRequestToJoin"

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

Variables

This section is empty.

Functions

func PushMessages added in v0.74.2

func PushMessages(ns []*Notification)

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
	Platform            float32
	Body                NotificationBody
	BodyType            NotificationType
	Title               string
	Message             string
	Category            PushCategory
	Deeplink            string
	Image               string
	IsScheduled         bool
	ScheduledTime       string
	IsConversation      bool
	IsGroupConversation bool
	ConversationID      string
	Timestamp           uint64
	Author              NotificationAuthor
	Deleted             bool
}

func (*Notification) MarshalJSON added in v0.68.4

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

type NotificationAuthor added in v0.74.2

type NotificationAuthor struct {
	ID   string `json:"id"`
	Icon string `json:"icon"`
	Name string `json:"name"`
}

type NotificationBody added in v0.74.2

type NotificationBody interface {
	json.Marshaler
}

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, chainID uint64) (*Service, error)

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() 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"`
	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