소스 검색

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 <lucas@tauri.app>
Kartonrad 9 달 전
부모
커밋
68d4460361
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 1
      crates/tauri/src/ipc/mod.rs

+ 8 - 1
crates/tauri/src/ipc/mod.rs

@@ -45,6 +45,10 @@ pub type OwnedInvokeResponder<R> =
   dyn FnOnce(Webview<R>, String, InvokeResponse, CallbackFn, CallbackFn) + Send + 'static;
 
 /// Possible values of an IPC payload.
+///
+/// ### Android
+/// On Android, [InvokeBody::Raw] is not supported. The enum will always contain [InvokeBody::Json].
+/// 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]
 #[derive(Debug, Clone)]
 #[cfg_attr(test, derive(PartialEq))]
 pub enum InvokeBody {
@@ -132,6 +136,9 @@ impl InvokeResponseBody {
 }
 
 /// The IPC request.
+///
+/// Includes the `body` and `headers` parameters of a Tauri command invocation.
+/// This allows commands to accept raw bytes - on all platforms except Android.
 #[derive(Debug)]
 pub struct Request<'a> {
   body: &'a InvokeBody,
@@ -174,7 +181,7 @@ impl<T: Serialize> IpcResponse for T {
   }
 }
 
-/// The IPC request.
+/// The IPC response.
 pub struct Response {
   body: InvokeResponseBody,
 }