core

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootstrapSubscribed added in v0.0.15

func BootstrapSubscribed(worker *sprout.Worker, subscribed []string) error

func NewWorker added in v0.0.12

func NewWorker(addr string, done <-chan struct{}, s store.ExtendedStore) (*sprout.Worker, error)

NewWorker creates a sprout worker connected to the provided address using TLS over TCP as a transport.

Types

type App

type App interface {
	Notifications() NotificationService
	Arbor() ArborService
	Settings() SettingsService
	Sprout() SproutService
	Theme() ThemeService
	Status() StatusService
	Haptic() HapticService
	Banner() BannerService
	Window() *gioapp.Window
	Shutdown()
}

App bundles core application services into a single convenience type.

func NewApp

func NewApp(w *gioapp.Window, stateDir string) (application App, err error)

NewApp constructs an App or fails with an error. This process will fail if any of the application services fail to initialize correctly.

type ArborService

type ArborService interface {
	Store() store.ExtendedStore
	Communities() *ds.CommunityList
	StartHeartbeat()
}

ArborService provides access to stored arbor data.

type Banner interface {
	BannerPriority() Priority
	Cancel()
	IsCancelled() bool
}

Banner is a type that provides details for a persistent on-screen notification banner

type BannerService added in v0.0.14

type BannerService interface {
	// Add establishes a new banner managed by the service.
	Add(Banner)
	// Top returns the banner that should be displayed right now
	Top() Banner
}

BannerService provides methods for creating and managing on-screen persistent banners. The methods must be safe for concurrent use.

func NewBannerService added in v0.0.14

func NewBannerService(app App) BannerService

type HapticService added in v0.0.13

type HapticService interface {
	UpdateAndroidViewRef(uintptr)
	Buzz()
}

HapticService provides access to haptic feedback devices features.

type LoadingBanner added in v0.0.14

type LoadingBanner struct {
	Priority
	Text string
	// contains filtered or unexported fields
}

LoadingBanner requests a banner with a loading spinner displayed along with the provided text. It will not disappear until cancelled.

func (*LoadingBanner) BannerPriority added in v0.0.14

func (l *LoadingBanner) BannerPriority() Priority

func (*LoadingBanner) Cancel added in v0.0.14

func (l *LoadingBanner) Cancel()

func (*LoadingBanner) IsCancelled added in v0.0.14

func (l *LoadingBanner) IsCancelled() bool

type NotificationService

type NotificationService interface {
	Register(store.ExtendedStore)
	Notify(title, content string) error
}

NotificationService provides methods to send notifications and to configure notifications for collections of arbor nodes.

type Priority added in v0.0.14

type Priority uint8
const (
	Debug Priority = iota
	Info
	Warn
	Error
)

type Settings

type Settings struct {
	// relay address to connect to
	Address string

	// user's local identity ID
	ActiveIdentity *fields.QualifiedHash

	// the version of the disclaimer that the user has accepted
	AcknowledgedNoticeVersion int

	// whether notifications are accepted. The nil state indicates that
	// the user has not changed this value, and should be treated as true.
	// TODO(whereswaldon): find a backwards-compatible way to handle this
	// elegantly.
	NotificationsEnabled *bool

	// whether the user wants the app bar anchored at the bottom of the UI
	BottomAppBar bool

	DarkMode bool

	// whether the user wants the navigation drawer to dock to the side of
	// the UI instead of appearing on top
	DockNavDrawer bool

	// whether the user wants to use the beta Orchard store for node storage.
	// Will become default in future release.
	OrchardStore bool

	Subscriptions []string
}

type SettingsService

type SettingsService interface {
	NotificationsGloballyAllowed() bool
	SetNotificationsGloballyAllowed(bool)
	AcknowledgedNoticeVersion() int
	SetAcknowledgedNoticeVersion(version int)
	AddSubscription(id string)
	RemoveSubscription(id string)
	Subscriptions() []string
	Address() string
	SetAddress(string)
	BottomAppBar() bool
	SetBottomAppBar(bool)
	DockNavDrawer() bool
	SetDockNavDrawer(bool)
	DarkMode() bool
	SetDarkMode(bool)
	ActiveArborIdentityID() *fields.QualifiedHash
	Identity() (*forest.Identity, error)
	DataPath() string
	Persist() error
	CreateIdentity(name string) error
	Builder() (*forest.Builder, error)
	UseOrchardStore() bool
	SetUseOrchardStore(bool)
}

SettingsService allows querying, updating, and saving settings.

type SproutService

type SproutService interface {
	ConnectTo(address string) error
	Connections() []string
	WorkerFor(address string) *sprout.Worker
	MarkSelfOffline()
}

type StatusService added in v0.0.12

type StatusService interface {
	Register(store.ExtendedStore)
	IsActive(*fields.QualifiedHash) bool
}

StatusService provides information on the online status of users.

type ThemeService

type ThemeService interface {
	Current() *sprigTheme.Theme
	SetDarkMode(bool)
}

ThemeService provides methods to fetch and manipulate the current application theme.

Jump to

Keyboard shortcuts

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