@choochmeque/tauri-plugin-notifications-api 0.3.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -1
- package/dist-js/index.cjs +3 -3
- package/dist-js/index.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ Add the plugin to your Tauri project's `Cargo.toml`:
|
|
|
45
45
|
|
|
46
46
|
```toml
|
|
47
47
|
[dependencies]
|
|
48
|
-
tauri-plugin-notifications = "0.
|
|
48
|
+
tauri-plugin-notifications = "0.4"
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
### Push Notifications Feature
|
|
@@ -68,6 +68,33 @@ Without this feature enabled:
|
|
|
68
68
|
- Push notification registration code is disabled
|
|
69
69
|
- The `registerForPushNotifications()` function will return an error if called
|
|
70
70
|
|
|
71
|
+
### Desktop Notification Backend (notify-rust)
|
|
72
|
+
|
|
73
|
+
The `notify-rust` feature is **enabled by default** and provides cross-platform desktop notifications using the [notify-rust](https://crates.io/crates/notify-rust) crate.
|
|
74
|
+
|
|
75
|
+
**When to use notify-rust (default):**
|
|
76
|
+
- Simple notifications on Linux, macOS, and Windows
|
|
77
|
+
- Cross-platform consistency
|
|
78
|
+
- Basic notification features (title, body, icon)
|
|
79
|
+
|
|
80
|
+
**When to disable notify-rust:**
|
|
81
|
+
- You need native Windows toast notifications with advanced features (actions, hero images, scheduling)
|
|
82
|
+
- You want platform-specific notification features on macOS/Windows
|
|
83
|
+
|
|
84
|
+
To disable `notify-rust` and use native platform implementations:
|
|
85
|
+
|
|
86
|
+
```toml
|
|
87
|
+
[dependencies]
|
|
88
|
+
tauri-plugin-notifications = { version = "0.3", default-features = false }
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
To disable `notify-rust` and enable push notifications:
|
|
92
|
+
|
|
93
|
+
```toml
|
|
94
|
+
[dependencies]
|
|
95
|
+
tauri-plugin-notifications = { version = "0.3", default-features = false, features = ["push-notifications"] }
|
|
96
|
+
```
|
|
97
|
+
|
|
71
98
|
Configure the plugin permissions in your `capabilities/default.json`:
|
|
72
99
|
|
|
73
100
|
```json
|
|
@@ -89,6 +116,24 @@ fn main() {
|
|
|
89
116
|
}
|
|
90
117
|
```
|
|
91
118
|
|
|
119
|
+
## Example App
|
|
120
|
+
|
|
121
|
+
An example app is available in [`examples/notifications-demo`](examples/notifications-demo) demonstrating all plugin features:
|
|
122
|
+
|
|
123
|
+
- Permission management and push notifications (mobile)
|
|
124
|
+
- Basic, scheduled, and styled notifications
|
|
125
|
+
- Interactive notifications with action buttons
|
|
126
|
+
- Notification channels (Android)
|
|
127
|
+
- Pending and active notification management
|
|
128
|
+
- Event listeners with logging
|
|
129
|
+
|
|
130
|
+
**Run it:**
|
|
131
|
+
```bash
|
|
132
|
+
cd examples/notifications-demo
|
|
133
|
+
pnpm install
|
|
134
|
+
pnpm tauri dev
|
|
135
|
+
```
|
|
136
|
+
|
|
92
137
|
## Usage
|
|
93
138
|
|
|
94
139
|
### JavaScript/TypeScript
|
package/dist-js/index.cjs
CHANGED
|
@@ -248,7 +248,7 @@ async function cancel(notifications) {
|
|
|
248
248
|
* @returns A promise indicating the success or failure of the operation.
|
|
249
249
|
*/
|
|
250
250
|
async function cancelAll() {
|
|
251
|
-
await core.invoke("plugin:notifications|
|
|
251
|
+
await core.invoke("plugin:notifications|cancel_all");
|
|
252
252
|
}
|
|
253
253
|
/**
|
|
254
254
|
* Retrieves the list of active notifications.
|
|
@@ -311,7 +311,7 @@ async function removeAllActive() {
|
|
|
311
311
|
* @returns A promise indicating the success or failure of the operation.
|
|
312
312
|
*/
|
|
313
313
|
async function createChannel(channel) {
|
|
314
|
-
await core.invoke("plugin:notifications|create_channel", {
|
|
314
|
+
await core.invoke("plugin:notifications|create_channel", { channel });
|
|
315
315
|
}
|
|
316
316
|
/**
|
|
317
317
|
* Removes the channel with the given identifier.
|
|
@@ -339,7 +339,7 @@ async function removeChannel(id) {
|
|
|
339
339
|
* @returns A promise resolving to the list of notification channels.
|
|
340
340
|
*/
|
|
341
341
|
async function channels() {
|
|
342
|
-
return await core.invoke("plugin:notifications|
|
|
342
|
+
return await core.invoke("plugin:notifications|list_channels");
|
|
343
343
|
}
|
|
344
344
|
/**
|
|
345
345
|
* Registers a listener for incoming notifications.
|
package/dist-js/index.js
CHANGED
|
@@ -246,7 +246,7 @@ async function cancel(notifications) {
|
|
|
246
246
|
* @returns A promise indicating the success or failure of the operation.
|
|
247
247
|
*/
|
|
248
248
|
async function cancelAll() {
|
|
249
|
-
await invoke("plugin:notifications|
|
|
249
|
+
await invoke("plugin:notifications|cancel_all");
|
|
250
250
|
}
|
|
251
251
|
/**
|
|
252
252
|
* Retrieves the list of active notifications.
|
|
@@ -309,7 +309,7 @@ async function removeAllActive() {
|
|
|
309
309
|
* @returns A promise indicating the success or failure of the operation.
|
|
310
310
|
*/
|
|
311
311
|
async function createChannel(channel) {
|
|
312
|
-
await invoke("plugin:notifications|create_channel", {
|
|
312
|
+
await invoke("plugin:notifications|create_channel", { channel });
|
|
313
313
|
}
|
|
314
314
|
/**
|
|
315
315
|
* Removes the channel with the given identifier.
|
|
@@ -337,7 +337,7 @@ async function removeChannel(id) {
|
|
|
337
337
|
* @returns A promise resolving to the list of notification channels.
|
|
338
338
|
*/
|
|
339
339
|
async function channels() {
|
|
340
|
-
return await invoke("plugin:notifications|
|
|
340
|
+
return await invoke("plugin:notifications|list_channels");
|
|
341
341
|
}
|
|
342
342
|
/**
|
|
343
343
|
* Registers a listener for incoming notifications.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@choochmeque/tauri-plugin-notifications-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "You",
|
|
6
6
|
"description": "A Tauri v2 plugin for sending notifications on desktop and mobile platforms with support for system notifications and push delivery via FCM and APNs.",
|