update
This commit is contained in:
@@ -58,7 +58,6 @@ impl RepoListView {
|
||||
let name = announcement
|
||||
.name
|
||||
.clone()
|
||||
.map(|s| SharedString::from(s.trim()))
|
||||
.unwrap_or_else(|| SharedString::from(announcement.id.clone()));
|
||||
|
||||
let description = announcement.description.clone().unwrap_or_default();
|
||||
|
||||
@@ -103,21 +103,20 @@ pub fn open(
|
||||
state.error = None;
|
||||
});
|
||||
|
||||
let rx = backend.update(cx, |backend, cx| {
|
||||
let task = backend.update(cx, |backend, cx| {
|
||||
backend.create_identity(&name, &pass, cx)
|
||||
});
|
||||
|
||||
let handle = window.window_handle();
|
||||
let state = state.clone();
|
||||
|
||||
cx.spawn(async move |cx| match rx.recv_async().await {
|
||||
Ok(Ok(_)) => {
|
||||
cx.spawn(async move |cx| match task.await {
|
||||
Ok(_) => {
|
||||
cx.update_window(handle, |_, window, cx| {
|
||||
window.close_dialog(cx);
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
Ok(Err(e)) => {
|
||||
Err(e) => {
|
||||
cx.update_window(handle, |_, _window, cx| {
|
||||
state.update(cx, |state, _| {
|
||||
state.busy = false;
|
||||
@@ -126,7 +125,6 @@ pub fn open(
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
Err(_) => {}
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
|
||||
@@ -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