fix(web): let the list dictation run in the iOS home-screen app
The floating button's commit made the multi-item dictation go through canDictate(), which treats an iOS home-screen app as unsupported. That rule belongs to the input's microphone, which dictates without asking for the microphone first; the multi-item flow asks with getUserMedia and works there, so both the empty list's card and the FAB said the browser could not dictate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
|
||||
import { splitDictation } from '@/lib/natural-input/dictation'
|
||||
import {
|
||||
canDictate,
|
||||
getSpeechRecognition,
|
||||
type SpeechRecognitionLike,
|
||||
} from '@/lib/speech-recognition'
|
||||
import { getSpeechRecognition, type SpeechRecognitionLike } from '@/lib/speech-recognition'
|
||||
|
||||
export const DICTATION_MESSAGES = {
|
||||
denied: 'No tenemos permiso para usar el micrófono. Habilítalo en los ajustes del navegador.',
|
||||
@@ -55,7 +51,7 @@ type UseMicrophoneDictationOptions = {
|
||||
* capture. Unmounting aborts the recognition.
|
||||
*/
|
||||
export function useMicrophoneDictation({ onPhrases, onError }: UseMicrophoneDictationOptions) {
|
||||
const [supported] = useState(() => canDictate())
|
||||
const [supported] = useState(() => getSpeechRecognition() !== null)
|
||||
const [status, setStatus] = useState<DictationStatus>('idle')
|
||||
// What has been heard so far, shown while listening.
|
||||
const [heard, setHeard] = useState('')
|
||||
@@ -72,7 +68,7 @@ export function useMicrophoneDictation({ onPhrases, onError }: UseMicrophoneDict
|
||||
const start = useCallback(() => {
|
||||
if (endRef.current) return
|
||||
|
||||
const SpeechRecognition = canDictate() ? getSpeechRecognition() : null
|
||||
const SpeechRecognition = getSpeechRecognition()
|
||||
if (!SpeechRecognition) {
|
||||
callbacksRef.current.onError(DICTATION_MESSAGES.unsupported)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user