Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): preserve existing ask-card microphone appearance
xd37ab09b175cf
diff --git a/apps/mobile/src/__tests__/InteractionPanelReceipt.test.tsx b/apps/mobile/src/__tests__/InteractionPanelReceipt.test.tsxindex aef2bcfad4..db6397d75b 100644--- a/apps/mobile/src/__tests__/InteractionPanelReceipt.test.tsx+++ b/apps/mobile/src/__tests__/InteractionPanelReceipt.test.tsx@@ -14,7 +14,7 @@ import { QuestionReferenceText } from '@/session/QuestionReferenceText';import { _clearRemotePathVerdictCache } from '@/session/remotePathVerdict';import { i18n } from '@/i18n';import { AskCardAuthContext } from '@/session/askCardAuth';-import { darkColors, lightColors, radius } from '@/theme/tokens';+import { darkColors, lightColors } from '@/theme/tokens';const voiceStarter = vi.hoisted(() => ({ start: vi.fn() }));const theme = vi.hoisted(() => ({ mode: 'light' as 'light' | 'dark' }));@@ -133,13 +133,15 @@ async function type(id: string, value: string) {// #6778, unit: render the real card/hook and start/stop dictation. Earlier tests// only checked labels and clicks, missing the invisible inverse-colour mic.+// Preserve the existing unfilled control; only startup replaces the mic.// Minimal input: one question in each answer layout, in either theme.it.each(['light', 'dark'] as const)('keeps the recording mic visible in %s answer layouts', async (mode) => {theme.mode = mode;const colors = mode === 'dark' ? darkColors : lightColors;const stop = vi.fn(async () => undefined);+ let onListening!: () => void;voiceStarter.start.mockImplementation(async (input) => {- input.onListening();+ onListening = input.onListening;return { stop, cancel: vi.fn(async () => undefined) };});const button = () => host.querySelector<HTMLButtonElement>('[data-testid="interaction.ask.voice"]')!;@@ -154,16 +156,21 @@ it.each(['light', 'dark'] as const)('keeps the recording mic visible in %s answegetAccessToken: async () => null, refreshAccessToken: async () => null, apiFetch: async () => null,}}><Harness /></AskCardAuthContext.Provider>));if (layout === 'custom-open') await click('interaction.ask.showCustomButton');+ const idleStyle = style();expect(micColor()).toBe(colors.textSecondary);- expect(style().backgroundColor).not.toBe(colors.cta);+ expect(idleStyle.backgroundColor).toBeUndefined();await click('interaction.ask.voice');+ expect(button().getAttribute('aria-busy')).toBe('true');+ expect(button().querySelector('[data-mic-color]')).toBeNull();+ expect(style()).toEqual(idleStyle);+ await act(async () => onListening());expect(button().getAttribute('aria-label')).toBe('session.common.voiceStopRecording');- expect(style().backgroundColor).toBe(colors.cta);- expect(style().borderRadius).toBe(radius.pill);- expect(micColor()).toBe(colors.ctaText);+ expect(button().getAttribute('aria-busy')).toBe('false');+ expect(style()).toEqual(idleStyle);+ expect(micColor()).toBe(colors.textSecondary);await click('interaction.ask.voice');expect(button().getAttribute('aria-label')).toBe('session.screen.voiceStartInput');- expect(style().backgroundColor).not.toBe(colors.cta);+ expect(style()).toEqual(idleStyle);expect(micColor()).toBe(colors.textSecondary);}expect(stop).toHaveBeenCalledTimes(3);diff --git a/apps/mobile/src/session/InteractionPanel.tsx b/apps/mobile/src/session/InteractionPanel.tsxindex 315f40b95d..7b64d864a2 100644--- a/apps/mobile/src/session/InteractionPanel.tsx+++ b/apps/mobile/src/session/InteractionPanel.tsx@@ -1002,7 +1002,6 @@ type AskUserQuestionCardProps = {function AskCardVoiceButton({ listening, starting, disabled, onPress }: { listening: boolean; starting: boolean; disabled?: boolean; onPress: () => void }) {const { t } = useTranslation();const { colors } = useTheme();- const styles = useInteractionStyles();return (<PressableaccessibilityLabel={listening || starting ? t('session.common.voiceStopRecording') : t('session.screen.voiceStartInput')}@@ -1011,10 +1010,10 @@ function AskCardVoiceButton({ listening, starting, disabled, onPress }: { listendisabled={disabled}hitSlop={8}onPress={onPress}- style={[styles.iconControl, listening && { backgroundColor: colors.cta }]}+ style={{ alignItems: 'center', height: 44, justifyContent: 'center', width: 44 }}testID="interaction.ask.voice">- {starting ? <ActivityIndicator color={colors.textSecondary} size="small" /> : <Mic color={listening ? colors.ctaText : colors.textSecondary} size={iconSize.md} />}+ {starting ? <ActivityIndicator color={colors.textSecondary} size="small" /> : <Mic color={colors.textSecondary} size={iconSize.md} />}</Pressable>);}