Tell the user when screen-sharing fails (#7171)

Conrad Irwin created

Release Notes:

- Added an alert when screen-sharing fails

Change summary

crates/collab_ui/src/collab_ui.rs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Detailed changes

crates/collab_ui/src/collab_ui.rs 🔗

@@ -14,13 +14,13 @@ pub use collab_panel::CollabPanel;
 pub use collab_titlebar_item::CollabTitlebarItem;
 use gpui::{
     actions, point, AppContext, GlobalPixels, Pixels, PlatformDisplay, Size, Task, WindowBounds,
-    WindowKind, WindowOptions,
+    WindowContext, WindowKind, WindowOptions,
 };
 pub use panel_settings::{
     ChatPanelSettings, CollaborationPanelSettings, NotificationPanelSettings,
 };
 use settings::Settings;
-use workspace::AppState;
+use workspace::{notifications::DetachAndPromptErr, AppState};
 
 actions!(
     collab,
@@ -41,7 +41,7 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
     notifications::init(&app_state, cx);
 }
 
-pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {
+pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut WindowContext) {
     let call = ActiveCall::global(cx).read(cx);
     if let Some(room) = call.room().cloned() {
         let client = call.client();
@@ -64,7 +64,7 @@ pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {
                 room.share_screen(cx)
             }
         });
-        toggle_screen_sharing.detach_and_log_err(cx);
+        toggle_screen_sharing.detach_and_prompt_err("Sharing Screen Failed", cx, |e, _| Some(format!("{:?}\n\nPlease check that you have given Zed permissions to record your screen in Settings.", e)));
     }
 }