Some checks failed
Security Scan / security (push) Failing after 28s
Notification: RevokePermission, RegisterCategory, action broadcasts Dock: SetProgressBar, Bounce/StopBounce, ActionProgressChanged Webview: QueryZoom, TaskSetZoom, TaskSetURL, TaskPrint (with PDF export) MCP: 4 new event tools (emit, on, off, list) Environment: HasFocusFollowsMouse query ContextMenu: Update, Destroy, GetAll, OnShutdown cleanup Core upgraded to v0.8.0-alpha.1 (added alongside existing v0.3.3 — full module path migration pending). All 17 packages build and test clean. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
50 lines
1.7 KiB
Go
50 lines
1.7 KiB
Go
// pkg/notification/platform.go
|
|
package notification
|
|
|
|
// Platform abstracts the native notification backend.
|
|
type Platform interface {
|
|
Send(options NotificationOptions) error
|
|
RequestPermission() (bool, error)
|
|
CheckPermission() (bool, error)
|
|
RevokePermission() error
|
|
}
|
|
|
|
// NotificationSeverity indicates the severity for dialog fallback.
|
|
type NotificationSeverity int
|
|
|
|
const (
|
|
SeverityInfo NotificationSeverity = iota
|
|
SeverityWarning
|
|
SeverityError
|
|
)
|
|
|
|
// NotificationAction is a button that can be attached to a notification.
|
|
// id := "reply"; action := NotificationAction{ID: id, Title: "Reply", Destructive: false}
|
|
type NotificationAction struct {
|
|
ID string `json:"id"`
|
|
Title string `json:"title"`
|
|
Destructive bool `json:"destructive,omitempty"`
|
|
}
|
|
|
|
// NotificationCategory groups actions under a named category/channel.
|
|
// category := NotificationCategory{ID: "message", Actions: []NotificationAction{{ID: "reply", Title: "Reply"}}}
|
|
type NotificationCategory struct {
|
|
ID string `json:"id"`
|
|
Actions []NotificationAction `json:"actions,omitempty"`
|
|
}
|
|
|
|
// NotificationOptions contains options for sending a notification.
|
|
type NotificationOptions struct {
|
|
ID string `json:"id,omitempty"`
|
|
Title string `json:"title"`
|
|
Message string `json:"message"`
|
|
Subtitle string `json:"subtitle,omitempty"`
|
|
Severity NotificationSeverity `json:"severity,omitempty"`
|
|
CategoryID string `json:"categoryId,omitempty"`
|
|
Actions []NotificationAction `json:"actions,omitempty"`
|
|
}
|
|
|
|
// PermissionStatus indicates whether notifications are authorised.
|
|
type PermissionStatus struct {
|
|
Granted bool `json:"granted"`
|
|
}
|