aKode fase 1 (parziale): niente Statsig, analytics, upload Sentry, update check e announcement remoti
This commit is contained in:
@@ -100,13 +100,8 @@ fn linux_app_tooltip(session: LinuxDesktopSession) -> Option<&'static str> {
|
||||
}
|
||||
|
||||
fn app_tooltip() -> Option<&'static str> {
|
||||
if IS_MACOS {
|
||||
Some(MACOS_APP_TOOLTIP)
|
||||
} else if IS_WINDOWS {
|
||||
Some(WINDOWS_APP_TOOLTIP)
|
||||
} else {
|
||||
linux_app_tooltip(LinuxDesktopSession::current())
|
||||
}
|
||||
// aKode: no desktop-app promotion.
|
||||
None
|
||||
}
|
||||
|
||||
fn pick_tooltip<R: Rng + ?Sized>(rng: &mut R, keymap: &TuiKeymap) -> Option<String> {
|
||||
@@ -179,15 +174,9 @@ pub(crate) mod announcement {
|
||||
|
||||
/// Prewarm the cache of the announcement tip.
|
||||
pub(crate) fn prewarm(http_client_factory: HttpClientFactory) {
|
||||
if ANNOUNCEMENT_TIP.get().is_some() {
|
||||
return;
|
||||
}
|
||||
tokio::spawn(async move {
|
||||
let announcement_tip = fetch_announcement_tip_text(http_client_factory)
|
||||
.await
|
||||
.and_then(|raw| AnnouncementTips::parse(&raw));
|
||||
let _ = ANNOUNCEMENT_TIP.set(announcement_tip);
|
||||
});
|
||||
// aKode: announcement tips are never fetched from the network.
|
||||
let _ = http_client_factory;
|
||||
let _ = ANNOUNCEMENT_TIP.set(None);
|
||||
}
|
||||
|
||||
/// Fetch the announcement tip, return None if the prewarm is not done yet.
|
||||
|
||||
@@ -25,36 +25,9 @@ use crate::version::CODEX_CLI_VERSION;
|
||||
pub(crate) use crate::updates_cache::dismiss_version;
|
||||
|
||||
pub fn get_upgrade_version(config: &Config) -> Option<String> {
|
||||
if !config.check_for_update_on_startup || is_source_build_version(CODEX_CLI_VERSION) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let action = update_action::get_update_action();
|
||||
let version_file = version_filepath(config);
|
||||
let info = read_version_info(&version_file).ok();
|
||||
|
||||
if match &info {
|
||||
None => true,
|
||||
Some(info) => info.last_checked_at < Utc::now() - Duration::hours(20),
|
||||
} {
|
||||
let http_client_factory = config.http_client_factory();
|
||||
// Refresh the cached latest version in the background so TUI startup
|
||||
// isn’t blocked by a network call. The UI reads the previously cached
|
||||
// value (if any) for this run; the next run shows the banner if needed.
|
||||
tokio::spawn(async move {
|
||||
check_for_update(&version_file, action, http_client_factory)
|
||||
.await
|
||||
.inspect_err(|e| tracing::error!("Failed to update version: {e}"))
|
||||
});
|
||||
}
|
||||
|
||||
info.and_then(|info| {
|
||||
if is_newer(&info.latest_version, CODEX_CLI_VERSION).unwrap_or(false) {
|
||||
Some(info.latest_version)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
// aKode: no remote update checks (upstream queried GitHub, npm and Homebrew).
|
||||
let _ = config;
|
||||
None
|
||||
}
|
||||
|
||||
// We use the latest version from the cask if installation is via homebrew - homebrew does not immediately pick up the latest release and can lag behind.
|
||||
@@ -150,17 +123,7 @@ async fn fetch_latest_github_release_version(
|
||||
/// Returns the latest version to show in a popup, if it should be shown.
|
||||
/// This respects the user's dismissal choice for the current latest version.
|
||||
pub fn get_upgrade_version_for_popup(config: &Config) -> Option<String> {
|
||||
if !config.check_for_update_on_startup || is_source_build_version(CODEX_CLI_VERSION) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let version_file = version_filepath(config);
|
||||
let latest = get_upgrade_version(config)?;
|
||||
// If the user dismissed this exact version previously, do not show the popup.
|
||||
if let Ok(info) = read_version_info(&version_file)
|
||||
&& info.dismissed_version.as_deref() == Some(latest.as_str())
|
||||
{
|
||||
return None;
|
||||
}
|
||||
Some(latest)
|
||||
// aKode: no remote update checks.
|
||||
let _ = config;
|
||||
None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user