parent
2d16d2d036
commit
ffe36c9beb
15 changed files with 8 additions and 459 deletions
|
@ -16,7 +16,7 @@ use anyhow::{anyhow, Context as _, Result};
|
|||
use call::{call_settings::CallSettings, ActiveCall};
|
||||
use client::{
|
||||
proto::{self, ErrorCode, PanelId, PeerId},
|
||||
ChannelId, Client, ErrorExt, ProjectId, Status, TypedEnvelope, UserStore,
|
||||
ChannelId, Client, ErrorExt, Status, TypedEnvelope, UserStore,
|
||||
};
|
||||
use collections::{hash_map, HashMap, HashSet};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
|
@ -5469,58 +5469,6 @@ pub fn create_and_open_local_file(
|
|||
})
|
||||
}
|
||||
|
||||
pub fn join_hosted_project(
|
||||
hosted_project_id: ProjectId,
|
||||
app_state: Arc<AppState>,
|
||||
cx: &mut AppContext,
|
||||
) -> Task<Result<()>> {
|
||||
cx.spawn(|mut cx| async move {
|
||||
let existing_window = cx.update(|cx| {
|
||||
cx.windows().into_iter().find_map(|window| {
|
||||
let workspace = window.downcast::<Workspace>()?;
|
||||
workspace
|
||||
.read(cx)
|
||||
.is_ok_and(|workspace| {
|
||||
workspace.project().read(cx).hosted_project_id() == Some(hosted_project_id)
|
||||
})
|
||||
.then_some(workspace)
|
||||
})
|
||||
})?;
|
||||
|
||||
let workspace = if let Some(existing_window) = existing_window {
|
||||
existing_window
|
||||
} else {
|
||||
let project = Project::hosted(
|
||||
hosted_project_id,
|
||||
app_state.user_store.clone(),
|
||||
app_state.client.clone(),
|
||||
app_state.languages.clone(),
|
||||
app_state.fs.clone(),
|
||||
cx.clone(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
let window_bounds_override = window_bounds_env_override();
|
||||
cx.update(|cx| {
|
||||
let mut options = (app_state.build_window_options)(None, cx);
|
||||
options.window_bounds = window_bounds_override.map(WindowBounds::Windowed);
|
||||
cx.open_window(options, |cx| {
|
||||
cx.new_view(|cx| {
|
||||
Workspace::new(Default::default(), project, app_state.clone(), cx)
|
||||
})
|
||||
})
|
||||
})??
|
||||
};
|
||||
|
||||
workspace.update(&mut cx, |_, cx| {
|
||||
cx.activate(true);
|
||||
cx.activate_window();
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
pub fn open_ssh_project(
|
||||
window: WindowHandle<Workspace>,
|
||||
connection_options: SshConnectionOptions,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue