@applicaster/zapp-react-dom-app 13.0.0-alpha.4138374149 → 13.0.0-alpha.4515349201
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 +56 -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,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
473
501
|
}
|
|
474
502
|
}
|
|
475
503
|
|
|
476
|
-
if (keyCode(event).matches(KEYS.Enter)) {
|
|
504
|
+
if (keyCode(event).matches(KEYS.Enter) || keyCode(event).matches(KEYS.X)) {
|
|
477
505
|
if (displayState === DISPLAY_STATES.PLAYER) {
|
|
478
506
|
setDisplayState(DISPLAY_STATES.HUD);
|
|
479
507
|
} else {
|
|
@@ -688,54 +716,43 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
688
716
|
}, SEQUENCE_ENTRY_TIME);
|
|
689
717
|
}
|
|
690
718
|
|
|
719
|
+
// TODO: Delete it on next PR if not needed
|
|
691
720
|
private handleLongPress = (event: CustomEvent) => {
|
|
692
721
|
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
722
|
this.longPressActive = true;
|
|
698
723
|
this.cancelHudTimeout();
|
|
699
724
|
|
|
700
725
|
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
726
|
case KEYS.Enter.code:
|
|
727
|
+
case KEYS.X.code:
|
|
710
728
|
focusManager.longPress();
|
|
711
729
|
break;
|
|
712
730
|
}
|
|
713
731
|
};
|
|
714
732
|
|
|
733
|
+
// TODO: Delete it on next PR if not needed
|
|
715
734
|
private handleLongPressRelease = (event: CustomEvent) => {
|
|
716
735
|
const { keyCode } = event.detail;
|
|
717
736
|
this.longPressActive = false;
|
|
718
737
|
this.resetHudTimeout();
|
|
719
738
|
|
|
720
739
|
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
740
|
case KEYS.Enter.code:
|
|
730
|
-
|
|
741
|
+
case KEYS.X.code:
|
|
742
|
+
// focusManager.pressOut();
|
|
731
743
|
break;
|
|
732
744
|
}
|
|
733
745
|
};
|
|
734
746
|
|
|
735
747
|
private keySupportsLongPress(event: KeyboardEvent): boolean {
|
|
736
|
-
return [
|
|
737
|
-
|
|
738
|
-
|
|
748
|
+
return [
|
|
749
|
+
KEYS.Forward.code,
|
|
750
|
+
KEYS.Rewind.code,
|
|
751
|
+
KEYS.Enter.code,
|
|
752
|
+
KEYS.Z.code,
|
|
753
|
+
KEYS.X.code,
|
|
754
|
+
KEYS.C.code,
|
|
755
|
+
].includes(event.code);
|
|
739
756
|
}
|
|
740
757
|
|
|
741
758
|
render() {
|
|
@@ -754,7 +771,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
754
771
|
|
|
755
772
|
export const InteractionManager = R.compose(
|
|
756
773
|
withNavigator,
|
|
757
|
-
withUseSeek,
|
|
758
774
|
withXray,
|
|
759
775
|
connectToStore(R.pick(["rivers"])),
|
|
760
776
|
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.4515349201",
|
|
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.4515349201",
|
|
26
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.4515349201",
|
|
27
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.4515349201",
|
|
28
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.4515349201",
|
|
29
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.4515349201",
|
|
30
30
|
"abortcontroller-polyfill": "^1.7.5",
|
|
31
31
|
"history": "^4.7.2",
|
|
32
32
|
"react-router-dom": "^5.1.2",
|