Documentation
¶
Overview ¶
Package notify is the numbering and the life of the notifications of an app on macOS and iOS (SPEC §29.9, §30.6) and, in center_darwin.go, UNUserNotificationCenter behind it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
// Ready says whether the app can show notifications: it needs a bundle with an identifier. The reason says why not.
Ready() (ok bool, reason string)
// Authorize asks the user for the permission, the first time, and returns whether it is granted. The errors of
// the backend are NotificationsUnavailable already.
Authorize(ctx context.Context) (granted bool, err error)
// SetCategories gives the center the whole set of categories.
SetCategories(cats []Category) error
// Add shows the request, or replaces the one with its identifier.
Add(ctx context.Context, req Request) error
// Remove takes the notification with the identifier off the screen and out of the center.
Remove(identifier string)
}
Backend is what the notifications ask of the system.
Flutter: no counterpart
type Category ¶
Category is a set of actions that notifications share, made from the buttons of a notification.
Flutter: no counterpart
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
Notifier is the numbering and the life of the notifications of the app. Its methods may be called from any goroutine.
Flutter: no counterpart
func (*Notifier) Close ¶
Close is the close that the app asks for. A notification that is gone is not an error.
Flutter: no counterpart
func (*Notifier) Response ¶
Response is what the user did with the notification: actionID is the action that was chosen, mobile.DefaultAction for a click on the notification itself, and "" for a dismissal. It runs the callbacks of the app.
Flutter: no counterpart
func (*Notifier) Show ¶
Show shows the notification: it is the number that is returned, the same number when the notification replaces one that is shown. It fails with NotificationsUnavailable when the app has no bundle, when the user refused the permission, and when the center refuses the request.
Flutter: no counterpart
type Request ¶
type Request struct {
// Identifier names the notification to the center; a request with the identifier of one that is shown replaces it.
Identifier string
Title, Body string
// Quiet makes no sound (UrgencyLow); Critical shows at the time-sensitive level (UrgencyCritical).
Quiet, Critical bool
// Category is the category that has the actions, "" for a notification without buttons that wants no dismiss
// event either.
Category string
// IconPath is the file of the attachment, "" for none.
IconPath string
}
Request is what is handed to the notification center: the content, and the category that has the buttons.
Flutter: no counterpart