1- use crate :: PermissionsPluginExt ;
1+ use crate :: { Permission , PermissionsPluginExt } ;
22
33#[ tauri:: command]
44#[ specta:: specta]
5- pub ( crate ) async fn check_microphone_permission < R : tauri:: Runtime > (
6- app : tauri:: AppHandle < R > ,
7- ) -> Result < crate :: PermissionStatus , String > {
8- app. permissions ( ) . check_microphone_permission ( )
9- . await
10- . map_err ( |e| e. to_string ( ) )
11- }
12-
13- #[ tauri:: command]
14- #[ specta:: specta]
15- pub ( crate ) async fn request_microphone_permission < R : tauri:: Runtime > (
16- app : tauri:: AppHandle < R > ,
17- ) -> Result < ( ) , String > {
18- app. permissions ( ) . request_microphone_permission ( )
19- . await
20- . map_err ( |e| e. to_string ( ) )
21- }
22-
23- #[ tauri:: command]
24- #[ specta:: specta]
25- pub ( crate ) async fn check_system_audio_permission < R : tauri:: Runtime > (
26- app : tauri:: AppHandle < R > ,
27- ) -> Result < crate :: PermissionStatus , String > {
28- app. permissions ( ) . check_system_audio_permission ( )
29- . await
30- . map_err ( |e| e. to_string ( ) )
31- }
32-
33- #[ tauri:: command]
34- #[ specta:: specta]
35- pub ( crate ) async fn request_system_audio_permission < R : tauri:: Runtime > (
5+ pub ( crate ) async fn open_permission < R : tauri:: Runtime > (
366 app : tauri:: AppHandle < R > ,
7+ permission : Permission ,
378) -> Result < ( ) , String > {
38- app. permissions ( ) . request_system_audio_permission ( )
9+ app. permissions ( )
10+ . open ( permission)
3911 . await
4012 . map_err ( |e| e. to_string ( ) )
4113}
4214
4315#[ tauri:: command]
4416#[ specta:: specta]
45- pub ( crate ) async fn check_accessibility_permission < R : tauri:: Runtime > (
17+ pub ( crate ) async fn check_permission < R : tauri:: Runtime > (
4618 app : tauri:: AppHandle < R > ,
19+ permission : Permission ,
4720) -> Result < crate :: PermissionStatus , String > {
48- app. permissions ( ) . check_accessibility_permission ( )
21+ app. permissions ( )
22+ . check ( permission)
4923 . await
5024 . map_err ( |e| e. to_string ( ) )
5125}
5226
5327#[ tauri:: command]
5428#[ specta:: specta]
55- pub ( crate ) async fn request_accessibility_permission < R : tauri:: Runtime > (
29+ pub ( crate ) async fn request_permission < R : tauri:: Runtime > (
5630 app : tauri:: AppHandle < R > ,
31+ permission : Permission ,
5732) -> Result < ( ) , String > {
58- app. permissions ( ) . request_accessibility_permission ( )
59- . await
60- . map_err ( |e| e. to_string ( ) )
61- }
62-
63- #[ tauri:: command]
64- #[ specta:: specta]
65- pub ( crate ) async fn check_calendar_permission < R : tauri:: Runtime > (
66- app : tauri:: AppHandle < R > ,
67- ) -> Result < crate :: PermissionStatus , String > {
68- app. permissions ( ) . check_calendar_permission ( )
33+ app. permissions ( )
34+ . request ( permission)
6935 . await
7036 . map_err ( |e| e. to_string ( ) )
7137}
7238
7339#[ tauri:: command]
7440#[ specta:: specta]
75- pub ( crate ) async fn request_calendar_permission < R : tauri:: Runtime > (
41+ pub ( crate ) async fn reset_permission < R : tauri:: Runtime > (
7642 app : tauri:: AppHandle < R > ,
43+ permission : Permission ,
7744) -> Result < ( ) , String > {
78- app. permissions ( ) . request_calendar_permission ( )
45+ app. permissions ( )
46+ . reset ( permission)
7947 . await
8048 . map_err ( |e| e. to_string ( ) )
8149}
82-
83- #[ tauri:: command]
84- #[ specta:: specta]
85- pub ( crate ) async fn check_contacts_permission < R : tauri:: Runtime > (
86- app : tauri:: AppHandle < R > ,
87- ) -> Result < crate :: PermissionStatus , String > {
88- app. permissions ( ) . check_contacts_permission ( )
89- . await
90- . map_err ( |e| e. to_string ( ) )
91- }
92-
93- #[ tauri:: command]
94- #[ specta:: specta]
95- pub ( crate ) async fn request_contacts_permission < R : tauri:: Runtime > (
96- app : tauri:: AppHandle < R > ,
97- ) -> Result < ( ) , String > {
98- app. permissions ( ) . request_contacts_permission ( )
99- . await
100- . map_err ( |e| e. to_string ( ) )
101- }
102-
103- #[ tauri:: command]
104- #[ specta:: specta]
105- pub ( crate ) async fn open_calendar_settings < R : tauri:: Runtime > (
106- app : tauri:: AppHandle < R > ,
107- ) -> Result < ( ) , String > {
108- app. permissions ( ) . open_calendar_settings ( )
109- . await
110- . map_err ( |e| e. to_string ( ) )
111- }
112-
113- #[ tauri:: command]
114- #[ specta:: specta]
115- pub ( crate ) async fn open_contacts_settings < R : tauri:: Runtime > (
116- app : tauri:: AppHandle < R > ,
117- ) -> Result < ( ) , String > {
118- app. permissions ( ) . open_contacts_settings ( )
119- . await
120- . map_err ( |e| e. to_string ( ) )
121- }
0 commit comments