Skip to content

Commit 753900d

Browse files
authored
feat(ios): expose RunEvent::Opened (tauri-apps#7440)
1 parent a5752db commit 753900d

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

.changes/run-event-opened.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch:feat
3+
---
4+
5+
Expose `RunEvent::Opened` on macOS and iOS for deep link support.

core/tauri-runtime-wry/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2952,7 +2952,7 @@ fn handle_event_loop<T: UserEvent>(
29522952
);
29532953
}
29542954
},
2955-
#[cfg(target_os = "macos")]
2955+
#[cfg(any(target_os = "macos", target_os = "ios"))]
29562956
Event::Opened { urls } => {
29572957
callback(RunEvent::Opened { urls });
29582958
}

core/tauri-runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ pub enum RunEvent<T: UserEvent> {
315315
/// This event is useful as a place to put your code that should be run after all state-changing events have been handled and you want to do stuff (updating state, performing calculations, etc) that happens as the “main body” of your event loop.
316316
MainEventsCleared,
317317
/// Emitted when the user wants to open the specified resource with the app.
318-
#[cfg(target_os = "macos")]
318+
#[cfg(any(target_os = "macos", target_os = "ios"))]
319319
Opened { urls: Vec<url::Url> },
320320
/// A custom event defined by the user.
321321
UserEvent(T),

core/tauri/src/app.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub enum RunEvent {
178178
/// This event is useful as a place to put your code that should be run after all state-changing events have been handled and you want to do stuff (updating state, performing calculations, etc) that happens as the “main body” of your event loop.
179179
MainEventsCleared,
180180
/// Emitted when the user wants to open the specified resource with the app.
181-
#[cfg(target_os = "macos")]
181+
#[cfg(any(target_os = "macos", target_os = "ios"))]
182182
Opened {
183183
/// The URL of the resources that is being open.
184184
urls: Vec<url::Url>,
@@ -1523,7 +1523,7 @@ fn on_event_loop_event<R: Runtime, F: FnMut(&AppHandle<R>, RunEvent) + 'static>(
15231523
RuntimeRunEvent::Resumed => RunEvent::Resumed,
15241524
RuntimeRunEvent::MainEventsCleared => RunEvent::MainEventsCleared,
15251525
RuntimeRunEvent::UserEvent(t) => t.into(),
1526-
#[cfg(target_os = "macos")]
1526+
#[cfg(any(target_os = "macos", target_os = "ios"))]
15271527
RuntimeRunEvent::Opened { urls } => RunEvent::Opened { urls },
15281528
_ => unimplemented!(),
15291529
};

examples/file-associations/src-tauri/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn main() {
5252
.build(tauri::generate_context!())
5353
.expect("error while running tauri application")
5454
.run(|app, event| {
55-
#[cfg(target_os = "macos")]
55+
#[cfg(any(target_os = "macos", target_os = "ios"))]
5656
if let tauri::RunEvent::Opened { urls } = event {
5757
if let Some(w) = app.get_window("main") {
5858
let urls = urls

0 commit comments

Comments
 (0)