🌱 发送通知

This commit is contained in:
BTMuli
2026-01-02 00:01:30 +08:00
parent 03136c4864
commit 0288e38c95
8 changed files with 132 additions and 19 deletions

68
src-tauri/Cargo.lock generated
View File

@@ -22,6 +22,7 @@ dependencies = [
"tauri-plugin-fs",
"tauri-plugin-http",
"tauri-plugin-log",
"tauri-plugin-notification",
"tauri-plugin-opener",
"tauri-plugin-os",
"tauri-plugin-process",
@@ -3150,6 +3151,18 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
[[package]]
name = "mac-notification-sys"
version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65fd3f75411f4725061682ed91f131946e912859d0044d39c4ec0aac818d7621"
dependencies = [
"cc",
"objc2",
"objc2-foundation",
"time",
]
[[package]]
name = "markup5ever"
version = "0.14.1"
@@ -3362,6 +3375,20 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
[[package]]
name = "notify-rust"
version = "4.11.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6442248665a5aa2514e794af3b39661a8e73033b1cc5e59899e1276117ee4400"
dependencies = [
"futures-lite",
"log",
"mac-notification-sys",
"serde",
"tauri-winrt-notification",
"zbus",
]
[[package]]
name = "num-bigint"
version = "0.4.6"
@@ -4126,7 +4153,7 @@ checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07"
dependencies = [
"base64 0.22.1",
"indexmap 2.12.1",
"quick-xml",
"quick-xml 0.38.4",
"serde",
"time",
]
@@ -4380,6 +4407,15 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
[[package]]
name = "quick-xml"
version = "0.37.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb"
dependencies = [
"memchr",
]
[[package]]
name = "quick-xml"
version = "0.38.4"
@@ -6290,6 +6326,24 @@ dependencies = [
"time",
]
[[package]]
name = "tauri-plugin-notification"
version = "2.3.3"
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#31415effdf5a9ced19934a681cb044a732174088"
dependencies = [
"log",
"notify-rust",
"rand 0.9.2",
"serde",
"serde_json",
"serde_repr",
"tauri",
"tauri-plugin",
"thiserror 2.0.17",
"time",
"url",
]
[[package]]
name = "tauri-plugin-opener"
version = "2.5.2"
@@ -6490,6 +6544,18 @@ dependencies = [
"toml 0.9.10+spec-1.1.0",
]
[[package]]
name = "tauri-winrt-notification"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b1e66e07de489fe43a46678dd0b8df65e0c973909df1b60ba33874e297ba9b9"
dependencies = [
"quick-xml 0.37.5",
"thiserror 2.0.17",
"windows",
"windows-version",
]
[[package]]
name = "tempfile"
version = "3.24.0"

View File

@@ -80,6 +80,11 @@ features = ["unsafe-headers"]
git = "ssh://git@github.com/tauri-apps/plugins-workspace.git"
branch = "v2"
# notification 插件
[dependencies.tauri-plugin-notification]
git = "ssh://git@github.com/tauri-apps/plugins-workspace.git"
branch = "v2"
# opener 插件
[dependencies.tauri-plugin-opener]
git = "ssh://git@github.com/tauri-apps/plugins-workspace.git"

View File

@@ -31,6 +31,7 @@
"http:allow-fetch",
"log:default",
"log:allow-log",
"notification:default",
"opener:default",
"process:default",
"process:allow-exit",

View File

@@ -73,6 +73,7 @@ pub fn run() {
}));
builder
.on_window_event(move |app, event| window_event_handler(app, event))
.plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_deep_link::init())
.plugin(tauri_plugin_cli::init())
.plugin(tauri_plugin_dialog::init())