Add protocol brand contract
This commit is contained in:
@@ -2,10 +2,16 @@ pub(crate) const PRODUCT_NAME: &str = "ELY Browser";
|
||||
pub(crate) const FORMAL_PRODUCT_NAME: &str = "ELY Browser by Elydora";
|
||||
pub(crate) const COMPANY_NAME: &str = "Elydora";
|
||||
pub(crate) const SYNC_SERVICE_NAME: &str = "Elydora Cloud";
|
||||
pub(crate) const DEEP_LINK_SCHEME: &str = "ely";
|
||||
pub(crate) const DEEP_LINK_PREFIX: &str = "ely://";
|
||||
pub(crate) const AUTH_CALLBACK_URL: &str = "ely://auth/callback";
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{COMPANY_NAME, FORMAL_PRODUCT_NAME, PRODUCT_NAME, SYNC_SERVICE_NAME};
|
||||
use super::{
|
||||
AUTH_CALLBACK_URL, COMPANY_NAME, DEEP_LINK_PREFIX, DEEP_LINK_SCHEME, FORMAL_PRODUCT_NAME,
|
||||
PRODUCT_NAME, SYNC_SERVICE_NAME,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn brand_identity_matches_prd_names() {
|
||||
@@ -13,5 +19,8 @@ mod tests {
|
||||
assert_eq!(FORMAL_PRODUCT_NAME, "ELY Browser by Elydora");
|
||||
assert_eq!(COMPANY_NAME, "Elydora");
|
||||
assert_eq!(SYNC_SERVICE_NAME, "Elydora Cloud");
|
||||
assert_eq!(DEEP_LINK_SCHEME, "ely");
|
||||
assert_eq!(DEEP_LINK_PREFIX, "ely://");
|
||||
assert_eq!(AUTH_CALLBACK_URL, "ely://auth/callback");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,10 @@ use ely_design_system::colors;
|
||||
use gpui::{AnyElement, IntoElement, ParentElement, Styled, div, px, rgb};
|
||||
use gpui_component::{IconName, StyledExt, scroll::ScrollableElement};
|
||||
|
||||
use crate::brand::{COMPANY_NAME, FORMAL_PRODUCT_NAME, PRODUCT_NAME, SYNC_SERVICE_NAME};
|
||||
use crate::brand::{
|
||||
AUTH_CALLBACK_URL, COMPANY_NAME, DEEP_LINK_PREFIX, DEEP_LINK_SCHEME, FORMAL_PRODUCT_NAME,
|
||||
PRODUCT_NAME, SYNC_SERVICE_NAME,
|
||||
};
|
||||
|
||||
use super::{ElyShell, render_canvas_surface};
|
||||
|
||||
@@ -79,6 +82,12 @@ fn render_about_rows(snapshot: &BrowserSnapshot) -> AnyElement {
|
||||
))
|
||||
.child(about_row(IconName::Building2, "Publisher", COMPANY_NAME, "Brand owner"))
|
||||
.child(about_row(IconName::Globe, "Service", SYNC_SERVICE_NAME, "Sync and release service"))
|
||||
.child(about_row(
|
||||
IconName::ExternalLink,
|
||||
"Protocol",
|
||||
DEEP_LINK_PREFIX,
|
||||
format!("scheme: {DEEP_LINK_SCHEME}; auth: {AUTH_CALLBACK_URL}"),
|
||||
))
|
||||
.child(about_row(IconName::Info, "Version", APP_VERSION, "Cargo package version"))
|
||||
.child(about_row(IconName::GitHub, "Build", BUILD_REVISION, "Git revision"))
|
||||
.child(about_row(
|
||||
|
||||
Reference in New Issue
Block a user