NotificationRegistry(
self,
)In-memory store of pending notifications.
Instance-scoped (one per app) so test apps don't pollute each other. Owns the bidirectional key-to-toast-identity binding so callers cannot accidentally desynchronize the click-routing indices.
Register a new notification or replace an existing one with the same key.
Replacing is intentional: re-registering with the same key refreshes the entry rather than stacking duplicates. Any previously bound toast identity is dropped, since the old toast has been dismissed or replaced by the caller.
Remove a notification by key.
Return the notification for key, or None when not registered.
Attach a Textual toast identity to an existing notification.
Logs a warning when key is unknown ā this only happens if a
caller binds a toast without first add-ing the entry, which is
a programming error.
Return the toast identity bound to key, or None.
Drop the binding for toast_identity, if any.
Does not remove the underlying notification entry; used when the toast is being dismissed (e.g. the user opened the notification center) but the entry should stay in the registry.
Return the registered key for toast_identity, or None.
Return whether a click on toast_identity should open the modal.
Return all pending notifications in insertion order.
Remove all entries. Primarily useful for tests.