update
This commit is contained in:
@@ -118,18 +118,19 @@ fn unlock(
|
||||
state.error = None;
|
||||
});
|
||||
|
||||
let rx = backend.update(cx, |backend, cx| backend.restore_with_passphrase(&pass, cx));
|
||||
|
||||
let task = backend.update(cx, |backend, cx| backend.restore_with_passphrase(&pass, cx));
|
||||
let handle = *handle;
|
||||
let state = state.clone();
|
||||
|
||||
cx.spawn(async move |cx| match rx.recv_async().await {
|
||||
Ok(Ok(_)) => {
|
||||
cx.update_window(handle, |_, window, cx| window.close_dialog(cx))
|
||||
.ok();
|
||||
cx.spawn(async move |cx| match task.await {
|
||||
Ok(_) => {
|
||||
cx.update_window(handle, |_this, window, cx| {
|
||||
window.close_dialog(cx);
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
Ok(Err(e)) => {
|
||||
cx.update_window(handle, |_, _window, cx| {
|
||||
Err(e) => {
|
||||
cx.update_window(handle, |_this, _window, cx| {
|
||||
state.update(cx, |state, _| {
|
||||
state.busy = false;
|
||||
state.error = Some(e.to_string().into());
|
||||
@@ -137,7 +138,6 @@ fn unlock(
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
Err(_) => {}
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user