From 4a62a2aeab1766239e63d50a7c9bc013a94aa577 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Tue, 7 Jul 2026 13:39:50 +0300 Subject: [PATCH] feat: support mobile update checks --- .../ui/src/components/ui/UpdateDialog.tsx | 31 ++++++++++++++----- packages/ui/src/lib/desktop.ts | 2 ++ packages/ui/src/lib/i18n/messages/en.ts | 1 + packages/ui/src/lib/i18n/messages/es.ts | 1 + packages/ui/src/lib/i18n/messages/fr.ts | 1 + packages/ui/src/lib/i18n/messages/ja.ts | 1 + packages/ui/src/lib/i18n/messages/ko.ts | 1 + packages/ui/src/lib/i18n/messages/pl.ts | 1 + packages/ui/src/lib/i18n/messages/pt-BR.ts | 1 + packages/ui/src/lib/i18n/messages/uk.ts | 1 + packages/ui/src/lib/i18n/messages/zh-CN.ts | 1 + packages/ui/src/lib/i18n/messages/zh-TW.ts | 1 + packages/ui/src/stores/useUpdateStore.ts | 28 ++++++++++++++--- packages/web/server/lib/package-manager.js | 23 +++++++++++--- 14 files changed, 78 insertions(+), 16 deletions(-) diff --git a/packages/ui/src/components/ui/UpdateDialog.tsx b/packages/ui/src/components/ui/UpdateDialog.tsx index b50add83..bdf2a6d2 100644 --- a/packages/ui/src/components/ui/UpdateDialog.tsx +++ b/packages/ui/src/components/ui/UpdateDialog.tsx @@ -4,6 +4,7 @@ import { DialogContent, DialogTitle, } from '@/components/ui/dialog'; +import { Button } from '@/components/ui/button'; import { ScrollableOverlay } from '@/components/ui/ScrollableOverlay'; import { SimpleMarkdownRenderer } from '@/components/chat/MarkdownRenderer'; import { Icon } from "@/components/icon/Icon"; @@ -27,10 +28,10 @@ interface UpdateDialogProps { onDownload: () => void; onRestart: () => void; /** Runtime type to show different UI for desktop vs web */ - runtimeType?: 'desktop' | 'web' | 'vscode' | null; + runtimeType?: 'desktop' | 'web' | 'vscode' | 'mobile' | null; } -const GITHUB_RELEASES_URL = 'https://github.com/btriapitsyn/openchamber/releases'; +const GITHUB_RELEASES_URL = 'https://github.com/openchamber/openchamber/releases'; type ChangelogSection = { version: string; @@ -206,14 +207,16 @@ export const UpdateDialog: React.FC = ({ const [webError, setWebError] = useState(null); const releaseUrl = info?.version - ? `${GITHUB_RELEASES_URL}/tag/v${info.version}` + ? (info.releaseUrl || `${GITHUB_RELEASES_URL}/tag/v${info.version}`) : GITHUB_RELEASES_URL; + const mobileUpdateUrl = info?.downloadUrl || releaseUrl; const progressPercent = progress?.total ? Math.round((progress.downloaded / progress.total) * 100) : 0; const isWebRuntime = runtimeType === 'web'; + const isMobileRuntime = runtimeType === 'mobile'; const updateCommand = info?.updateCommand || 'openchamber update'; // Reset state when dialog closes @@ -264,6 +267,10 @@ export const UpdateDialog: React.FC = ({ } }, [info?.currentVersion, t]); + const handleMobileUpdate = useCallback(() => { + void handleOpenExternal(mobileUpdateUrl); + }, [handleOpenExternal, mobileUpdateUrl]); + const isWebUpdating = webUpdateState !== 'idle' && webUpdateState !== 'error'; const changelog = useMemo(() => { @@ -437,7 +444,7 @@ export const UpdateDialog: React.FC = ({ )} {/* Desktop progress bar */} - {!isWebRuntime && downloading && ( + {!isWebRuntime && !isMobileRuntime && downloading && (
{t('updateDialog.status.downloadingPayload')} @@ -474,7 +481,7 @@ export const UpdateDialog: React.FC = ({
{/* Desktop Buttons */} - {!isWebRuntime && !downloaded && !downloading && ( + {!isWebRuntime && !isMobileRuntime && !downloaded && !downloading && ( )} - {!isWebRuntime && downloading && ( + {!isWebRuntime && !isMobileRuntime && downloading && ( )} - {!isWebRuntime && downloaded && ( + {!isWebRuntime && !isMobileRuntime && downloaded && ( + )} + {isWebRuntime && !isWebUpdating && (