mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Auto-connect to server on startup if credentials are on the keychain
This commit is contained in:
parent
8d7bb8b1a3
commit
e8bbd370e4
@ -356,6 +356,10 @@ impl Client {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_keychain_credentials(&self, cx: &AsyncAppContext) -> bool {
|
||||
read_credentials_from_keychain(cx).is_some()
|
||||
}
|
||||
|
||||
#[async_recursion(?Send)]
|
||||
pub async fn authenticate_and_connect(
|
||||
self: &Arc<Self>,
|
||||
|
@ -61,6 +61,16 @@ fn main() {
|
||||
chat_panel::init(cx);
|
||||
project_panel::init(cx);
|
||||
diagnostics::init(cx);
|
||||
cx.spawn({
|
||||
let client = client.clone();
|
||||
|cx| async move {
|
||||
if client.has_keychain_credentials(&cx) {
|
||||
client.authenticate_and_connect(&cx).await?;
|
||||
}
|
||||
Ok::<_, anyhow::Error>(())
|
||||
}
|
||||
})
|
||||
.detach_and_log_err(cx);
|
||||
|
||||
let app_state = Arc::new(AppState {
|
||||
languages: languages.clone(),
|
||||
|
Loading…
Reference in New Issue
Block a user