Skip to content

Commit

Permalink
fix(core): use postMessage IPC for remote URLs on iOS ref #7751
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Sep 6, 2023
1 parent 0d63732 commit a52f13c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .changes/fix-ipc-remote-url-macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"tauri": patch:bug
---

Fixes IPC failing to communicate for remote URLs on macOS.
Fixes IPC failing to communicate for remote URLs on macOS and iOS.
2 changes: 1 addition & 1 deletion core/tauri/scripts/ipc-protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
cmd === fetchChannelDataCommand ||
!(osName === 'linux' || osName === 'android')
) &&
!(osName === 'macos' && location.protocol === 'https:')
!((osName === 'macos' || osName === 'ios') && location.protocol === 'https:')
) {
const {
contentType,
Expand Down
2 changes: 1 addition & 1 deletion core/tauri/src/ipc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
};

pub(crate) mod channel;
#[cfg(any(target_os = "macos", not(ipc_custom_protocol)))]
#[cfg(any(target_os = "macos", target_os = "ios", not(ipc_custom_protocol)))]
pub(crate) mod format_callback;
pub(crate) mod protocol;

Expand Down
4 changes: 2 additions & 2 deletions core/tauri/src/ipc/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use super::{CallbackFn, InvokeBody, InvokeResponse};
const TAURI_CALLBACK_HEADER_NAME: &str = "Tauri-Callback";
const TAURI_ERROR_HEADER_NAME: &str = "Tauri-Error";

#[cfg(any(target_os = "macos", not(ipc_custom_protocol)))]
#[cfg(any(target_os = "macos", target_os = "ios", not(ipc_custom_protocol)))]
pub fn message_handler<R: Runtime>(
manager: WindowManager<R>,
) -> crate::runtime::webview::WebviewIpcHandler<crate::EventLoopMessage, R> {
Expand Down Expand Up @@ -125,7 +125,7 @@ pub fn get<R: Runtime>(manager: WindowManager<R>, label: String) -> UriSchemePro
})
}

#[cfg(any(target_os = "macos", not(ipc_custom_protocol)))]
#[cfg(any(target_os = "macos", target_os = "ios", not(ipc_custom_protocol)))]
fn handle_ipc_message<R: Runtime>(message: String, manager: &WindowManager<R>, label: &str) {
if let Some(window) = manager.get_window(label) {
use serde::{Deserialize, Deserializer};
Expand Down
2 changes: 1 addition & 1 deletion core/tauri/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ impl<R: Runtime> WindowManager<R> {
app_handle.clone(),
)?;

#[cfg(any(target_os = "macos", not(ipc_custom_protocol)))]
#[cfg(any(target_os = "macos", target_os = "ios", not(ipc_custom_protocol)))]
{
pending.ipc_handler = Some(crate::ipc::protocol::message_handler(self.clone()));
}
Expand Down

0 comments on commit a52f13c

Please sign in to comment.