pub struct Category { /* private fields */ }Expand description
One notification category the venture declares.
Categories are the vocabulary an account switches on and off, so they
are the venture’s, not the module’s: booking, coach_notes,
room_starting.
Implementations§
Source§impl Category
impl Category
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
A category that is on until the account says otherwise, and sends no badge count.
Sourcepub fn default_enabled(self, enabled: bool) -> Self
pub fn default_enabled(self, enabled: bool) -> Self
Whether an account that has never expressed a preference gets this
category (default true).
Sourcepub fn badge(self, allowed: bool) -> Self
pub fn badge(self, allowed: bool) -> Self
Whether a badge count may travel with this category’s
notifications (default false).
Off by default because a badge number the server cannot compute correctly is worse than no badge: it is wrong on the device until the next push, and only the venture knows what it counts.
Sourcepub fn in_app(self, keeps_a_row: bool) -> Self
pub fn in_app(self, keeps_a_row: bool) -> Self
Whether this category writes an in-app inbox row (default
true).
Turn it off for a notification that is noise once it is past —
“your room starts in ten minutes” is worth a push and worth
nothing in a list read tomorrow. This is the venture’s decision
about the category; the account’s own in_app switch is
separate and is checked as well.
Sourcepub fn email(self, sends_mail: bool) -> Self
pub fn email(self, sends_mail: bool) -> Self
Whether this category is emailed to an account with a verified
address (default false).
Off by default because email is the most intrusive of the three
channels and the hardest to take back — a venture opts a category
in deliberately. The account’s own email switch is separate and
is checked as well, and a category that is on here still sends
nothing to an account with no verified address.
Sourcepub fn subject_template(self, subject: impl Into<String>) -> Self
pub fn subject_template(self, subject: impl Into<String>) -> Self
The subject line for this category’s mail. Defaults to the notification’s own title.
Sourcepub fn render(self, mode: RenderMode) -> Self
pub fn render(self, mode: RenderMode) -> Self
Who renders this category’s strings for a device (default
RenderMode::Server, issue #190).
Only ever consulted for a Message::Localizable: a caller that
passes a rendered Notification gets exactly what it wrote,
whatever this says.
RenderMode::Native and RenderMode::Both pass the caller’s
Localizable::loc keys through to APNs and FCM, so an app that
ships its own translations renders in the device’s language without
the server knowing any of them. Web Push has no such mechanism,
so a browser is always served the rendered text whatever the mode.
Trait Implementations§
impl Eq for Category
impl StructuralPartialEq for Category
Auto Trait Implementations§
impl Freeze for Category
impl RefUnwindSafe for Category
impl Send for Category
impl Sync for Category
impl Unpin for Category
impl UnsafeUnpin for Category
impl UnwindSafe for Category
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.