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:
@@ -64,10 +64,15 @@ describe('gestures through the SDK parser', () => {
|
||||
expect(parse({ type: 'menuItemClickEvent', jsonData: { itemID: 2 } })).toEqual([{ type: 'menu', itemId: 2 }]);
|
||||
});
|
||||
|
||||
it('IMU reports and long presses are outside the interaction contract', () => {
|
||||
it('IMU reports are outside the interaction contract', () => {
|
||||
expect(parse({ type: 'sysEvent', jsonData: { eventType: 8, imuData: { x: 1, y: 2, z: 3 } } })).toEqual([]);
|
||||
expect(parse({ type: 'sysEvent', jsonData: { eventType: 9 } })).toEqual([]);
|
||||
expect(parse({ type: 'sysEvent', jsonData: { eventType: 10 } })).toEqual([]);
|
||||
});
|
||||
|
||||
it('long press and its release are recognised (a real G2 reported a slow tap as type 9)', () => {
|
||||
expect(parse({ type: 'sysEvent', jsonData: { eventType: 9, eventSource: 1 } })).toEqual([{ type: 'long_press' }]);
|
||||
expect(parse({ type: 'sysEvent', jsonData: { eventType: 10, eventSource: 1 } })).toEqual([{ type: 'long_press_release' }]);
|
||||
expect(parse({ type: 'textEvent', jsonData: { eventType: 9 } })).toEqual([{ type: 'long_press' }]);
|
||||
expect(parse({ type: 'sysEvent', jsonData: { eventType: 'LONG_PRESS_EVENT' } })).toEqual([{ type: 'long_press' }]);
|
||||
});
|
||||
|
||||
it('an empty or unknown event produces nothing', () => {
|
||||
|
||||
Reference in New Issue
Block a user