pub enum Action {
Button {
identifier: String,
title: String,
requires_authentication: bool,
},
Reply {
identifier: String,
title: String,
button_title: String,
placeholder: String,
requires_authentication: bool,
},
}Expand description
A notification action.
Use Action::button for a plain button or Action::reply for a
text-input action. Chain Action::requires_authentication on either
to require Touch ID / password before the action fires.
Variants§
Button
A plain button action.
Fields
identifier: StringIdentifier sent back in NotificationResponse::action_identifier.
Reply
A text-input action.
The user’s input is delivered via
NotificationResponse::reply_text.
macOS only renders one Reply action correctly per notification.
If multiple are added, only the first is used.
Fields
identifier: StringIdentifier sent back in NotificationResponse::action_identifier.
Label on the submit button inside the expanded text field.
Implementations§
Source§impl Action
impl Action
Create a plain button action.
Sourcepub fn reply(
identifier: impl Into<String>,
title: impl Into<String>,
button_title: impl Into<String>,
placeholder: impl Into<String>,
) -> Self
pub fn reply( identifier: impl Into<String>, title: impl Into<String>, button_title: impl Into<String>, placeholder: impl Into<String>, ) -> Self
Create a text-input (reply) action.
button_titleis the label on the submit button (e.g."Send").placeholderis the hint text inside the empty input field.
Sourcepub fn requires_authentication(self) -> Self
pub fn requires_authentication(self) -> Self
Require Touch ID / password before the action fires.
Works for both Action::Button and Action::Reply.