fix(mobile): keep dictation active across navigation #14923
ClosedBil0000(GitHub profile, opens in a new tab)wants to merge 8 commits into
main fromrefs/pull/14923/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
- packages/client-runtime/src/voice-input/controller.ts lines 216 to 235OutdatedResolvedby Bil0000(GitHub profile, opens in a new tab)@@ -211,6 +215,21 @@211215 const operationToken = ++this.operationToken;212216 const abortController = new AbortController();213217 this.transcriptionAbortController = abortController;214218 this.setState({ phase: "preparing", error: null, errorAction: null });215219216220 try {221+ for (222+ let previousSession = activeSession;223+ previousSession?.abandoned;224+ previousSession = activeSession225+ ) {226+ await previousSession.released;227+ if (!this.isCurrent(operationToken)) return;228+ }229+ sessionToken = acquireSession();230+ if (!sessionToken) {231+ this.setError("Another voice recording is already active.", "retry");232+ return;233+ }234+ this.sessionToken = sessionToken;235+
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
Bil0000(GitHub profile, opens in a new tab) changed the title
- apps/mobile/src/features/threads/NewTaskDraftScreen.tsx line 477Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -473,5 +473,4 @@473473 });474474 const voiceInput = useVoiceInputController({475475 ownerKey: flow.draftKey,476- draftMessage: flow.prompt,477- selection: composerMenu.selection,476+ readDraftMessage: () => (flow.draftKey ? getComposerDraftSnapshot(flow.draftKey).text : null),
- apps/mobile/src/features/threads/ThreadComposer.tsx line 511Resolvedby Bil0000(GitHub profile, opens in a new tab)@@ -503,5 +505,4 @@503505 usageLimitsOffered && props.draftAttachments.length === 0 ? openUsageLimits : undefined,504506 });505507 const voiceInput = useVoiceInputController({506- ownerKey: composerOwnerKey,507- draftMessage: props.draftMessage,508+ ownerKey: composerDraftKey,
- apps/mobile/src/features/voice-input/voiceInputSession.ts line 25OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +5,21 @@5+ type VoiceInputControllerDependencies,6+} from "@t3tools/client-runtime/voice-input";7+8+export type VoiceInputTarget = {9+ readonly ownerKey: string;10+ readonly readDraft: () => VoiceDraftSnapshot | null;11+ readonly commitDraft: VoiceInputControllerDependencies["commitDraft"];12+};13+14+export function createVoiceInputTarget(15+ ownerKey: string,16+ readText: () => string | null,17+ commitDraft: VoiceInputTarget["commitDraft"],18+ selection: VoiceDraftSnapshot["selection"],19+): VoiceInputTarget {20+ return {21+ ownerKey,22+ readDraft: () => {23+ const text = readText();24+ if (text === null) return null;25+ return { ownerKey, text, selection, revision: 0 };
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed