From 3e50715a0027abe19a40d4bcb325d8484567fa1a Mon Sep 17 00:00:00 2001 From: Erwan Leboucher Date: Fri, 28 Aug 2026 19:31:41 +0200 Subject: [PATCH] fix(crypto): spell AppHandle with the runtime so the CEF build compiles --- src-tauri/src/matrix_crypto/events.rs | 11 +++++++++-- src-tauri/src/matrix_crypto/mod.rs | 10 +++++++--- src-tauri/src/matrix_crypto/push.rs | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/matrix_crypto/events.rs b/src-tauri/src/matrix_crypto/events.rs index 664b738a8..e776941a1 100644 --- a/src-tauri/src/matrix_crypto/events.rs +++ b/src-tauri/src/matrix_crypto/events.rs @@ -33,7 +33,11 @@ fn withheld_json(info: &RoomKeyWithheldInfo) -> Value { /// One task per stream. The returned handles must be aborted when the engine is /// closed: the streams outlive the machine, so they would otherwise keep the /// listeners alive for an account that is no longer open. -pub fn spawn(app: &AppHandle, machine: &OlmMachine, account: String) -> Vec> { +pub fn spawn( + app: &AppHandle, + machine: &OlmMachine, + account: String, +) -> Vec> { let store = machine.store(); let mut room_keys = store.room_keys_received_stream(); @@ -41,7 +45,10 @@ pub fn spawn(app: &AppHandle, machine: &OlmMachine, account: String) -> Vec, + event: &'static str, + account: String, + payload: Value| { // A failed emit means the webview is gone; the abort on close is what // stops these tasks, so there is nothing to recover here. let _ = app.emit(event, json!({ "account": account, "payload": payload })); diff --git a/src-tauri/src/matrix_crypto/mod.rs b/src-tauri/src/matrix_crypto/mod.rs index 381122587..c089b413a 100644 --- a/src-tauri/src/matrix_crypto/mod.rs +++ b/src-tauri/src/matrix_crypto/mod.rs @@ -122,7 +122,11 @@ pub fn store_subpath(user_id: &str, device_id: &str) -> PathBuf { /// Per-account store directory. Resolved here rather than passed in so the /// webview never has to know an absolute path, and so the native notification /// handler can derive the same location independently. -fn store_dir(app: &tauri::AppHandle, user_id: &str, device_id: &str) -> Result { +fn store_dir( + app: &tauri::AppHandle, + user_id: &str, + device_id: &str, +) -> Result { let base = match app_group_dir() { Some(shared) => shared, None => app @@ -182,7 +186,7 @@ pub async fn open_machine( #[tauri::command] pub async fn engine_open( - app: tauri::AppHandle, + app: tauri::AppHandle, dir: Option, passphrase: Option, user_id: String, @@ -213,7 +217,7 @@ pub async fn engine_close(user_id: String, device_id: String) -> Result, user_id: String, device_id: String, ) -> Result<(), String> { diff --git a/src-tauri/src/matrix_crypto/push.rs b/src-tauri/src/matrix_crypto/push.rs index ba5357005..4e1d68f27 100644 --- a/src-tauri/src/matrix_crypto/push.rs +++ b/src-tauri/src/matrix_crypto/push.rs @@ -117,7 +117,7 @@ pub async fn decrypt_push( /// with no webview alive there is nothing to invoke a command. #[tauri::command] pub async fn engine_decrypt_push( - app: tauri::AppHandle, + app: tauri::AppHandle, user_id: String, device_id: String, room_id: String,