From 94e07e4eddf5eece39110e9df4e171146f68cd3c Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Fri, 14 Aug 2026 00:49:42 +0300 Subject: [PATCH] fix(mobile): share exported message images --- packages/ui/src/components/chat/message/MessageBody.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/ui/src/components/chat/message/MessageBody.tsx b/packages/ui/src/components/chat/message/MessageBody.tsx index a697c165..7199edfc 100644 --- a/packages/ui/src/components/chat/message/MessageBody.tsx +++ b/packages/ui/src/components/chat/message/MessageBody.tsx @@ -56,6 +56,7 @@ import { import { isEmbeddedSessionChat } from '@/components/layout/contextPanelEmbeddedChat'; import { useProviderLogo } from '@/hooks/useProviderLogo'; import { getAgentColor } from '@/lib/agentColors'; +import { isCapacitorMobileApp } from '@/apps/mobileNativeChrome'; const CONTAIN_LAYOUT_STYLE = { contain: 'layout' as const, transform: 'translateZ(0)' }; @@ -1617,6 +1618,13 @@ const AssistantMessageBody = React.memo(({ } throw new Error(payload.error || 'Failed to save image in VS Code'); } + } else if (isCapacitorMobileApp()) { + const blob = await fetch(dataUrl).then((response) => response.blob()); + const file = new File([blob], fileName, { type: blob.type || 'image/png' }); + if (!navigator.canShare?.({ files: [file] })) { + throw new Error('Image sharing is unavailable in this mobile runtime'); + } + await navigator.share({ files: [file] }); } else { const link = document.createElement('a'); link.download = fileName;