Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
feat(mobile): fold the security screen into the set-up video screen (#2537)
Chad Piha10090ea9affa
diff --git a/openwhispr-mobile/src/hooks/__tests__/useAnonymousOnboardingSession.test.ts b/openwhispr-mobile/src/hooks/__tests__/useAnonymousOnboardingSession.test.tsindex b052a9875..38df0797a 100644--- a/openwhispr-mobile/src/hooks/__tests__/useAnonymousOnboardingSession.test.ts+++ b/openwhispr-mobile/src/hooks/__tests__/useAnonymousOnboardingSession.test.ts@@ -20,7 +20,7 @@ type MockOnboardingState = { hydrated: boolean; finished: boolean; currentStep:let mockOnboardingState: MockOnboardingState = {hydrated: true,finished: false,- currentStep: 'security-first',+ currentStep: 'welcome',};jest.mock('@/store/useOnboardingStore', () => ({useOnboardingStore: (selector: (state: MockOnboardingState) => unknown) =>@@ -47,7 +47,7 @@ beforeEach(() => {user: null,ensureAnonymousSession: mockEnsureAnonymousSession,};- mockOnboardingState = { hydrated: true, finished: false, currentStep: 'security-first' };+ mockOnboardingState = { hydrated: true, finished: false, currentStep: 'welcome' };mockHasRealAccountHistory = false;jest.spyOn(AppState, 'addEventListener').mockImplementation((_type, handler) => {appStateHandlers.push(handler as AppStateHandler);@@ -85,7 +85,7 @@ describe('useAnonymousOnboardingSession', () => {});it('does nothing for a device that already finished onboarding', () => {- mockOnboardingState = { hydrated: true, finished: true, currentStep: 'security-first' };+ mockOnboardingState = { hydrated: true, finished: true, currentStep: 'welcome' };renderHook(() => useAnonymousOnboardingSession());foreground();@@ -117,7 +117,7 @@ describe('useAnonymousOnboardingSession', () => {});it('waits for onboarding state to hydrate', () => {- mockOnboardingState = { hydrated: false, finished: false, currentStep: 'security-first' };+ mockOnboardingState = { hydrated: false, finished: false, currentStep: 'welcome' };renderHook(() => useAnonymousOnboardingSession());diff --git a/openwhispr-mobile/src/screens/onboarding/OnboardingFlow.tsx b/openwhispr-mobile/src/screens/onboarding/OnboardingFlow.tsxindex 6bffe19eb..0d6d579e2 100644--- a/openwhispr-mobile/src/screens/onboarding/OnboardingFlow.tsx+++ b/openwhispr-mobile/src/screens/onboarding/OnboardingFlow.tsx@@ -4,7 +4,6 @@ import { useOnboardingStore, type OnboardingStepId } from '@/store/useOnboardingimport { VoiceAgentStep } from './steps/VoiceAgentStep';import { ToneStep } from './steps/ToneStep';import { GetStartedStep } from './steps/GetStartedStep';-import { SecurityFirstStep } from './steps/SecurityFirstStep';import { WelcomeStep } from './steps/WelcomeStep';import { KeyboardIntroStep } from './steps/KeyboardIntroStep';import { KeyboardSwitchStep } from './steps/KeyboardSwitchStep';@@ -23,7 +22,6 @@ import { TrackingPermissionStep } from './steps/TrackingPermissionStep';// which is safer than falling back to a placeholder at runtime.const STEP_COMPONENTS: Record<OnboardingStepId, ComponentType> = {'get-started': GetStartedStep,- 'security-first': SecurityFirstStep,welcome: WelcomeStep,'keyboard-intro': KeyboardIntroStep,'keyboard-switch': KeyboardSwitchStep,diff --git a/openwhispr-mobile/src/screens/onboarding/steps/SecurityFirstStep.tsx b/openwhispr-mobile/src/screens/onboarding/steps/SecurityFirstStep.tsxdeleted file mode 100644index ef3d72637..000000000--- a/openwhispr-mobile/src/screens/onboarding/steps/SecurityFirstStep.tsx+++ /dev/null@@ -1,36 +0,0 @@-import { useOnboardingStep } from '@/hooks/useOnboardingStep';-import { View } from 'react-native';-import { OnboardingShell } from '@/components/onboarding/OnboardingShell';-import { SystemIcon } from '@/components/ui/SystemIcon';-import { Text } from '@/components/ui/Text';--const TRUST_POINTS = [- 'No selling your data',- 'No advertising profile',- 'You control where processing happens',-];--export function SecurityFirstStep() {- const { goNext } = useOnboardingStep('security-first');-- return (- <OnboardingShell- title="Security-first speech to text"- titleAccent="Security-first"- subtitle="OpenWhispr is designed to keep your dictation private and in your control."- ctaLabel="Continue"- onCta={goNext}- >- <View className="flex-1 justify-center gap-5">- <View className="gap-2 rounded-2xl border border-separator bg-secondarySystemGroupedBackground px-4 py-3.5">- {TRUST_POINTS.map((point) => (- <View key={point} className="flex-row items-center gap-2">- <SystemIcon name="checkmark" mdName="Check" size={14} color="systemGreen" />- <Text className="flex-1 text-[14px] leading-[19px] text-secondaryLabel">{point}</Text>- </View>- ))}- </View>- </View>- </OnboardingShell>- );-}diff --git a/openwhispr-mobile/src/screens/onboarding/steps/WelcomeStep.tsx b/openwhispr-mobile/src/screens/onboarding/steps/WelcomeStep.tsxindex 1d730f1e3..24b5e51ba 100644--- a/openwhispr-mobile/src/screens/onboarding/steps/WelcomeStep.tsx+++ b/openwhispr-mobile/src/screens/onboarding/steps/WelcomeStep.tsx@@ -3,10 +3,17 @@ import { useEffect } from 'react';import { StyleSheet, View, type StyleProp, type ViewStyle } from 'react-native';import { OnboardingShell } from '@/components/onboarding/OnboardingShell';import { AnimatedKeyboardPreview } from '@/components/onboarding/AnimatedKeyboardPreview';+import { SystemIcon } from '@/components/ui/SystemIcon';+import { Text } from '@/components/ui/Text';const WELCOME_VIDEO = require('../../../../assets/onboarding/videos/welcome-setup.mp4');const WELCOME_VIDEO_ASPECT_RATIO = 720 / 630;const WELCOME_VIDEO_START_DELAY_MS = 500;+const TRUST_POINTS = [+ 'No selling your data',+ 'No advertising profile',+ 'You control where processing happens',+];type ExpoVideoModule = {VideoView: React.ComponentType<{@@ -47,14 +54,22 @@ export function WelcomeStep() {return (<OnboardingShell- title="Let's set up OpenWhispr"- titleAccent="set up"+ title="Security-first speech to text"+ titleAccent="Security-first"subtitle="Dictate naturally anywhere on iPhone. Emails, messages, notes and AI chats."ctaLabel="Set up"onCta={goNext}>- <View className="flex-1 items-center justify-center">+ <View className="flex-1 justify-center gap-5"><WelcomeIntroVideo />+ <View className="gap-2">+ {TRUST_POINTS.map((point) => (+ <View key={point} className="flex-row items-center gap-2">+ <SystemIcon name="checkmark" mdName="Check" size={14} color="systemGreen" />+ <Text className="flex-1 text-[14px] leading-[19px] text-secondaryLabel">{point}</Text>+ </View>+ ))}+ </View></View></OnboardingShell>);diff --git a/openwhispr-mobile/src/screens/onboarding/steps/__tests__/WelcomeStep.test.tsx b/openwhispr-mobile/src/screens/onboarding/steps/__tests__/WelcomeStep.test.tsxnew file mode 100644index 000000000..04047532b--- /dev/null+++ b/openwhispr-mobile/src/screens/onboarding/steps/__tests__/WelcomeStep.test.tsx@@ -0,0 +1,42 @@+import { fireEvent, render, waitFor } from '@testing-library/react-native';+import { WelcomeStep } from '../WelcomeStep';++const mockGoNext = jest.fn();+jest.mock('@/lib/sentry', () => ({ Sentry: { captureException: jest.fn() } }));+jest.mock('@/hooks/useOnboardingStep', () => ({+ useOnboardingStep: () => ({ goNext: mockGoNext }),+}));+jest.mock('@/components/onboarding/AnimatedKeyboardPreview', () => ({+ AnimatedKeyboardPreview: () => null,+}));+jest.mock('expo-video', () => ({+ VideoView: () => null,+ useVideoPlayer: () => ({ play: jest.fn(), pause: jest.fn() }),+}));+jest.mock('react-native-safe-area-context', () => ({ SafeAreaView: require('react-native').View }));+jest.mock('@/components/ui/Text', () => ({ Text: require('react-native').Text }));+jest.mock('@/components/ui/SystemIcon', () => ({ SystemIcon: () => null }));++beforeEach(() => {+ jest.clearAllMocks();+ mockGoNext.mockResolvedValue(undefined);+});++it('leads with the security promise beside the set-up video', () => {+ const screen = render(<WelcomeStep />);+ expect(screen.getByRole('header')).toHaveTextContent('Security-first speech to text');+ for (const text of [+ 'Dictate naturally anywhere on iPhone. Emails, messages, notes and AI chats.',+ 'No selling your data',+ 'No advertising profile',+ 'You control where processing happens',+ ]) {+ expect(screen.getByText(text)).toBeTruthy();+ }+});++it('moves on when Set up is tapped', async () => {+ const screen = render(<WelcomeStep />);+ fireEvent.press(screen.getByText('Set up'));+ await waitFor(() => expect(mockGoNext).toHaveBeenCalledTimes(1));+});diff --git a/openwhispr-mobile/src/store/__tests__/useOnboardingStore.test.ts b/openwhispr-mobile/src/store/__tests__/useOnboardingStore.test.tsindex a12406d4d..031df96eb 100644--- a/openwhispr-mobile/src/store/__tests__/useOnboardingStore.test.ts+++ b/openwhispr-mobile/src/store/__tests__/useOnboardingStore.test.ts@@ -44,6 +44,8 @@ it('ignores a late callback from a step that has already advanced', async () =>it.each([['get-started', 'get-started'],['unknown-old-step', 'get-started'],+ // The security screen was merged into welcome.+ ['security-first', 'welcome'],['keyboard-switch', 'keyboard-switch'],] as const)('resumes %s at %s without replaying earlier content', async (step, expected) => {service.getProgress.mockResolvedValue({@@ -78,7 +80,7 @@ it('does not leave a step when persisting the transition fails', async () => {await expect(useOnboardingStore.getState().goNext('get-started')).rejects.toThrow();expect(useOnboardingStore.getState().currentStep).toBe('get-started');await useOnboardingStore.getState().goNext('get-started');- expect(useOnboardingStore.getState().currentStep).toBe('security-first');+ expect(useOnboardingStore.getState().currentStep).toBe('welcome');});it('shows the paywall immediately for Cloud, then resumes languages only once', async () => {diff --git a/openwhispr-mobile/src/store/useOnboardingStore.ts b/openwhispr-mobile/src/store/useOnboardingStore.tsindex 2a5d93f0a..dceb52f56 100644--- a/openwhispr-mobile/src/store/useOnboardingStore.ts+++ b/openwhispr-mobile/src/store/useOnboardingStore.ts@@ -11,7 +11,6 @@ import type { ProcessingMode } from '@/types';export type OnboardingStepId =| 'get-started'- | 'security-first'| 'welcome'| 'microphone'| 'keyboard-intro'@@ -30,7 +29,6 @@ export type OnboardingStepId =export const STEP_ORDER: readonly OnboardingStepId[] = ['get-started',- 'security-first','welcome','microphone','keyboard-intro',@@ -50,7 +48,6 @@ export const STEP_ORDER: readonly OnboardingStepId[] = [const UNCOUNTED_STEPS = new Set<OnboardingStepId>(['get-started',- 'security-first','welcome','paywall','create-account',@@ -204,8 +201,10 @@ export const useOnboardingStore = create<OnboardingStore>((set, get) => {return;}const progress = await OnboardingService.getProgress();- let step = STEP_ORDER.includes(progress.step as OnboardingStepId)- ? (progress.step as OnboardingStepId)+ // The security screen was folded into welcome; resume there rather than restarting setup.+ const savedStep = progress.step === 'security-first' ? 'welcome' : progress.step;+ let step = STEP_ORDER.includes(savedStep as OnboardingStepId)+ ? (savedStep as OnboardingStepId): FIRST_ONBOARDING_STEP;const legacy = (progress.version ?? 1) < 2;// Version 2 used this identifier for the combined agent/tone preview.