class documentation

class NotificationConfig(Protocol): (source)

View In Hierarchy

The application-wide configuration for a notification.

Method add Add a new category (represented by a plain Python class, which may have some methods that were decorated with response(...), response.text(...)).
def add(self, category: type[NotifT], translator: NotificationTranslator[NotifT], allowInCarPlay: bool = False, hiddenPreviewsShowTitle: bool = False, hiddenPreviewsShowSubtitle: bool = False) -> Notifier[NotifT]: (source) ΒΆ

Add a new category (represented by a plain Python class, which may have some methods that were decorated with response(...), response.text(...)).

Parameters
category:type[NotifT]A Python type that contains the internal state for the notifications that will be emitted, that will be relayed back to its responses (e.g. the response methods on the category).
translator:NotificationTranslator[NotifT]a translator that can serialize and deserialize python objects to UNUserNotificationCenter values.
allowInCarPlay:boolShould the notification be allowed to show in CarPlay?
hiddenPreviewsShowTitle:boolShould lock-screen previews for this notification show the unredacted title?
hiddenPreviewsShowSubtitle:boolShould lock-screen previews for this notification show the unredacted subtitle?
Returns
Notifier[NotifT]A Notifier that can deliver notifications to macOS.
Note
This method can only be called within the with statement for the context manager beneath configureNotifications, and can only do this once per process. Otherwise it will raise an exception.