@@ -14,6 +14,7 @@ const PLUGIN_IDENTIFIER: &str = "app.tauri.opener";
14
14
tauri:: ios_plugin_binding!( init_plugin_opener) ;
15
15
16
16
mod commands;
17
+ mod config;
17
18
mod error;
18
19
mod open;
19
20
mod reveal_item_in_dir;
@@ -27,12 +28,13 @@ pub use open::{open_path, open_url};
27
28
pub use reveal_item_in_dir:: reveal_item_in_dir;
28
29
29
30
pub struct Opener < R : Runtime > {
30
- // we use `fn() -> R` to slicence the unused generic error
31
+ // we use `fn() -> R` to silence the unused generic error
31
32
// while keeping this struct `Send + Sync` without requiring `R` to be
32
33
#[ cfg( not( mobile) ) ]
33
34
_marker : std:: marker:: PhantomData < fn ( ) -> R > ,
34
35
#[ cfg( mobile) ]
35
36
mobile_plugin_handle : PluginHandle < R > ,
37
+ require_literal_leading_dot : Option < bool > ,
36
38
}
37
39
38
40
impl < R : Runtime > Opener < R > {
@@ -185,19 +187,23 @@ impl Builder {
185
187
}
186
188
187
189
/// Build and Initializes the plugin.
188
- pub fn build < R : Runtime > ( self ) -> TauriPlugin < R > {
189
- let mut builder = tauri:: plugin:: Builder :: new ( "opener" )
190
- . setup ( |app, _api | {
190
+ pub fn build < R : Runtime > ( self ) -> TauriPlugin < R , Option < config :: Config > > {
191
+ let mut builder = tauri:: plugin:: Builder :: < R , Option < config :: Config > > :: new ( "opener" )
192
+ . setup ( |app, api | {
191
193
#[ cfg( target_os = "android" ) ]
192
- let handle = _api . register_android_plugin ( PLUGIN_IDENTIFIER , "OpenerPlugin" ) ?;
194
+ let handle = api . register_android_plugin ( PLUGIN_IDENTIFIER , "OpenerPlugin" ) ?;
193
195
#[ cfg( target_os = "ios" ) ]
194
- let handle = _api . register_ios_plugin ( init_plugin_opener) ?;
196
+ let handle = api . register_ios_plugin ( init_plugin_opener) ?;
195
197
196
198
app. manage ( Opener {
197
199
#[ cfg( not( mobile) ) ]
198
200
_marker : std:: marker:: PhantomData :: < fn ( ) -> R > ,
199
201
#[ cfg( mobile) ]
200
202
mobile_plugin_handle : handle,
203
+ require_literal_leading_dot : api
204
+ . config ( )
205
+ . as_ref ( )
206
+ . and_then ( |c| c. require_literal_leading_dot ) ,
201
207
} ) ;
202
208
Ok ( ( ) )
203
209
} )
@@ -216,6 +222,6 @@ impl Builder {
216
222
}
217
223
218
224
/// Initializes the plugin.
219
- pub fn init < R : Runtime > ( ) -> TauriPlugin < R > {
225
+ pub fn init < R : Runtime > ( ) -> TauriPlugin < R , Option < config :: Config > > {
220
226
Builder :: default ( ) . build ( )
221
227
}
0 commit comments