From b16e2169ce3c55fd2b02ecefc6f291927be60ef1 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 24 Mar 2023 16:50:27 +0100 Subject: [PATCH] WIP: Start on showing window for authenticating with copilot Co-Authored-By: Mikayla Maki --- crates/copilot/src/sign_in.rs | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/crates/copilot/src/sign_in.rs b/crates/copilot/src/sign_in.rs index 9551b2c413..1b1f0f816d 100644 --- a/crates/copilot/src/sign_in.rs +++ b/crates/copilot/src/sign_in.rs @@ -2,7 +2,7 @@ use crate::{request::PromptUserDeviceFlow, Copilot}; use gpui::{ elements::*, geometry::{rect::RectF, vector::vec2f}, - Axis, Element, Entity, MutableAppContext, View, ViewContext, WindowKind, WindowOptions, + Axis, Element, Entity, MutableAppContext, View, WindowKind, WindowOptions, }; use settings::Settings; @@ -19,19 +19,18 @@ pub fn init(cx: &mut MutableAppContext) { cx.remove_window(window_id); } - let screen = cx.platform().screens().pop(); let (window_id, _) = cx.add_window( WindowOptions { bounds: gpui::WindowBounds::Fixed(RectF::new( - vec2f(100., 100.), - vec2f(300., 300.), + Default::default(), + vec2f(600., 400.), )), titlebar: None, - center: false, + center: true, focus: false, kind: WindowKind::Normal, is_movable: true, - screen, + screen: None, }, |_| CopilotCodeVerification::new(prompt), ); @@ -47,16 +46,12 @@ pub fn init(cx: &mut MutableAppContext) { .detach(); } -pub enum Event { - Dismiss, -} - pub struct CopilotCodeVerification { prompt: PromptUserDeviceFlow, } impl Entity for CopilotCodeVerification { - type Event = Event; + type Event = (); } impl View for CopilotCodeVerification { @@ -85,10 +80,6 @@ impl View for CopilotCodeVerification { .with_style(style.auth_modal) .named("Copilot Authentication status modal") } - - fn focus_out(&mut self, _: gpui::AnyViewHandle, cx: &mut ViewContext) { - cx.emit(Event::Dismiss) - } } impl CopilotCodeVerification {