mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-09-11 07:55:34 +03:00
feat(ios): expose RunEvent::Opened
(#7440)
This commit is contained in:
parent
a5752db985
commit
753900dd6e
5
.changes/run-event-opened.md
Normal file
5
.changes/run-event-opened.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": patch:feat
|
||||
---
|
||||
|
||||
Expose `RunEvent::Opened` on macOS and iOS for deep link support.
|
@ -2952,7 +2952,7 @@ fn handle_event_loop<T: UserEvent>(
|
||||
);
|
||||
}
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||
Event::Opened { urls } => {
|
||||
callback(RunEvent::Opened { urls });
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ pub enum RunEvent<T: UserEvent> {
|
||||
/// 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.
|
||||
MainEventsCleared,
|
||||
/// Emitted when the user wants to open the specified resource with the app.
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||
Opened { urls: Vec<url::Url> },
|
||||
/// A custom event defined by the user.
|
||||
UserEvent(T),
|
||||
|
@ -178,7 +178,7 @@ pub enum RunEvent {
|
||||
/// 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.
|
||||
MainEventsCleared,
|
||||
/// Emitted when the user wants to open the specified resource with the app.
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||
Opened {
|
||||
/// The URL of the resources that is being open.
|
||||
urls: Vec<url::Url>,
|
||||
@ -1523,7 +1523,7 @@ fn on_event_loop_event<R: Runtime, F: FnMut(&AppHandle<R>, RunEvent) + 'static>(
|
||||
RuntimeRunEvent::Resumed => RunEvent::Resumed,
|
||||
RuntimeRunEvent::MainEventsCleared => RunEvent::MainEventsCleared,
|
||||
RuntimeRunEvent::UserEvent(t) => t.into(),
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||
RuntimeRunEvent::Opened { urls } => RunEvent::Opened { urls },
|
||||
_ => unimplemented!(),
|
||||
};
|
||||
|
@ -52,7 +52,7 @@ fn main() {
|
||||
.build(tauri::generate_context!())
|
||||
.expect("error while running tauri application")
|
||||
.run(|app, event| {
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||
if let tauri::RunEvent::Opened { urls } = event {
|
||||
if let Some(w) = app.get_window("main") {
|
||||
let urls = urls
|
||||
|
Loading…
Reference in New Issue
Block a user