✨ Support website message notification display
This commit is contained in:
@@ -18,6 +18,13 @@ pub struct BinaryDownloadParams {
|
||||
binary: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
pub struct NotificationParams {
|
||||
title: String,
|
||||
body: String,
|
||||
icon: String,
|
||||
}
|
||||
|
||||
#[command]
|
||||
pub async fn download_file(app: AppHandle, params: DownloadFileParams) -> Result<(), String> {
|
||||
let window: WebviewWindow = app.get_webview_window("pake").unwrap();
|
||||
@@ -71,3 +78,16 @@ pub async fn download_file_by_binary(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[command]
|
||||
pub fn send_notification(app: AppHandle, params: NotificationParams) -> Result<(), String> {
|
||||
use tauri_plugin_notification::NotificationExt;
|
||||
app.notification()
|
||||
.builder()
|
||||
.title(¶ms.title)
|
||||
.body(¶ms.body)
|
||||
.icon(¶ms.icon)
|
||||
.show()
|
||||
.unwrap();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user