@applicaster/zapp-react-dom-app 13.0.0-alpha.4585770583 → 13.0.0-alpha.4750811552
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App/InteractionManager/index.tsx +59 -40
- package/package.json +6 -6
|
@@ -23,8 +23,6 @@ import {
|
|
|
23
23
|
|
|
24
24
|
import { showConfirmationDialog } from "@applicaster/zapp-react-native-utils/alertUtils";
|
|
25
25
|
|
|
26
|
-
import { withUseSeek } from "@applicaster/zapp-react-native-utils/reactHooks/player";
|
|
27
|
-
|
|
28
26
|
import {
|
|
29
27
|
DISPLAY_STATES,
|
|
30
28
|
DisplayStateContext,
|
|
@@ -48,6 +46,7 @@ import {
|
|
|
48
46
|
|
|
49
47
|
import { OnScreenKeyboard } from "@applicaster/zapp-react-dom-ui-components/Components/OnScreenKeyboard";
|
|
50
48
|
import { KeyboardLongPressManager } from "@applicaster/zapp-react-dom-ui-components/Utils/KeyboardLongPressManager";
|
|
49
|
+
import { KeyInputHandler } from "@applicaster/zapp-react-native-utils/appUtils/keyInputHandler/KeyInputHandler";
|
|
51
50
|
|
|
52
51
|
const { withXray } = getXray();
|
|
53
52
|
const globalAny: any = global;
|
|
@@ -62,14 +61,6 @@ type Props = {
|
|
|
62
61
|
navigator: QuickBrickAppNavigator;
|
|
63
62
|
rivers: {};
|
|
64
63
|
xray: XRayContext;
|
|
65
|
-
seekMethods: {
|
|
66
|
-
onRewindPress: () => void;
|
|
67
|
-
onRewindLongPress: () => void;
|
|
68
|
-
onForwardPress: () => void;
|
|
69
|
-
onForwardLongPress: () => void;
|
|
70
|
-
onRewindPressOut: () => void;
|
|
71
|
-
onForwardPressOut: () => void;
|
|
72
|
-
};
|
|
73
64
|
confirmDialog: typeof confirmationDialogStore;
|
|
74
65
|
};
|
|
75
66
|
|
|
@@ -181,6 +172,11 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
181
172
|
|
|
182
173
|
window.addEventListener("onLongPress", this.handleLongPress.bind(this));
|
|
183
174
|
|
|
175
|
+
window.addEventListener(
|
|
176
|
+
"onPressRelease",
|
|
177
|
+
this.handleLongPressRelease.bind(this)
|
|
178
|
+
);
|
|
179
|
+
|
|
184
180
|
window.addEventListener(
|
|
185
181
|
"onLongPressRelease",
|
|
186
182
|
this.handleLongPressRelease.bind(this)
|
|
@@ -339,9 +335,34 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
339
335
|
}
|
|
340
336
|
|
|
341
337
|
onKeyUp(event: KeyboardEvent) {
|
|
338
|
+
const { setDisplayState } = this.props;
|
|
339
|
+
|
|
342
340
|
if (this.keySupportsLongPress(event)) {
|
|
343
341
|
this.longPressDetector.endKeyPressMonitoring(event.code);
|
|
344
342
|
}
|
|
343
|
+
|
|
344
|
+
if (
|
|
345
|
+
keyCode(event).matches(KEYS.Enter) ||
|
|
346
|
+
(__DEV__ && keyCode(event).matches(KEYS.X))
|
|
347
|
+
) {
|
|
348
|
+
focusManager.pressOut();
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
if (
|
|
352
|
+
keyCode(event).matches(KEYS.Forward) ||
|
|
353
|
+
(__DEV__ && keyCode(event).matches(KEYS.C))
|
|
354
|
+
) {
|
|
355
|
+
setDisplayState(DISPLAY_STATES.HUD);
|
|
356
|
+
KeyInputHandler.getInstance().onForwardPressOut();
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (
|
|
360
|
+
keyCode(event).matches(KEYS.Rewind) ||
|
|
361
|
+
(__DEV__ && keyCode(event).matches(KEYS.Z))
|
|
362
|
+
) {
|
|
363
|
+
setDisplayState(DISPLAY_STATES.HUD);
|
|
364
|
+
KeyInputHandler.getInstance().onRewindPressOut();
|
|
365
|
+
}
|
|
345
366
|
}
|
|
346
367
|
|
|
347
368
|
onKeyDown(event) {
|
|
@@ -372,6 +393,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
372
393
|
When the player is displayed, we listen to Native Play / Pause / Stop
|
|
373
394
|
buttons. Any other key press will display the transport controls
|
|
374
395
|
*/
|
|
396
|
+
|
|
375
397
|
if (
|
|
376
398
|
displayState === DISPLAY_STATES.PLAYER ||
|
|
377
399
|
displayState === DISPLAY_STATES.HUD
|
|
@@ -404,16 +426,22 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
404
426
|
return;
|
|
405
427
|
}
|
|
406
428
|
|
|
407
|
-
if (
|
|
429
|
+
if (
|
|
430
|
+
keyCode(event).matches(KEYS.Forward) ||
|
|
431
|
+
(__DEV__ && keyCode(event).matches(KEYS.C))
|
|
432
|
+
) {
|
|
408
433
|
setDisplayState(DISPLAY_STATES.HUD);
|
|
409
|
-
|
|
434
|
+
KeyInputHandler.getInstance().onForwardPress();
|
|
410
435
|
|
|
411
436
|
return;
|
|
412
437
|
}
|
|
413
438
|
|
|
414
|
-
if (
|
|
439
|
+
if (
|
|
440
|
+
keyCode(event).matches(KEYS.Rewind) ||
|
|
441
|
+
(__DEV__ && keyCode(event).matches(KEYS.Z))
|
|
442
|
+
) {
|
|
415
443
|
setDisplayState(DISPLAY_STATES.HUD);
|
|
416
|
-
|
|
444
|
+
KeyInputHandler.getInstance().onRewindPress();
|
|
417
445
|
|
|
418
446
|
return;
|
|
419
447
|
}
|
|
@@ -473,7 +501,10 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
473
501
|
}
|
|
474
502
|
}
|
|
475
503
|
|
|
476
|
-
if (
|
|
504
|
+
if (
|
|
505
|
+
keyCode(event).matches(KEYS.Enter) ||
|
|
506
|
+
(__DEV__ && keyCode(event).matches(KEYS.X))
|
|
507
|
+
) {
|
|
477
508
|
if (displayState === DISPLAY_STATES.PLAYER) {
|
|
478
509
|
setDisplayState(DISPLAY_STATES.HUD);
|
|
479
510
|
} else {
|
|
@@ -688,54 +719,43 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
688
719
|
}, SEQUENCE_ENTRY_TIME);
|
|
689
720
|
}
|
|
690
721
|
|
|
722
|
+
// TODO: Delete it on next PR if not needed
|
|
691
723
|
private handleLongPress = (event: CustomEvent) => {
|
|
692
724
|
const { keyCode } = event.detail;
|
|
693
|
-
const { displayState } = this.props;
|
|
694
|
-
const playerState = displayState === DISPLAY_STATES.PLAYER;
|
|
695
|
-
const hudState = displayState === DISPLAY_STATES.HUD;
|
|
696
|
-
const playbackState = playerState || hudState;
|
|
697
725
|
this.longPressActive = true;
|
|
698
726
|
this.cancelHudTimeout();
|
|
699
727
|
|
|
700
728
|
switch (keyCode) {
|
|
701
|
-
case KEYS.Forward.code:
|
|
702
|
-
playbackState && this.props.seekMethods.onForwardLongPress();
|
|
703
|
-
break;
|
|
704
|
-
|
|
705
|
-
case KEYS.Rewind.code:
|
|
706
|
-
playbackState && this.props.seekMethods.onRewindLongPress();
|
|
707
|
-
break;
|
|
708
|
-
|
|
709
729
|
case KEYS.Enter.code:
|
|
730
|
+
case KEYS.X.code:
|
|
710
731
|
focusManager.longPress();
|
|
711
732
|
break;
|
|
712
733
|
}
|
|
713
734
|
};
|
|
714
735
|
|
|
736
|
+
// TODO: Delete it on next PR if not needed
|
|
715
737
|
private handleLongPressRelease = (event: CustomEvent) => {
|
|
716
738
|
const { keyCode } = event.detail;
|
|
717
739
|
this.longPressActive = false;
|
|
718
740
|
this.resetHudTimeout();
|
|
719
741
|
|
|
720
742
|
switch (keyCode) {
|
|
721
|
-
case KEYS.Forward.code:
|
|
722
|
-
this.props.seekMethods.onForwardPressOut();
|
|
723
|
-
break;
|
|
724
|
-
|
|
725
|
-
case KEYS.Rewind.code:
|
|
726
|
-
this.props.seekMethods.onRewindPressOut();
|
|
727
|
-
break;
|
|
728
|
-
|
|
729
743
|
case KEYS.Enter.code:
|
|
730
|
-
|
|
744
|
+
case KEYS.X.code:
|
|
745
|
+
// focusManager.pressOut();
|
|
731
746
|
break;
|
|
732
747
|
}
|
|
733
748
|
};
|
|
734
749
|
|
|
735
750
|
private keySupportsLongPress(event: KeyboardEvent): boolean {
|
|
736
|
-
return [
|
|
737
|
-
|
|
738
|
-
|
|
751
|
+
return [
|
|
752
|
+
KEYS.Forward.code,
|
|
753
|
+
KEYS.Rewind.code,
|
|
754
|
+
KEYS.Enter.code,
|
|
755
|
+
KEYS.Z.code,
|
|
756
|
+
KEYS.X.code,
|
|
757
|
+
KEYS.C.code,
|
|
758
|
+
].includes(event.code);
|
|
739
759
|
}
|
|
740
760
|
|
|
741
761
|
render() {
|
|
@@ -754,7 +774,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
754
774
|
|
|
755
775
|
export const InteractionManager = R.compose(
|
|
756
776
|
withNavigator,
|
|
757
|
-
withUseSeek,
|
|
758
777
|
withXray,
|
|
759
778
|
connectToStore(R.pick(["rivers"])),
|
|
760
779
|
PlayerContentContext.withConsumer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-dom-app",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.4750811552",
|
|
4
4
|
"description": "Zapp App Component for Applicaster's Quick Brick React Native App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/applicaster/zapp-react-dom-app#readme",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@applicaster/zapp-react-dom-ui-components": "13.0.0-alpha.
|
|
26
|
-
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.
|
|
27
|
-
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.
|
|
28
|
-
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.
|
|
29
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.
|
|
25
|
+
"@applicaster/zapp-react-dom-ui-components": "13.0.0-alpha.4750811552",
|
|
26
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.4750811552",
|
|
27
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.4750811552",
|
|
28
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.4750811552",
|
|
29
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.4750811552",
|
|
30
30
|
"abortcontroller-polyfill": "^1.7.5",
|
|
31
31
|
"history": "^4.7.2",
|
|
32
32
|
"react-router-dom": "^5.1.2",
|