Tayori.Announcements (Tayori v0.1.0)

Copy Markdown View Source

An entry announced in the app, as a popup, a toast or a banner, until its date (Tayori.Entry's :announce): the :announcements feature.

A reader sees one announcement at a time, the newest they can see and have not dismissed. A visitor sees it until the page closes it.

Summary

Functions

The announcement the reader sees now, with its translation, or nil. Always nil when the :announcements feature is off.

Dismisses an announcement for the reader, on every device. Does nothing for a visitor.

Functions

current(reader, opts \\ [])

@spec current(Tayori.Reader.t(), keyword()) :: Tayori.Entry.t() | nil

The announcement the reader sees now, with its translation, or nil. Always nil when the :announcements feature is off.

dismiss(reader, entry_id)

@spec dismiss(Tayori.Reader.t(), Ecto.UUID.t()) :: :ok

Dismisses an announcement for the reader, on every device. Does nothing for a visitor.