| 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 | pub mod hosted; |
| 10 | #[cfg(windows)] |
| 11 | use app_base::task_dialog::sdk; |
| 12 | |
| 13 | #[cfg(windows)] |
| 14 | pub use hosted::install_host; |
| 15 | #[cfg(windows)] |
| 16 | pub use hosted::host as webview_host; // KVT-fork |
| 17 | |
| 18 | #[cfg_attr(not(windows), allow(dead_code))] |
| 19 | #[derive(Debug, Clone, PartialEq)] |
| 20 | pub struct UrlDialog { |
| 21 | pub title: String, |
| 22 | pub url: String, |
| 23 | pub fallback_url: String, |
| 24 | pub width: u32, |
| 25 | pub height: u32, |
| 26 | pub app_id: String, |
| 27 | pub bot_id: String, |
| 28 | pub scope: CardScope, |
| 29 | pub web_application_resource: Option<String>, |
| 30 | } |
| 31 | |
| 32 | #[cfg_attr(not(windows), allow(dead_code))] |
| 33 | #[derive(Debug, Clone, PartialEq, Eq)] |
| 34 | pub enum UrlDialogNext { |
| 35 | Close, |
| 36 | Navigate { |
| 37 | url: String, |
| 38 | width: u32, |
| 39 | height: u32, |
| 40 | }, |
| 41 | } |
| 42 | |
| 43 | #[cfg(windows)] |
| 44 | pub fn open_url_dialog(dialog: UrlDialog, engine: Option<Arc<Engine>>, cx: &mut App) { |
| 45 | hosted::open(dialog, engine, cx); |
| 46 | } |
| 47 | |
| 48 | #[cfg(not(windows))] |
| 49 | pub fn open_url_dialog(dialog: UrlDialog, _engine: Option<Arc<Engine>>, cx: &mut App) { |
| 50 | cx.open_url(&dialog.fallback_url); |
| 51 | } |