Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/mobile/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default ({ config }: ConfigContext): ExpoConfig => {
"expo-audio",
{
microphonePermission:
"Allow Multica to record short voice messages for Agent chat transcription.",
"Allow Multica to use the microphone for voice calls with agents.",
},
],
"expo-secure-store",
Expand Down
30 changes: 19 additions & 11 deletions apps/mobile/app/(app)/[workspace]/(tabs)/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import { ChatTitleButton } from "@/components/chat/chat-title-button";
import { ChatSessionActions } from "@/components/chat/chat-session-actions";
import { ChatMessageList } from "@/components/chat/chat-message-list";
import { ChatComposer } from "@/components/chat/chat-composer";
import { VoiceCallPanel } from "@/components/chat/voice-call-panel";
import { AgentPickerSheet } from "@/components/chat/agent-picker-sheet";
import { NoAgentBanner } from "@/components/chat/no-agent-banner";
import { OfflineBanner } from "@/components/chat/offline-banner";
Expand All @@ -90,6 +91,7 @@ export default function ChatTab() {
const [activeSessionId, setActiveSessionId] = useState<string | null>(null);
const [selectedAgentId, setSelectedAgentId] = useState<string | null>(null);
const [agentPickerOpen, setAgentPickerOpen] = useState(false);
const [voiceCallOpen, setVoiceCallOpen] = useState(false);

// Bridge to the chat-sessions formSheet route. Mirror local
// activeSessionId into the store so the picker can render the current
Expand Down Expand Up @@ -177,16 +179,6 @@ export default function ChatTab() {
presenceDetail === "loading" ? undefined : presenceDetail.availability;
const isArchived = activeSession?.status === "archived";
const sending = !!pendingTask?.task_id;
const latestAssistantMessage = useMemo(() => {
for (let i = messages.length - 1; i >= 0; i -= 1) {
const message = messages[i];
if (message?.role === "assistant" && message.content.trim()) {
return message;
}
}
return null;
}, [messages]);

// ── Drafts ─────────────────────────────────────────────────────────────
const draftKey = activeSessionId ?? DRAFT_NEW_SESSION;
const draft = useChatDraftsStore((s) => s.drafts[draftKey] ?? "");
Expand Down Expand Up @@ -317,6 +309,7 @@ export default function ChatTab() {

// ── Header / sheet actions ─────────────────────────────────────────────
const handleNewChat = useCallback(() => {
setVoiceCallOpen(false);
if (availableAgents.length > 1) {
setAgentPickerOpen(true);
return;
Expand All @@ -326,6 +319,7 @@ export default function ChatTab() {
}, [availableAgents.length]);

const handlePickAgent = useCallback((agent: Agent) => {
setVoiceCallOpen(false);
setSelectedAgentId(agent.id);
setActiveSessionId(null);
}, []);
Expand All @@ -334,6 +328,7 @@ export default function ChatTab() {
// when they delete the active one in the sheet).
useEffect(() => {
if (!selectRequest) return;
setVoiceCallOpen(false);
setSelectedAgentId(null);
setActiveSessionId(selectRequest.id);
consumeSelect();
Expand All @@ -351,6 +346,7 @@ export default function ChatTab() {
style: "destructive",
onPress: () => {
const id = activeSession.id;
setVoiceCallOpen(false);
setActiveSessionId(null);
deleteSession.mutate(id);
},
Expand Down Expand Up @@ -414,12 +410,24 @@ export default function ChatTab() {
agentName={currentAgent?.name}
availability={presenceAvailability}
/>
{voiceCallOpen && currentAgent ? (
<VoiceCallPanel
agent={currentAgent}
pendingTask={pendingTask}
disabled={disabled}
disabledReason={disabledReason}
ensureSession={ensureSession}
onSend={handleSend}
onStop={handleStop}
onClose={() => setVoiceCallOpen(false)}
/>
) : null}
<ChatComposer
value={draft}
onChangeText={(next) => setDraft(draftKey, next)}
onSend={handleSend}
onStop={handleStop}
latestAssistantMessage={latestAssistantMessage}
onVoiceCall={() => setVoiceCallOpen(true)}
sending={sending}
disabled={disabled}
disabledReason={disabledReason}
Expand Down
Loading
Loading