utils

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeImageDistro is a reletive path to any of the distributed images in cwtch/ui in the assets folder
	TypeImageDistro = "distro"
	// TypeImageComposition will be an face image composed of a recipe of parts like faceType, eyeType, etc
	TypeImageComposition = "composition"
)

Image types we support

View Source
const (
	Warn  = event.Field("Warn")
	Error = event.Field("Error")
	Debug = event.Field("Debug")
	Info  = event.Field("Info")
)

Logging Levels as Event Fields. Note: Unlike most event we don't cae about the *value* of the field, only the presence. If more than one of these fields is present in a single SetLoggingLevel event then the highest logging level is used. INFO < WARN < ERROR < DEBUG

View Source
const (
	CwtchStarted         = event.Type("CwtchStarted")
	CwtchStartError      = event.Type("CwtchStartError")
	UpdateGlobalSettings = event.Type("UpdateGlobalSettings")
)
View Source
const GlobalSettingsFilename = "ui.globals"
View Source
const (
	SetLoggingLevel = event.Type("SetLoggingLevel")
)

An event to set the logging level dynamically from the UI

Variables

View Source
var DefaultGlobalSettings = GlobalSettings{
	Locale:                  "en",
	Theme:                   "dark",
	PreviousPid:             -1,
	ExperimentsEnabled:      false,
	Experiments:             make(map[string]bool),
	StateRootPane:           0,
	FirstTime:               true,
	BlockUnknownConnections: false,
	StreamerMode:            false,
	UIColumnModePortrait:    "DualpaneMode.Single",
	UIColumnModeLandscape:   "DualpaneMode.CopyPortrait",
	DownloadPath:            "",
}
View Source
var GlobalSettingsFile v1.FileStore

Functions

func ImageToString

func ImageToString(img *image) string

func InitGlobalSettingsFile

func InitGlobalSettingsFile(directory string, password string) error

func NewImage

func NewImage(val, t string) *image

func RandomGroupImage

func RandomGroupImage(handle string) string

func RandomProfileImage

func RandomProfileImage(onion string) string

temporary until we do real picture selection

func StringToImage

func StringToImage(str string) (*image, error)

func WriteGlobalSettings

func WriteGlobalSettings(globalSettings GlobalSettings)

Types

type Contact

type Contact struct {
	Name        string `json:"name"`
	Onion       string `json:"onion"`
	Status      string `json:"status"`
	Picture     string `json:"picture"`
	Accepted    bool   `json:"accepted"`
	Blocked     bool   `json:"blocked"`
	SaveHistory string `json:"saveConversationHistory"`
	Messages    int    `json:"numMessages"`
	Unread      int    `json:"numUnread"`
	LastMessage string `json:"lastMsgTime"`
	IsGroup     bool   `json:"isGroup"`
	GroupServer string `json:"groupServer"`
	IsArchived  bool   `json:"isArchived"`
	Identifier  int    `json:"identifier"`
}

type EventHandler

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

func NewEventHandler

func NewEventHandler() *EventHandler

func (*EventHandler) GetNextEvent

func (eh *EventHandler) GetNextEvent() string

func (*EventHandler) HandleApp

func (eh *EventHandler) HandleApp(application app.Application)

func (*EventHandler) Push

func (eh *EventHandler) Push(newEvent event.Event)

Push pushes an event onto the app event bus

It is also a way for libCwtch-go to publish an event for consumption by a UI before a Cwtch app has been initialized
  use: to signal an error before a cwtch app could be created

type EventProfileEnvelope

type EventProfileEnvelope struct {
	Event   event.Event
	Profile string
}

type GlobalSettings

type GlobalSettings struct {
	Locale                  string
	Theme                   string
	ThemeMode               string
	PreviousPid             int64
	ExperimentsEnabled      bool
	Experiments             map[string]bool
	BlockUnknownConnections bool
	StreamerMode            bool
	StateRootPane           int
	FirstTime               bool
	UIColumnModePortrait    string
	UIColumnModeLandscape   string
	DownloadPath            string
}

func ReadGlobalSettings

func ReadGlobalSettings() *GlobalSettings

Jump to

Keyboard shortcuts

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