More progress and some debug logs to remove

This commit is contained in:
Conrad Irwin 2023-10-06 16:48:29 -06:00
parent 63a230f92e
commit f6bc229d1d
5 changed files with 46 additions and 6 deletions

View file

@ -76,7 +76,7 @@
// Settings related to calls in Zed // Settings related to calls in Zed
"calls": { "calls": {
// Join calls with the microphone muted by default // Join calls with the microphone muted by default
"mute_on_join": true "mute_on_join": false
}, },
// Scrollbar related settings // Scrollbar related settings
"scrollbar": { "scrollbar": {

View file

@ -44,9 +44,9 @@ impl ReleaseChannel {
pub fn url_scheme(&self) -> &'static str { pub fn url_scheme(&self) -> &'static str {
match self { match self {
ReleaseChannel::Dev => "zed-dev:/", ReleaseChannel::Dev => "zed-dev://",
ReleaseChannel::Preview => "zed-preview:/", ReleaseChannel::Preview => "zed-preview://",
ReleaseChannel::Stable => "zed:/", ReleaseChannel::Stable => "zed://",
} }
} }

View file

@ -47,6 +47,7 @@ use std::{
any::TypeId, any::TypeId,
borrow::Cow, borrow::Cow,
cmp, env, cmp, env,
fs::OpenOptions,
future::Future, future::Future,
path::{Path, PathBuf}, path::{Path, PathBuf},
rc::Rc, rc::Rc,
@ -4161,6 +4162,7 @@ async fn join_channel_internal(
active_call: &ModelHandle<ActiveCall>, active_call: &ModelHandle<ActiveCall>,
cx: &mut AsyncAppContext, cx: &mut AsyncAppContext,
) -> Result<bool> { ) -> Result<bool> {
dbg!("join channel internal");
let should_prompt = active_call.read_with(cx, |active_call, cx| { let should_prompt = active_call.read_with(cx, |active_call, cx| {
let Some(room) = active_call.room().map(|room| room.read(cx)) else { let Some(room) = active_call.room().map(|room| room.read(cx)) else {
return false; return false;
@ -4193,6 +4195,7 @@ async fn join_channel_internal(
return Ok(false); // unreachable!() hopefully return Ok(false); // unreachable!() hopefully
} }
} }
dbg!("asdajdkjkasd");
let client = cx.read(|cx| active_call.read(cx).client()); let client = cx.read(|cx| active_call.read(cx).client());
@ -4218,13 +4221,17 @@ async fn join_channel_internal(
} }
} }
dbg!("past here");
let room = active_call let room = active_call
.update(cx, |active_call, cx| { .update(cx, |active_call, cx| {
active_call.join_channel(channel_id, cx) active_call.join_channel(channel_id, cx)
}) })
.await?; .await?;
room.update(cx, |room, cx| room.next_room_update()).await; room.update(cx, |room, _| room.next_room_update()).await;
dbg!("wow");
let task = room.update(cx, |room, cx| { let task = room.update(cx, |room, cx| {
if let Some((project, host)) = room.most_active_project() { if let Some((project, host)) = room.most_active_project() {
@ -4237,7 +4244,16 @@ async fn join_channel_internal(
task.await?; task.await?;
return anyhow::Ok(true); return anyhow::Ok(true);
} }
use std::io::Write;
writeln!(
OpenOptions::new()
.write(true)
.append(true)
.open("/Users/conrad/dbg")
.unwrap(),
"no jokes"
)
.unwrap();
anyhow::Ok(false) anyhow::Ok(false)
} }
@ -4257,6 +4273,7 @@ pub fn join_channel(
&mut cx, &mut cx,
) )
.await; .await;
dbg!("joined!");
// join channel succeeded, and opened a window // join channel succeeded, and opened a window
if matches!(result, Ok(true)) { if matches!(result, Ok(true)) {

View file

@ -66,6 +66,15 @@ use crate::open_url::{OpenListener, OpenRequest};
mod open_url; mod open_url;
fn main() { fn main() {
writeln!(
OpenOptions::new()
.write(true)
.append(true)
.open("/Users/conrad/dbg")
.unwrap(),
"HELLO"
)
.unwrap();
let http = http::client(); let http = http::client();
init_paths(); init_paths();
init_logger(); init_logger();
@ -270,6 +279,7 @@ fn main() {
} }
OpenRequest::JoinChannel { channel_id } => cx OpenRequest::JoinChannel { channel_id } => cx
.update(|cx| { .update(|cx| {
dbg!("joining channel");
workspace::join_channel(channel_id, app_state.clone(), None, cx) workspace::join_channel(channel_id, app_state.clone(), None, cx)
}) })
.detach(), .detach(),

View file

@ -3,6 +3,8 @@ use cli::{ipc::IpcSender, CliRequest, CliResponse};
use futures::channel::mpsc; use futures::channel::mpsc;
use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender}; use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender};
use std::ffi::OsStr; use std::ffi::OsStr;
use std::fs::OpenOptions;
use std::io::Write;
use std::os::unix::prelude::OsStrExt; use std::os::unix::prelude::OsStrExt;
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use std::{path::PathBuf, sync::atomic::AtomicBool}; use std::{path::PathBuf, sync::atomic::AtomicBool};
@ -41,6 +43,16 @@ impl OpenListener {
} }
pub fn open_urls(&self, urls: Vec<String>) { pub fn open_urls(&self, urls: Vec<String>) {
writeln!(
OpenOptions::new()
.write(true)
.append(true)
.open("/Users/conrad/dbg")
.unwrap(),
"{:?}",
&urls,
)
.unwrap();
self.triggered.store(true, Ordering::Release); self.triggered.store(true, Ordering::Release);
let request = if let Some(server_name) = let request = if let Some(server_name) =
urls.first().and_then(|url| url.strip_prefix("zed-cli://")) urls.first().and_then(|url| url.strip_prefix("zed-cli://"))
@ -79,6 +91,7 @@ impl OpenListener {
} }
} }
} }
log::error!("invalid zed url: {}", request_path);
None None
} }