Handle long presses: push-to-talk, with a tap-like fallback
On a real G2 a touch held slightly too long is reported as a long press (sysEvent type 9, then type 10 on release; source 1 right temple, 3 left), not as a tap, and was ignored. A long press now does what a tap does. If it started a recording and is held at least 700 ms, releasing it sends (push-to-talk); released sooner, it behaves like a tap and the recording continues until the next tap or press. Tests: 219 unit/integration; simulator 7 scenarios (long_press / long_press_release through the automation API). Not reviewed, not deployed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,10 @@ export const MENU_ITEM = { NEW_CONVERSATION: 1, CANCEL: 2 } as const;
|
||||
export type DeviceEvent =
|
||||
| { type: 'tap' }
|
||||
| { type: 'double_tap' }
|
||||
/** The touch has been held long enough for the glasses to call it a long press. */
|
||||
| { type: 'long_press' }
|
||||
/** The finger was lifted after a long press. */
|
||||
| { type: 'long_press_release' }
|
||||
| { type: 'swipe_up' }
|
||||
| { type: 'swipe_down' }
|
||||
| { type: 'menu'; itemId: number }
|
||||
@@ -89,11 +93,17 @@ export function normalizeEvent(event: RawEvenHubEvent): DeviceEvent[] {
|
||||
case OS_EVENT.SYSTEM_EXIT:
|
||||
out.push({ type: 'system_exit' });
|
||||
break;
|
||||
case OS_EVENT.LONG_PRESS:
|
||||
out.push({ type: 'long_press' });
|
||||
break;
|
||||
case OS_EVENT.LONG_PRESS_RELEASE:
|
||||
out.push({ type: 'long_press_release' });
|
||||
break;
|
||||
case OS_EVENT.CLICK:
|
||||
out.push({ type: 'tap' });
|
||||
break;
|
||||
default:
|
||||
// IMU reports and long press are not part of the interaction contract.
|
||||
// IMU reports are not part of the interaction contract.
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
|
||||
Reference in New Issue
Block a user