document silent option

pull/340/head
Lucas Nogueira 2 years ago
parent 3c864a5e44
commit 0a5859e2f9
No known key found for this signature in database
GPG Key ID: 7C32FCA95C8C95D7

@ -114,7 +114,7 @@ interface Options {
/** /**
* Extra payload to store in the notification. * Extra payload to store in the notification.
*/ */
extra?: { [key: string]: any } extra?: { [key: string]: unknown }
/** /**
* If true, the notification cannot be dismissed by the user on Android. * If true, the notification cannot be dismissed by the user on Android.
* *
@ -127,6 +127,10 @@ interface Options {
* Automatically cancel the notification when the user clicks on it. * Automatically cancel the notification when the user clicks on it.
*/ */
autoCancel?: boolean autoCancel?: boolean
/**
* Changes the notification presentation to be silent on iOS (no badge, no sound, not listed).
*/
silent?: boolean
} }
type ScheduleInterval = { type ScheduleInterval = {

@ -191,6 +191,12 @@ impl<R: Runtime> NotificationBuilder<R> {
self.data.auto_cancel = true; self.data.auto_cancel = true;
self self
} }
/// Changes the notification presentation to be silent on iOS (no badge, no sound, not listed).
pub fn silent(mut self) -> Self {
self.data.silent = true;
self
}
} }
/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the notification APIs. /// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the notification APIs.

@ -162,6 +162,8 @@ pub struct NotificationData {
pub(crate) ongoing: bool, pub(crate) ongoing: bool,
#[serde(default)] #[serde(default)]
pub(crate) auto_cancel: bool, pub(crate) auto_cancel: bool,
#[serde(default)]
pub(crate) silent: bool,
} }
fn default_id() -> i32 { fn default_id() -> i32 {
@ -190,6 +192,7 @@ impl Default for NotificationData {
extra: Default::default(), extra: Default::default(),
ongoing: false, ongoing: false,
auto_cancel: false, auto_cancel: false,
silent: false,
} }
} }
} }

Loading…
Cancel
Save