Fix interims on Mobile

This commit is contained in:
Enrico Ros
2023-06-23 08:16:01 -07:00
parent 2f61a4bb61
commit 2ebd629e4f
2 changed files with 11 additions and 2 deletions
@@ -1,5 +1,6 @@
import * as React from 'react';
import { isChromeOnDesktopWindows } from '~/common/util/pwaUtils';
import { useUIPreferencesStore } from '~/common/state/store-ui';
@@ -64,7 +65,7 @@ export const useSpeechRecognition = (onResultCallback: (result: SpeechResult) =>
const instance = new Speech();
instance.lang = preferredLanguage;
instance.interimResults = true;
instance.interimResults = isChromeOnDesktopWindows();
instance.maxAlternatives = 1;
instance.continuous = true;
+9 -1
View File
@@ -16,4 +16,12 @@ export const isPwa = (): boolean => {
if (typeof window !== 'undefined')
return window.matchMedia(`(min-width: ${width}px)`).matches;
return true;
};*/
};*/
export const isChromeOnDesktopWindows = (): boolean => {
if (typeof window !== 'undefined') {
const agent = window.navigator.userAgent;
return agent.indexOf('Windows') > -1 && agent.indexOf('Chrome') > -1 && agent.indexOf('Mobile') === -1;
}
return false;
}