Rename room
crate to call
Also, rename `client::Call` to `client::IncomingCall`. Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
1158911560
commit
e0db62173a
13 changed files with 49 additions and 43 deletions
30
Cargo.lock
generated
30
Cargo.lock
generated
|
@ -684,6 +684,19 @@ version = "1.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
|
checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "call"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"client",
|
||||||
|
"collections",
|
||||||
|
"futures",
|
||||||
|
"gpui",
|
||||||
|
"project",
|
||||||
|
"util",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cap-fs-ext"
|
name = "cap-fs-ext"
|
||||||
version = "0.24.4"
|
version = "0.24.4"
|
||||||
|
@ -1019,6 +1032,7 @@ dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"axum-extra",
|
"axum-extra",
|
||||||
"base64",
|
"base64",
|
||||||
|
"call",
|
||||||
"clap 3.2.8",
|
"clap 3.2.8",
|
||||||
"client",
|
"client",
|
||||||
"collections",
|
"collections",
|
||||||
|
@ -1040,7 +1054,6 @@ dependencies = [
|
||||||
"prometheus",
|
"prometheus",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"room",
|
|
||||||
"rpc",
|
"rpc",
|
||||||
"scrypt",
|
"scrypt",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -1067,6 +1080,7 @@ name = "collab_ui"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"call",
|
||||||
"client",
|
"client",
|
||||||
"clock",
|
"clock",
|
||||||
"collections",
|
"collections",
|
||||||
|
@ -1078,7 +1092,6 @@ dependencies = [
|
||||||
"menu",
|
"menu",
|
||||||
"postage",
|
"postage",
|
||||||
"project",
|
"project",
|
||||||
"room",
|
|
||||||
"serde",
|
"serde",
|
||||||
"settings",
|
"settings",
|
||||||
"theme",
|
"theme",
|
||||||
|
@ -4452,19 +4465,6 @@ dependencies = [
|
||||||
"librocksdb-sys",
|
"librocksdb-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "room"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"client",
|
|
||||||
"collections",
|
|
||||||
"futures",
|
|
||||||
"gpui",
|
|
||||||
"project",
|
|
||||||
"util",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "roxmltree"
|
name = "roxmltree"
|
||||||
version = "0.14.1"
|
version = "0.14.1"
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
name = "room"
|
name = "call"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/room.rs"
|
path = "src/call.rs"
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[features]
|
[features]
|
|
@ -1,7 +1,10 @@
|
||||||
use crate::Room;
|
mod participant;
|
||||||
|
mod room;
|
||||||
|
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use client::{call::Call, Client, UserStore};
|
use client::{incoming_call::IncomingCall, Client, UserStore};
|
||||||
use gpui::{Entity, ModelContext, ModelHandle, MutableAppContext, Task};
|
use gpui::{Entity, ModelContext, ModelHandle, MutableAppContext, Task};
|
||||||
|
pub use room::Room;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
|
|
||||||
|
@ -49,7 +52,7 @@ impl ActiveCall {
|
||||||
|
|
||||||
pub fn join(
|
pub fn join(
|
||||||
&mut self,
|
&mut self,
|
||||||
call: &Call,
|
call: &IncomingCall,
|
||||||
client: &Arc<Client>,
|
client: &Arc<Client>,
|
||||||
user_store: &ModelHandle<UserStore>,
|
user_store: &ModelHandle<UserStore>,
|
||||||
cx: &mut ModelContext<Self>,
|
cx: &mut ModelContext<Self>,
|
|
@ -1,13 +1,9 @@
|
||||||
mod active_call;
|
use crate::participant::{LocalParticipant, ParticipantLocation, RemoteParticipant};
|
||||||
mod participant;
|
|
||||||
|
|
||||||
pub use active_call::ActiveCall;
|
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use client::{call::Call, proto, Client, PeerId, TypedEnvelope, User, UserStore};
|
use client::{incoming_call::IncomingCall, proto, Client, PeerId, TypedEnvelope, User, UserStore};
|
||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use gpui::{AsyncAppContext, Entity, ModelContext, ModelHandle, MutableAppContext, Task};
|
use gpui::{AsyncAppContext, Entity, ModelContext, ModelHandle, MutableAppContext, Task};
|
||||||
use participant::{LocalParticipant, ParticipantLocation, RemoteParticipant};
|
|
||||||
use project::Project;
|
use project::Project;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
|
@ -81,7 +77,7 @@ impl Room {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn join(
|
pub fn join(
|
||||||
call: &Call,
|
call: &IncomingCall,
|
||||||
client: Arc<Client>,
|
client: Arc<Client>,
|
||||||
user_store: ModelHandle<UserStore>,
|
user_store: ModelHandle<UserStore>,
|
||||||
cx: &mut MutableAppContext,
|
cx: &mut MutableAppContext,
|
|
@ -1,9 +1,9 @@
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
pub mod test;
|
pub mod test;
|
||||||
|
|
||||||
pub mod call;
|
|
||||||
pub mod channel;
|
pub mod channel;
|
||||||
pub mod http;
|
pub mod http;
|
||||||
|
pub mod incoming_call;
|
||||||
pub mod user;
|
pub mod user;
|
||||||
|
|
||||||
use anyhow::{anyhow, Context, Result};
|
use anyhow::{anyhow, Context, Result};
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::User;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Call {
|
pub struct IncomingCall {
|
||||||
pub room_id: u64,
|
pub room_id: u64,
|
||||||
pub caller: Arc<User>,
|
pub caller: Arc<User>,
|
||||||
pub participants: Vec<Arc<User>>,
|
pub participants: Vec<Arc<User>>,
|
|
@ -1,5 +1,5 @@
|
||||||
use super::{http::HttpClient, proto, Client, Status, TypedEnvelope};
|
use super::{http::HttpClient, proto, Client, Status, TypedEnvelope};
|
||||||
use crate::call::Call;
|
use crate::incoming_call::IncomingCall;
|
||||||
use anyhow::{anyhow, Context, Result};
|
use anyhow::{anyhow, Context, Result};
|
||||||
use collections::{hash_map::Entry, BTreeSet, HashMap, HashSet};
|
use collections::{hash_map::Entry, BTreeSet, HashMap, HashSet};
|
||||||
use futures::{channel::mpsc, future, AsyncReadExt, Future, StreamExt};
|
use futures::{channel::mpsc, future, AsyncReadExt, Future, StreamExt};
|
||||||
|
@ -67,7 +67,10 @@ pub struct UserStore {
|
||||||
outgoing_contact_requests: Vec<Arc<User>>,
|
outgoing_contact_requests: Vec<Arc<User>>,
|
||||||
pending_contact_requests: HashMap<u64, usize>,
|
pending_contact_requests: HashMap<u64, usize>,
|
||||||
invite_info: Option<InviteInfo>,
|
invite_info: Option<InviteInfo>,
|
||||||
incoming_call: (watch::Sender<Option<Call>>, watch::Receiver<Option<Call>>),
|
incoming_call: (
|
||||||
|
watch::Sender<Option<IncomingCall>>,
|
||||||
|
watch::Receiver<Option<IncomingCall>>,
|
||||||
|
),
|
||||||
client: Weak<Client>,
|
client: Weak<Client>,
|
||||||
http: Arc<dyn HttpClient>,
|
http: Arc<dyn HttpClient>,
|
||||||
_maintain_contacts: Task<()>,
|
_maintain_contacts: Task<()>,
|
||||||
|
@ -205,7 +208,7 @@ impl UserStore {
|
||||||
_: Arc<Client>,
|
_: Arc<Client>,
|
||||||
mut cx: AsyncAppContext,
|
mut cx: AsyncAppContext,
|
||||||
) -> Result<proto::Ack> {
|
) -> Result<proto::Ack> {
|
||||||
let call = Call {
|
let call = IncomingCall {
|
||||||
room_id: envelope.payload.room_id,
|
room_id: envelope.payload.room_id,
|
||||||
participants: this
|
participants: this
|
||||||
.update(&mut cx, |this, cx| {
|
.update(&mut cx, |this, cx| {
|
||||||
|
@ -241,7 +244,7 @@ impl UserStore {
|
||||||
self.invite_info.as_ref()
|
self.invite_info.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn incoming_call(&self) -> watch::Receiver<Option<Call>> {
|
pub fn incoming_call(&self) -> watch::Receiver<Option<IncomingCall>> {
|
||||||
self.incoming_call.1.clone()
|
self.incoming_call.1.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,13 +55,13 @@ features = ["runtime-tokio-rustls", "postgres", "time", "uuid"]
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
collections = { path = "../collections", features = ["test-support"] }
|
collections = { path = "../collections", features = ["test-support"] }
|
||||||
gpui = { path = "../gpui", features = ["test-support"] }
|
gpui = { path = "../gpui", features = ["test-support"] }
|
||||||
|
call = { path = "../call", features = ["test-support"] }
|
||||||
client = { path = "../client", features = ["test-support"] }
|
client = { path = "../client", features = ["test-support"] }
|
||||||
editor = { path = "../editor", features = ["test-support"] }
|
editor = { path = "../editor", features = ["test-support"] }
|
||||||
language = { path = "../language", features = ["test-support"] }
|
language = { path = "../language", features = ["test-support"] }
|
||||||
log = { version = "0.4.16", features = ["kv_unstable_serde"] }
|
log = { version = "0.4.16", features = ["kv_unstable_serde"] }
|
||||||
lsp = { path = "../lsp", features = ["test-support"] }
|
lsp = { path = "../lsp", features = ["test-support"] }
|
||||||
project = { path = "../project", features = ["test-support"] }
|
project = { path = "../project", features = ["test-support"] }
|
||||||
room = { path = "../room", features = ["test-support"] }
|
|
||||||
rpc = { path = "../rpc", features = ["test-support"] }
|
rpc = { path = "../rpc", features = ["test-support"] }
|
||||||
settings = { path = "../settings", features = ["test-support"] }
|
settings = { path = "../settings", features = ["test-support"] }
|
||||||
theme = { path = "../theme" }
|
theme = { path = "../theme" }
|
||||||
|
|
|
@ -5,6 +5,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
use ::rpc::Peer;
|
use ::rpc::Peer;
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
|
use call::Room;
|
||||||
use client::{
|
use client::{
|
||||||
self, proto, test::FakeHttpClient, Channel, ChannelDetails, ChannelList, Client, Connection,
|
self, proto, test::FakeHttpClient, Channel, ChannelDetails, ChannelList, Client, Connection,
|
||||||
Credentials, EstablishConnectionError, ProjectMetadata, UserStore, RECEIVE_TIMEOUT,
|
Credentials, EstablishConnectionError, ProjectMetadata, UserStore, RECEIVE_TIMEOUT,
|
||||||
|
@ -34,7 +35,6 @@ use project::{
|
||||||
DiagnosticSummary, Project, ProjectPath, ProjectStore, WorktreeId,
|
DiagnosticSummary, Project, ProjectPath, ProjectStore, WorktreeId,
|
||||||
};
|
};
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use room::Room;
|
|
||||||
use rpc::PeerId;
|
use rpc::PeerId;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use settings::{Formatter, Settings};
|
use settings::{Formatter, Settings};
|
||||||
|
|
|
@ -9,18 +9,19 @@ doctest = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
test-support = [
|
test-support = [
|
||||||
|
"call/test-support",
|
||||||
"client/test-support",
|
"client/test-support",
|
||||||
"collections/test-support",
|
"collections/test-support",
|
||||||
"editor/test-support",
|
"editor/test-support",
|
||||||
"gpui/test-support",
|
"gpui/test-support",
|
||||||
"project/test-support",
|
"project/test-support",
|
||||||
"room/test-support",
|
|
||||||
"settings/test-support",
|
"settings/test-support",
|
||||||
"util/test-support",
|
"util/test-support",
|
||||||
"workspace/test-support",
|
"workspace/test-support",
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
call = { path = "../call" }
|
||||||
client = { path = "../client" }
|
client = { path = "../client" }
|
||||||
clock = { path = "../clock" }
|
clock = { path = "../clock" }
|
||||||
collections = { path = "../collections" }
|
collections = { path = "../collections" }
|
||||||
|
@ -29,7 +30,6 @@ fuzzy = { path = "../fuzzy" }
|
||||||
gpui = { path = "../gpui" }
|
gpui = { path = "../gpui" }
|
||||||
menu = { path = "../menu" }
|
menu = { path = "../menu" }
|
||||||
project = { path = "../project" }
|
project = { path = "../project" }
|
||||||
room = { path = "../room" }
|
|
||||||
settings = { path = "../settings" }
|
settings = { path = "../settings" }
|
||||||
theme = { path = "../theme" }
|
theme = { path = "../theme" }
|
||||||
util = { path = "../util" }
|
util = { path = "../util" }
|
||||||
|
@ -41,12 +41,12 @@ postage = { version = "0.4.1", features = ["futures-traits"] }
|
||||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
call = { path = "../call", features = ["test-support"] }
|
||||||
client = { path = "../client", features = ["test-support"] }
|
client = { path = "../client", features = ["test-support"] }
|
||||||
collections = { path = "../collections", features = ["test-support"] }
|
collections = { path = "../collections", features = ["test-support"] }
|
||||||
editor = { path = "../editor", features = ["test-support"] }
|
editor = { path = "../editor", features = ["test-support"] }
|
||||||
gpui = { path = "../gpui", features = ["test-support"] }
|
gpui = { path = "../gpui", features = ["test-support"] }
|
||||||
project = { path = "../project", features = ["test-support"] }
|
project = { path = "../project", features = ["test-support"] }
|
||||||
room = { path = "../room", features = ["test-support"] }
|
|
||||||
settings = { path = "../settings", features = ["test-support"] }
|
settings = { path = "../settings", features = ["test-support"] }
|
||||||
util = { path = "../util", features = ["test-support"] }
|
util = { path = "../util", features = ["test-support"] }
|
||||||
workspace = { path = "../workspace", features = ["test-support"] }
|
workspace = { path = "../workspace", features = ["test-support"] }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use call::ActiveCall;
|
||||||
use client::{Client, Contact, User, UserStore};
|
use client::{Client, Contact, User, UserStore};
|
||||||
use editor::{Cancel, Editor};
|
use editor::{Cancel, Editor};
|
||||||
use fuzzy::{match_strings, StringMatchCandidate};
|
use fuzzy::{match_strings, StringMatchCandidate};
|
||||||
|
@ -9,7 +10,6 @@ use gpui::{
|
||||||
ViewHandle,
|
ViewHandle,
|
||||||
};
|
};
|
||||||
use menu::{Confirm, SelectNext, SelectPrev};
|
use menu::{Confirm, SelectNext, SelectPrev};
|
||||||
use room::ActiveCall;
|
|
||||||
use settings::Settings;
|
use settings::Settings;
|
||||||
use theme::IconButton;
|
use theme::IconButton;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use client::{call::Call, Client, UserStore};
|
use call::ActiveCall;
|
||||||
|
use client::{incoming_call::IncomingCall, Client, UserStore};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
elements::*,
|
elements::*,
|
||||||
|
@ -8,7 +9,6 @@ use gpui::{
|
||||||
impl_internal_actions, Entity, ModelHandle, MouseButton, MutableAppContext, RenderContext,
|
impl_internal_actions, Entity, ModelHandle, MouseButton, MutableAppContext, RenderContext,
|
||||||
View, ViewContext, WindowBounds, WindowKind, WindowOptions,
|
View, ViewContext, WindowBounds, WindowKind, WindowOptions,
|
||||||
};
|
};
|
||||||
use room::ActiveCall;
|
|
||||||
use settings::Settings;
|
use settings::Settings;
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
|
|
||||||
|
@ -55,13 +55,17 @@ struct RespondToCall {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct IncomingCallNotification {
|
pub struct IncomingCallNotification {
|
||||||
call: Call,
|
call: IncomingCall,
|
||||||
client: Arc<Client>,
|
client: Arc<Client>,
|
||||||
user_store: ModelHandle<UserStore>,
|
user_store: ModelHandle<UserStore>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IncomingCallNotification {
|
impl IncomingCallNotification {
|
||||||
pub fn new(call: Call, client: Arc<Client>, user_store: ModelHandle<UserStore>) -> Self {
|
pub fn new(
|
||||||
|
call: IncomingCall,
|
||||||
|
client: Arc<Client>,
|
||||||
|
user_store: ModelHandle<UserStore>,
|
||||||
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
call,
|
call,
|
||||||
client,
|
client,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue