mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-14 11:05:32 -04:00
Revert sync_with_callback api call changes
This commit is contained in:
@@ -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())
|
||||
{
|
||||
|
||||
@@ -97,9 +97,7 @@ pub async fn run() -> Result<JsValue, JsValue> {
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user