1+ // Tauri command handlers must take owned values: `State<'_, _>` is the framework's
2+ // preferred wrapper, and serde-deserialized payloads (Vec, String, ...) cannot be borrowed.
3+ #![ allow( clippy:: needless_pass_by_value) ]
4+
15use serde:: Deserialize ;
26use tauri:: { command, plugin:: PermissionState , AppHandle , Runtime , State } ;
37
48use crate :: { NotificationData , Notifications , Result } ;
59
610#[ derive( Debug , Deserialize ) ]
711#[ allow( dead_code) ]
8- pub ( crate ) struct NotificationIdentifier {
12+ pub struct NotificationIdentifier {
913 pub id : i32 ,
1014 #[ allow( dead_code) ]
1115 pub tag : Option < String > ,
1216}
1317
1418#[ command]
15- pub ( crate ) async fn is_permission_granted < R : Runtime > (
19+ pub async fn is_permission_granted < R : Runtime > (
1620 _app : AppHandle < R > ,
1721 notification : State < ' _ , Notifications < R > > ,
1822) -> Result < Option < bool > > {
@@ -25,31 +29,31 @@ pub(crate) async fn is_permission_granted<R: Runtime>(
2529}
2630
2731#[ command]
28- pub ( crate ) async fn request_permission < R : Runtime > (
32+ pub async fn request_permission < R : Runtime > (
2933 _app : AppHandle < R > ,
3034 notification : State < ' _ , Notifications < R > > ,
3135) -> Result < PermissionState > {
3236 notification. request_permission ( ) . await
3337}
3438
3539#[ command]
36- pub ( crate ) async fn register_for_push_notifications < R : Runtime > (
40+ pub async fn register_for_push_notifications < R : Runtime > (
3741 _app : AppHandle < R > ,
3842 notification : State < ' _ , Notifications < R > > ,
3943) -> Result < String > {
4044 notification. register_for_push_notifications ( ) . await
4145}
4246
4347#[ command]
44- pub ( crate ) async fn unregister_for_push_notifications < R : Runtime > (
48+ pub async fn unregister_for_push_notifications < R : Runtime > (
4549 _app : AppHandle < R > ,
4650 notification : State < ' _ , Notifications < R > > ,
4751) -> Result < ( ) > {
4852 notification. unregister_for_push_notifications ( )
4953}
5054
5155#[ command]
52- pub ( crate ) async fn notify < R : Runtime > (
56+ pub async fn notify < R : Runtime > (
5357 _app : AppHandle < R > ,
5458 notification : State < ' _ , Notifications < R > > ,
5559 options : NotificationData ,
@@ -60,7 +64,7 @@ pub(crate) async fn notify<R: Runtime>(
6064}
6165
6266#[ command]
63- pub ( crate ) async fn register_action_types < R : Runtime > (
67+ pub async fn register_action_types < R : Runtime > (
6468 _app : AppHandle < R > ,
6569 notification : State < ' _ , Notifications < R > > ,
6670 types : Vec < crate :: ActionType > ,
@@ -69,23 +73,23 @@ pub(crate) async fn register_action_types<R: Runtime>(
6973}
7074
7175#[ command]
72- pub ( crate ) async fn get_pending < R : Runtime > (
76+ pub async fn get_pending < R : Runtime > (
7377 _app : AppHandle < R > ,
7478 notification : State < ' _ , Notifications < R > > ,
7579) -> Result < Vec < crate :: PendingNotification > > {
7680 notification. pending ( ) . await
7781}
7882
7983#[ command]
80- pub ( crate ) async fn get_active < R : Runtime > (
84+ pub async fn get_active < R : Runtime > (
8185 _app : AppHandle < R > ,
8286 notification : State < ' _ , Notifications < R > > ,
8387) -> Result < Vec < crate :: ActiveNotification > > {
8488 notification. active ( ) . await
8589}
8690
8791#[ command]
88- pub ( crate ) fn set_click_listener_active < R : Runtime > (
92+ pub fn set_click_listener_active < R : Runtime > (
8993 _app : AppHandle < R > ,
9094 notification : State < ' _ , Notifications < R > > ,
9195 active : bool ,
@@ -94,7 +98,7 @@ pub(crate) fn set_click_listener_active<R: Runtime>(
9498}
9599
96100#[ command]
97- pub ( crate ) fn remove_active < R : Runtime > (
101+ pub fn remove_active < R : Runtime > (
98102 _app : AppHandle < R > ,
99103 notification : State < ' _ , Notifications < R > > ,
100104 notifications : Vec < NotificationIdentifier > ,
@@ -104,7 +108,7 @@ pub(crate) fn remove_active<R: Runtime>(
104108}
105109
106110#[ command]
107- pub ( crate ) fn cancel < R : Runtime > (
111+ pub fn cancel < R : Runtime > (
108112 _app : AppHandle < R > ,
109113 notification : State < ' _ , Notifications < R > > ,
110114 notifications : Vec < i32 > ,
@@ -113,15 +117,15 @@ pub(crate) fn cancel<R: Runtime>(
113117}
114118
115119#[ command]
116- pub ( crate ) fn cancel_all < R : Runtime > (
120+ pub fn cancel_all < R : Runtime > (
117121 _app : AppHandle < R > ,
118122 notification : State < ' _ , Notifications < R > > ,
119123) -> Result < ( ) > {
120124 notification. cancel_all ( )
121125}
122126
123127#[ command]
124- pub ( crate ) fn create_channel < R : Runtime > (
128+ pub fn create_channel < R : Runtime > (
125129 _app : AppHandle < R > ,
126130 notification : State < ' _ , Notifications < R > > ,
127131 channel : crate :: Channel ,
@@ -130,7 +134,7 @@ pub(crate) fn create_channel<R: Runtime>(
130134}
131135
132136#[ command]
133- pub ( crate ) fn delete_channel < R : Runtime > (
137+ pub fn delete_channel < R : Runtime > (
134138 _app : AppHandle < R > ,
135139 notification : State < ' _ , Notifications < R > > ,
136140 id : String ,
@@ -139,7 +143,7 @@ pub(crate) fn delete_channel<R: Runtime>(
139143}
140144
141145#[ command]
142- pub ( crate ) fn list_channels < R : Runtime > (
146+ pub fn list_channels < R : Runtime > (
143147 _app : AppHandle < R > ,
144148 notification : State < ' _ , Notifications < R > > ,
145149) -> Result < Vec < crate :: Channel > > {
0 commit comments