Add protocol brand contract

This commit is contained in:
2026-05-09 02:46:07 -04:00
parent 58a582682f
commit 6fc649d889
3 changed files with 25 additions and 7 deletions
+5 -5
View File
@@ -19,7 +19,7 @@ use gpui_component_assets::Assets;
use shell::ElyShell;
use shortcuts::bind_shortcuts;
use crate::brand::PRODUCT_NAME;
use crate::brand::{DEEP_LINK_PREFIX, PRODUCT_NAME};
actions!(
ely_app,
@@ -275,12 +275,12 @@ fn open_deep_link(target: &BrowserWindowTarget, url: UrlText, cx: &mut App) -> b
fn parse_ely_deep_link(value: &str) -> Option<UrlText> {
let trimmed = value.trim();
let scheme = trimmed.get(..6)?;
let route = trimmed.get(6..)?;
let scheme = trimmed.get(..DEEP_LINK_PREFIX.len())?;
let route = trimmed.get(DEEP_LINK_PREFIX.len()..)?;
scheme
.eq_ignore_ascii_case("ely://")
.then(|| UrlText::parse(format!("ely://{route}")).ok())
.eq_ignore_ascii_case(DEEP_LINK_PREFIX)
.then(|| UrlText::parse(format!("{DEEP_LINK_PREFIX}{route}")).ok())
.flatten()
}