mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
fix(mobile): type away words without claiming the terminal, and keep the pill above screens
This commit is contained in:
@@ -27,6 +27,8 @@ import { composerInputStyles } from '../components/composer-input/composer-input
|
||||
import { useMobileDictationHost, type MobileDictationHostToast } from './mobile-dictation-host'
|
||||
|
||||
const TOAST_MS = 4000
|
||||
// Long enough to read the target's name and reach Open.
|
||||
const TOAST_WITH_OPEN_MS = 6000
|
||||
|
||||
// The meter needs a live recording; finishing and failures show words instead.
|
||||
function PillStatus({ dictation }: { dictation: UseMobileDictationResult }) {
|
||||
@@ -148,7 +150,7 @@ function MobileDictationToast({
|
||||
if (!toast) {
|
||||
return
|
||||
}
|
||||
const timer = setTimeout(onDone, TOAST_MS)
|
||||
const timer = setTimeout(onDone, toast.open ? TOAST_WITH_OPEN_MS : TOAST_MS)
|
||||
return () => clearTimeout(timer)
|
||||
}, [onDone, toast])
|
||||
// The live region stays mounted so a screen reader hears the message appear.
|
||||
@@ -212,10 +214,13 @@ export function MobileDictationPillLayer(): React.JSX.Element {
|
||||
const PILL_HEIGHT = 56
|
||||
|
||||
const styles = themedStyleSheet(() => ({
|
||||
// Above every screen's own floating controls, below drawers and the host's pending cover (1000).
|
||||
layer: {
|
||||
position: 'absolute',
|
||||
left: spacing.lg,
|
||||
right: spacing.lg
|
||||
right: spacing.lg,
|
||||
zIndex: 900,
|
||||
elevation: 9
|
||||
},
|
||||
pill: {
|
||||
height: PILL_HEIGHT,
|
||||
@@ -272,7 +277,9 @@ const styles = themedStyleSheet(() => ({
|
||||
position: 'absolute',
|
||||
left: spacing.lg,
|
||||
right: spacing.lg,
|
||||
alignItems: 'center'
|
||||
alignItems: 'center',
|
||||
zIndex: 900,
|
||||
elevation: 9
|
||||
},
|
||||
toast: {
|
||||
flexDirection: 'row',
|
||||
|
||||
@@ -17,7 +17,6 @@ export type MobileDictationAwayTarget =
|
||||
export async function insertMobileDictationAway(
|
||||
owner: {
|
||||
readonly client: RpcClient | null
|
||||
readonly deviceToken: string | null
|
||||
readonly target: MobileDictationAwayTarget
|
||||
},
|
||||
text: string
|
||||
@@ -40,7 +39,8 @@ export async function insertMobileDictationAway(
|
||||
terminal: target.handle,
|
||||
text,
|
||||
enter: false,
|
||||
deviceToken: owner.deviceToken
|
||||
// No phone identity: a phone may only claim a terminal it is watching, and this one is off screen; the words go in as plain typed input.
|
||||
deviceToken: null
|
||||
}),
|
||||
TERMINAL_INPUT_SEND_OPTIONS
|
||||
)
|
||||
|
||||
@@ -31,7 +31,6 @@ export type MobileDictationOwner = {
|
||||
readonly instance: object
|
||||
readonly sessionKey: string
|
||||
readonly client: RpcClient | null
|
||||
readonly deviceToken: string | null
|
||||
readonly target: MobileDictationAwayTarget
|
||||
// The target tab's title, for the pill and its toasts.
|
||||
readonly title: string
|
||||
|
||||
@@ -63,7 +63,6 @@ export function useMobileSessionDictation(
|
||||
activeHandleRef,
|
||||
activeSessionTab,
|
||||
setShowDictationSetup,
|
||||
deviceTokenRef,
|
||||
dictationRouteContextRef,
|
||||
flushPendingLiveInputBeforeExternalSend,
|
||||
canSend,
|
||||
@@ -215,7 +214,6 @@ export function useMobileSessionDictation(
|
||||
instance,
|
||||
sessionKey,
|
||||
client,
|
||||
deviceToken: deviceTokenRef.current,
|
||||
target:
|
||||
target?.field === 'chat'
|
||||
? target.scope === null
|
||||
@@ -242,7 +240,6 @@ export function useMobileSessionDictation(
|
||||
busyElsewhere,
|
||||
client,
|
||||
destination.captureDestination,
|
||||
deviceTokenRef,
|
||||
dictationCanStart,
|
||||
dictationRouteContextRef,
|
||||
executionHost,
|
||||
|
||||
Reference in New Issue
Block a user