@@ -16,14 +16,11 @@ pub use error::{Error, Result};
16
16
#[ cfg( target_os = "android" ) ]
17
17
const PLUGIN_IDENTIFIER : & str = "app.tauri.deep_link" ;
18
18
19
- #[ cfg( target_os = "ios" ) ]
20
- tauri:: ios_plugin_binding!( init_plugin_deep_link) ;
21
-
22
19
fn init_deep_link < R : Runtime > (
23
20
app : & AppHandle < R > ,
24
21
api : PluginApi < R , Option < config:: Config > > ,
25
22
) -> crate :: Result < DeepLink < R > > {
26
- #[ cfg( mobile ) ]
23
+ #[ cfg( target_os = "android" ) ]
27
24
{
28
25
let _api = api;
29
26
@@ -32,12 +29,8 @@ fn init_deep_link<R: Runtime>(
32
29
Emitter ,
33
30
} ;
34
31
35
- #[ cfg( target_os = "android" ) ]
36
32
let handle = _api. register_android_plugin ( PLUGIN_IDENTIFIER , "DeepLinkPlugin" ) ?;
37
33
38
- #[ cfg( target_os = "ios" ) ]
39
- let handle = _api. register_ios_plugin ( init_plugin_deep_link) ?;
40
-
41
34
#[ derive( serde:: Deserialize ) ]
42
35
struct Event {
43
36
url : String ,
@@ -64,25 +57,23 @@ fn init_deep_link<R: Runtime>(
64
57
} ,
65
58
) ?;
66
59
67
- #[ cfg( target_os = "android" ) ]
68
- {
69
- return Ok ( DeepLink {
70
- app : app. clone ( ) ,
71
- plugin_handle : handle,
72
- } ) ;
73
- }
60
+ return Ok ( DeepLink {
61
+ app : app. clone ( ) ,
62
+ plugin_handle : handle,
63
+ } ) ;
64
+ }
74
65
75
- #[ cfg( target_os = "ios" ) ]
76
- {
77
- return Ok ( DeepLink {
78
- app : app. clone ( ) ,
79
- plugin_handle : handle ,
80
- current : Default :: default ( ) ,
81
- } )
82
- }
66
+ #[ cfg( target_os = "ios" ) ]
67
+ {
68
+ let deep_link = DeepLink {
69
+ app : app. clone ( ) ,
70
+ current : Default :: default ( ) ,
71
+ config : api . config ( ) . clone ( ) ,
72
+ } ;
73
+ Ok ( deep_link )
83
74
}
84
75
85
- #[ cfg( desktop) ]
76
+ #[ cfg( any ( desktop) ) ]
86
77
{
87
78
let args = std:: env:: args ( ) ;
88
79
let deep_link = DeepLink {
@@ -96,7 +87,7 @@ fn init_deep_link<R: Runtime>(
96
87
}
97
88
}
98
89
99
- #[ cfg( mobile ) ]
90
+ #[ cfg( target_os = "android" ) ]
100
91
mod imp {
101
92
use std:: sync:: Mutex ;
102
93
use tauri:: { ipc:: Channel , plugin:: PluginHandle , AppHandle , Runtime } ;
@@ -115,14 +106,6 @@ mod imp {
115
106
pub url : Option < url:: Url > ,
116
107
}
117
108
118
- /// Access to the deep-link APIs.
119
- pub struct DeepLink < R : Runtime > {
120
- pub ( crate ) app : AppHandle < R > ,
121
- pub ( crate ) plugin_handle : PluginHandle < R > ,
122
- #[ cfg( target_os = "ios" ) ]
123
- pub ( crate ) current : Mutex < Option < Vec < url:: Url > > > ,
124
- }
125
-
126
109
impl < R : Runtime > DeepLink < R > {
127
110
/// Get the current URLs that triggered the deep link. Use this on app load to check whether your app was started via a deep link.
128
111
///
@@ -174,7 +157,7 @@ mod imp {
174
157
}
175
158
}
176
159
177
- #[ cfg( not( mobile ) ) ]
160
+ #[ cfg( not( target_os = "android" ) ) ]
178
161
mod imp {
179
162
use std:: sync:: Mutex ;
180
163
#[ cfg( target_os = "linux" ) ]
0 commit comments