Move share button and support unsharing

This commit is contained in:
Julia 2023-01-26 23:59:19 -05:00
parent ed2f1ddd2d
commit e96d52f35a
3 changed files with 80 additions and 20 deletions

View file

@ -284,6 +284,18 @@ impl ActiveCall {
}
}
pub fn unshare_project(
&mut self,
project: ModelHandle<Project>,
cx: &mut ModelContext<Self>,
) -> Result<()> {
if let Some((room, _)) = self.room.as_ref() {
room.update(cx, |room, cx| room.unshare_project(project, cx))
} else {
Err(anyhow!("no active call"))
}
}
pub fn set_location(
&mut self,
project: Option<&ModelHandle<Project>>,

View file

@ -793,6 +793,19 @@ impl Room {
})
}
pub(crate) fn unshare_project(
&mut self,
project: ModelHandle<Project>,
cx: &mut ModelContext<Self>,
) -> Result<()> {
let project_id = match project.read(cx).remote_id() {
Some(project_id) => project_id,
None => return Ok(()),
};
self.client.send(proto::UnshareProject { project_id })
}
pub(crate) fn set_location(
&mut self,
project: Option<&ModelHandle<Project>>,