Skip to content

Commit 68d4460

Browse files
docs(android): warn users that passing raw bytes over ipc is not possible on android (#11333)
* Warn that android is not supported * Warn that Android is not supported. * Update crates/tauri/src/ipc/mod.rs --------- Co-authored-by: Lucas Fernandes Nogueira <[email protected]>
1 parent f3f521f commit 68d4460

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

crates/tauri/src/ipc/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ pub type OwnedInvokeResponder<R> =
4545
dyn FnOnce(Webview<R>, String, InvokeResponse, CallbackFn, CallbackFn) + Send + 'static;
4646

4747
/// Possible values of an IPC payload.
48+
///
49+
/// ### Android
50+
/// On Android, [InvokeBody::Raw] is not supported. The enum will always contain [InvokeBody::Json].
51+
/// When targeting Android Devices, consider passing raw bytes as a base64 [[std::string::String]], which is still more efficient than passing them as a number array in [InvokeBody::Json]
4852
#[derive(Debug, Clone)]
4953
#[cfg_attr(test, derive(PartialEq))]
5054
pub enum InvokeBody {
@@ -132,6 +136,9 @@ impl InvokeResponseBody {
132136
}
133137

134138
/// The IPC request.
139+
///
140+
/// Includes the `body` and `headers` parameters of a Tauri command invocation.
141+
/// This allows commands to accept raw bytes - on all platforms except Android.
135142
#[derive(Debug)]
136143
pub struct Request<'a> {
137144
body: &'a InvokeBody,
@@ -174,7 +181,7 @@ impl<T: Serialize> IpcResponse for T {
174181
}
175182
}
176183

177-
/// The IPC request.
184+
/// The IPC response.
178185
pub struct Response {
179186
body: InvokeResponseBody,
180187
}

0 commit comments

Comments
 (0)