| 1 | use std::sync::Arc; |
| 2 | |
| 3 | use gpui_kit::*; |
| 4 | |
| 5 | use crate::backend::Engine; |
| 6 | use crate::card_state::CardScope; |
| 7 | |
| 8 | #[cfg(windows)] |
| 9 | mod hosted; |
| 10 | #[cfg_attr(not(windows), allow(dead_code))] |
| 11 | mod sdk; |
| 12 | |
| 13 | #[cfg(windows)] |
| 14 | pub use hosted::install_host; |
| 15 | |
| 16 | #[cfg_attr(not(windows), allow(dead_code))] |
| 17 | #[derive(Debug, Clone, PartialEq)] |
| 18 | pub struct UrlDialog { |
| 19 | pub title: String, |
| 20 | pub url: String, |
| 21 | pub fallback_url: String, |
| 22 | pub width: u32, |
| 23 | pub height: u32, |
| 24 | pub app_id: String, |
| 25 | pub bot_id: String, |
| 26 | pub scope: CardScope, |
| 27 | pub web_application_resource: Option<String>, |
| 28 | } |
| 29 | |
| 30 | #[cfg_attr(not(windows), allow(dead_code))] |
| 31 | #[derive(Debug, Clone, PartialEq, Eq)] |
| 32 | pub enum UrlDialogNext { |
| 33 | Close, |
| 34 | Navigate { |
| 35 | url: String, |
| 36 | width: u32, |
| 37 | height: u32, |
| 38 | }, |
| 39 | } |
| 40 | |
| 41 | #[cfg(windows)] |
| 42 | pub fn open_url_dialog(dialog: UrlDialog, engine: Option<Arc<Engine>>, cx: &mut App) { |
| 43 | hosted::open(dialog, engine, cx); |
| 44 | } |
| 45 | |
| 46 | #[cfg(not(windows))] |
| 47 | pub fn open_url_dialog(dialog: UrlDialog, _engine: Option<Arc<Engine>>, cx: &mut App) { |
| 48 | cx.open_url(&dialog.fallback_url); |
| 49 | } |