Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Notify ¶
func Notify(n Notification)
func SetCallback ¶
func SetCallback(cb CallbackFunc)
Types ¶
type Action ¶
type Action struct { ID ActionID // globally unique, used in callback Title string Icon string // name of asset within bundle to use as icon; TODO: could support system defined icons as well }
Action is a button action.
type CallbackArgs ¶
type CallbackArgs struct { Category CategoryID Action ActionID UserData UserData // data attached to the notification by the application UserText string // text input by the user (applies to text actions) Err error // any error that occured processing the user data }
CallbackArgs contains the data from a user interaction of a notification.
type CallbackFunc ¶
type CallbackFunc func(CallbackArgs)
CallbackFunc signature. Switch on the action to know how to interpret the dynamic data.
type Category ¶
type Category struct { ID CategoryID Summary string // summarise the category Preview string // hidden preview body placeholder Actions []Action TextInputActions []TextInputAction }
Category defines a set of actions that a notification can reference by ID to have them be applied.
type CategoryID ¶
type CategoryID = string
type Notification ¶
type Notification struct { Title string Subtitle string Body string // UserData is app supplied data that is passed back upon user interaction. UserData UserData // Attachments is a list of image names. // If the image name is an absolute path it will be followed literally. // If the image name is just a base name, the bundle will be searched for it. // The named image must exist on disk, must be PNG, JPEG or GIF and must be // less than 10MB. Attachments []string // Category to apply. If supplied the actions attached on this notification will be // ignored and the pre-existing category used. Category CategoryID // Actions, if supplied here, will provoke an ad-hoc Category to be created to // contain them on the native side. This is for convenience. Actions []Action // button action TextInputActions []TextInputAction // text input action }
Notification describes
type TextInputAction ¶
type TextInputAction struct { ID ActionID // globally unique, used in callback Title string Icon string // name of asset within bundle to use as icon; TODO: could support system defined icons as well ButtonTitle string Placeholder string }
TextInputAction allows for text input from user.
Click to show internal directories.
Click to hide internal directories.