From cc1c6aedcb7f45da25e43788bb341b3f988db701 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Wed, 14 Sep 2022 14:17:30 +0300 Subject: [PATCH] Revert sync_with_callback api call changes --- examples/emoji_verification/src/main.rs | 11 ++--------- examples/wasm_command_bot/src/lib.rs | 4 +--- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/examples/emoji_verification/src/main.rs b/examples/emoji_verification/src/main.rs index 59783427d..08e979aa3 100644 --- a/examples/emoji_verification/src/main.rs +++ b/examples/emoji_verification/src/main.rs @@ -80,14 +80,7 @@ async fn sync(client: Client) -> matrix_sdk::Result<()> { let client = &client_ref; let initial = &initial_ref; - if response.is_err() { - return LoopCtrl::Break; - } - - let sync_response = response.ok().unwrap(); - - for event in sync_response.to_device.events.iter().filter_map(|e| e.deserialize().ok()) - { + for event in response.to_device.events.iter().filter_map(|e| e.deserialize().ok()) { match event { AnyToDeviceEvent::KeyVerificationRequest(e) => { let request = client @@ -142,7 +135,7 @@ async fn sync(client: Client) -> matrix_sdk::Result<()> { } if !initial.load(Ordering::SeqCst) { - for (_room_id, room_info) in sync_response.rooms.join { + for (_room_id, room_info) in response.rooms.join { for event in room_info.timeline.events.iter().filter_map(|e| e.event.deserialize().ok()) { diff --git a/examples/wasm_command_bot/src/lib.rs b/examples/wasm_command_bot/src/lib.rs index 37775f7cc..3f2b732e6 100644 --- a/examples/wasm_command_bot/src/lib.rs +++ b/examples/wasm_command_bot/src/lib.rs @@ -97,9 +97,7 @@ pub async fn run() -> Result { client.sync_once(SyncSettings::default()).await.unwrap(); let settings = SyncSettings::default().token(client.sync_token().await.unwrap()); - client - .sync_with_callback(settings, |response| bot.on_sync_response(response.ok().unwrap())) - .await; + client.sync_with_callback(settings, |response| bot.on_sync_response(response)).await; Ok(JsValue::NULL) }