@applicaster/zapp-react-dom-app 12.0.2-rc.0 → 13.0.0-alpha.1632352572
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 +54 -36
- package/App/Loader/SplashLoader.js +8 -7
- package/App/Loader/loadSessionStorageData.js +0 -1
- package/App/Loader/utils/platform.js +0 -1
- package/App/Router/index.js +6 -7
- package/App/Splash/Spinner.js +0 -1
- package/App/Splash/Splash.js +9 -6
- package/Polyfills/Storage/index.js +15 -26
- 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,32 @@ 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 (keyCode(event).matches(KEYS.Enter) ||
|
|
345
|
+
(__DEV__ && keyCode(event).matches(KEYS.X))) {
|
|
346
|
+
focusManager.pressOut();
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (
|
|
350
|
+
keyCode(event).matches(KEYS.Forward) ||
|
|
351
|
+
(__DEV__ && keyCode(event).matches(KEYS.C))
|
|
352
|
+
) {
|
|
353
|
+
setDisplayState(DISPLAY_STATES.HUD);
|
|
354
|
+
KeyInputHandler.getInstance().onForwardPressOut();
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (
|
|
358
|
+
keyCode(event).matches(KEYS.Rewind) ||
|
|
359
|
+
(__DEV__ && keyCode(event).matches(KEYS.Z))
|
|
360
|
+
) {
|
|
361
|
+
setDisplayState(DISPLAY_STATES.HUD);
|
|
362
|
+
KeyInputHandler.getInstance().onRewindPressOut();
|
|
363
|
+
}
|
|
345
364
|
}
|
|
346
365
|
|
|
347
366
|
onKeyDown(event) {
|
|
@@ -372,6 +391,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
372
391
|
When the player is displayed, we listen to Native Play / Pause / Stop
|
|
373
392
|
buttons. Any other key press will display the transport controls
|
|
374
393
|
*/
|
|
394
|
+
|
|
375
395
|
if (
|
|
376
396
|
displayState === DISPLAY_STATES.PLAYER ||
|
|
377
397
|
displayState === DISPLAY_STATES.HUD
|
|
@@ -404,16 +424,22 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
404
424
|
return;
|
|
405
425
|
}
|
|
406
426
|
|
|
407
|
-
if (
|
|
427
|
+
if (
|
|
428
|
+
keyCode(event).matches(KEYS.Forward) ||
|
|
429
|
+
(__DEV__ && keyCode(event).matches(KEYS.C))
|
|
430
|
+
) {
|
|
408
431
|
setDisplayState(DISPLAY_STATES.HUD);
|
|
409
|
-
|
|
432
|
+
KeyInputHandler.getInstance().onForwardPress();
|
|
410
433
|
|
|
411
434
|
return;
|
|
412
435
|
}
|
|
413
436
|
|
|
414
|
-
if (
|
|
437
|
+
if (
|
|
438
|
+
keyCode(event).matches(KEYS.Rewind) ||
|
|
439
|
+
(__DEV__ && keyCode(event).matches(KEYS.Z))
|
|
440
|
+
) {
|
|
415
441
|
setDisplayState(DISPLAY_STATES.HUD);
|
|
416
|
-
|
|
442
|
+
KeyInputHandler.getInstance().onRewindPress();
|
|
417
443
|
|
|
418
444
|
return;
|
|
419
445
|
}
|
|
@@ -473,7 +499,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
473
499
|
}
|
|
474
500
|
}
|
|
475
501
|
|
|
476
|
-
if (keyCode(event).matches(KEYS.Enter)) {
|
|
502
|
+
if (keyCode(event).matches(KEYS.Enter) || keyCode(event).matches(KEYS.X)) {
|
|
477
503
|
if (displayState === DISPLAY_STATES.PLAYER) {
|
|
478
504
|
setDisplayState(DISPLAY_STATES.HUD);
|
|
479
505
|
} else {
|
|
@@ -688,6 +714,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
688
714
|
}, SEQUENCE_ENTRY_TIME);
|
|
689
715
|
}
|
|
690
716
|
|
|
717
|
+
// TODO: Delete it on next PR if not needed
|
|
691
718
|
private handleLongPress = (event: CustomEvent) => {
|
|
692
719
|
const { keyCode } = event.detail;
|
|
693
720
|
const { displayState } = this.props;
|
|
@@ -698,44 +725,36 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
698
725
|
this.cancelHudTimeout();
|
|
699
726
|
|
|
700
727
|
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
728
|
case KEYS.Enter.code:
|
|
729
|
+
case KEYS.X.code:
|
|
710
730
|
focusManager.longPress();
|
|
711
731
|
break;
|
|
712
732
|
}
|
|
713
733
|
};
|
|
714
734
|
|
|
735
|
+
// TODO: Delete it on next PR if not needed
|
|
715
736
|
private handleLongPressRelease = (event: CustomEvent) => {
|
|
716
737
|
const { keyCode } = event.detail;
|
|
717
738
|
this.longPressActive = false;
|
|
718
739
|
this.resetHudTimeout();
|
|
719
740
|
|
|
720
741
|
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
742
|
case KEYS.Enter.code:
|
|
730
|
-
|
|
743
|
+
case KEYS.X.code:
|
|
744
|
+
// focusManager.pressOut();
|
|
731
745
|
break;
|
|
732
746
|
}
|
|
733
747
|
};
|
|
734
748
|
|
|
735
749
|
private keySupportsLongPress(event: KeyboardEvent): boolean {
|
|
736
|
-
return [
|
|
737
|
-
|
|
738
|
-
|
|
750
|
+
return [
|
|
751
|
+
KEYS.Forward.code,
|
|
752
|
+
KEYS.Rewind.code,
|
|
753
|
+
KEYS.Enter.code,
|
|
754
|
+
KEYS.Z.code,
|
|
755
|
+
KEYS.X.code,
|
|
756
|
+
KEYS.C.code,
|
|
757
|
+
].includes(event.code);
|
|
739
758
|
}
|
|
740
759
|
|
|
741
760
|
render() {
|
|
@@ -754,7 +773,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
754
773
|
|
|
755
774
|
export const InteractionManager = R.compose(
|
|
756
775
|
withNavigator,
|
|
757
|
-
withUseSeek,
|
|
758
776
|
withXray,
|
|
759
777
|
connectToStore(R.pick(["rivers"])),
|
|
760
778
|
PlayerContentContext.withConsumer,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
/* global tizen */
|
|
3
2
|
import * as React from "react";
|
|
4
3
|
import * as R from "ramda";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
5
|
|
|
6
6
|
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
7
7
|
import { QUICK_BRICK_EVENTS } from "@applicaster/zapp-react-native-bridge/QuickBrick";
|
|
@@ -9,17 +9,12 @@ import { QUICK_BRICK_EVENTS } from "@applicaster/zapp-react-native-bridge/QuickB
|
|
|
9
9
|
import { QuickBrickEvents } from "../../Polyfills/QuickBrickCommunicationModule";
|
|
10
10
|
import { Splash } from "../Splash";
|
|
11
11
|
|
|
12
|
-
type Props = {
|
|
13
|
-
appLaunched: boolean,
|
|
14
|
-
children: any,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
12
|
const getAppLaunched = R.compose(
|
|
18
13
|
R.assoc("appLaunched", R.__, {}),
|
|
19
14
|
R.path(["appState", "appLaunched"])
|
|
20
15
|
);
|
|
21
16
|
|
|
22
|
-
class SplashHandler extends React.Component
|
|
17
|
+
class SplashHandler extends React.Component {
|
|
23
18
|
constructor(props) {
|
|
24
19
|
super(props);
|
|
25
20
|
|
|
@@ -76,6 +71,12 @@ class SplashHandler extends React.Component<Props> {
|
|
|
76
71
|
}
|
|
77
72
|
}
|
|
78
73
|
|
|
74
|
+
SplashHandler.propTypes = {
|
|
75
|
+
appLaunched: PropTypes.bool.isRequired,
|
|
76
|
+
children: PropTypes.node.isRequired,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
SplashHandler.shouldShowSplash = true;
|
|
79
80
|
SplashHandler.shouldShowSplash = true;
|
|
80
81
|
|
|
81
82
|
export const SplashLoader = connectToStore(getAppLaunched)(SplashHandler);
|
package/App/Router/index.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
1
|
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
4
3
|
|
|
5
4
|
import { Router } from "react-router";
|
|
6
5
|
import { createMemoryHistory } from "history";
|
|
7
6
|
|
|
8
|
-
type Props = {
|
|
9
|
-
children: any,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
7
|
const history = createMemoryHistory();
|
|
13
8
|
|
|
14
|
-
export const ZappDomRouter = ({ children, ...otherProps }
|
|
9
|
+
export const ZappDomRouter = ({ children, ...otherProps }) => (
|
|
15
10
|
<Router history={history} {...otherProps}>
|
|
16
11
|
{children}
|
|
17
12
|
</Router>
|
|
18
13
|
);
|
|
14
|
+
|
|
15
|
+
ZappDomRouter.propTypes = {
|
|
16
|
+
children: PropTypes.node.isRequired,
|
|
17
|
+
};
|
package/App/Splash/Spinner.js
CHANGED
package/App/Splash/Splash.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import React from "react";
|
|
3
2
|
|
|
4
|
-
import
|
|
3
|
+
import PropTypes from "prop-types";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
remoteConfigurations: any,
|
|
8
|
-
};
|
|
5
|
+
import { verifyAssets } from "@applicaster/zapp-react-dom-ui-components/Helpers/protectHelper";
|
|
9
6
|
|
|
10
|
-
export const SplashComponent = ({ remoteConfigurations }
|
|
7
|
+
export const SplashComponent = ({ remoteConfigurations }) => {
|
|
11
8
|
const image = verifyAssets(remoteConfigurations.assets, [
|
|
12
9
|
"universal",
|
|
13
10
|
"splash",
|
|
@@ -19,3 +16,9 @@ export const SplashComponent = ({ remoteConfigurations }: Props) => {
|
|
|
19
16
|
</div>
|
|
20
17
|
);
|
|
21
18
|
};
|
|
19
|
+
|
|
20
|
+
SplashComponent.propTypes = {
|
|
21
|
+
remoteConfigurations: PropTypes.shape({
|
|
22
|
+
assets: PropTypes.object.isRequired,
|
|
23
|
+
}).isRequired,
|
|
24
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import * as R from "ramda";
|
|
3
2
|
|
|
4
3
|
import {
|
|
@@ -7,11 +6,11 @@ import {
|
|
|
7
6
|
} from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
8
7
|
import { mapKeys } from "@applicaster/zapp-react-native-utils/objectUtils";
|
|
9
8
|
|
|
10
|
-
export type StorageI = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
9
|
+
// export type StorageI = {
|
|
10
|
+
// setItem: (string, string, ?string) => Promise<any>,
|
|
11
|
+
// getItem: (string, ?string) => Promise<any>,
|
|
12
|
+
// getAllItems: () => Promise<any>,
|
|
13
|
+
// };
|
|
15
14
|
|
|
16
15
|
export const STORAGE_TYPES = ["localStorage", "sessionStorage"];
|
|
17
16
|
|
|
@@ -25,10 +24,7 @@ const NAMESPACE_SEPARATOR = "_::_";
|
|
|
25
24
|
* @param {?String} namespace
|
|
26
25
|
* @returns {String}
|
|
27
26
|
*/
|
|
28
|
-
export function applyNamespaceToKeyName(
|
|
29
|
-
key: string,
|
|
30
|
-
namespace: ?string
|
|
31
|
-
): string {
|
|
27
|
+
export function applyNamespaceToKeyName(key, namespace) {
|
|
32
28
|
return namespace ? `${namespace}${NAMESPACE_SEPARATOR}${key}` : key;
|
|
33
29
|
}
|
|
34
30
|
|
|
@@ -40,7 +36,7 @@ export function applyNamespaceToKeyName(
|
|
|
40
36
|
* @param {Function} fn function to run
|
|
41
37
|
* @returns {Promise}
|
|
42
38
|
*/
|
|
43
|
-
function tryAndResolve(fn
|
|
39
|
+
function tryAndResolve(fn) {
|
|
44
40
|
try {
|
|
45
41
|
return R.compose(
|
|
46
42
|
(value) => Promise.resolve(value),
|
|
@@ -62,7 +58,7 @@ function tryAndResolve(fn: (any) => any): Promise<any> {
|
|
|
62
58
|
* @returns {Function} storageObject.callMethod: invokes methods on the storage object
|
|
63
59
|
* @returns {Function} storageObject.getKeys: returns all existing keys in the storage object
|
|
64
60
|
*/
|
|
65
|
-
function getStorageObject(type
|
|
61
|
+
function getStorageObject(type) {
|
|
66
62
|
const storage = R.prop(type, window);
|
|
67
63
|
|
|
68
64
|
if (!R.includes(type, STORAGE_TYPES) || !storage) {
|
|
@@ -80,7 +76,7 @@ function getStorageObject(type: string): (any) => void | Promise<any> {
|
|
|
80
76
|
* @param {Array} args array of arguments to use when invoking the method
|
|
81
77
|
* @returns response of the method call
|
|
82
78
|
*/
|
|
83
|
-
function callMethod(method
|
|
79
|
+
function callMethod(method, ...args) {
|
|
84
80
|
return storage[method](...args);
|
|
85
81
|
}
|
|
86
82
|
|
|
@@ -107,9 +103,9 @@ function getStorageObject(type: string): (any) => void | Promise<any> {
|
|
|
107
103
|
/**
|
|
108
104
|
* returns an object to interact with a storage module (localStorage or sessionStorage)
|
|
109
105
|
* @param {String} type of storage
|
|
110
|
-
* @returns {
|
|
106
|
+
* @returns {StorageI}
|
|
111
107
|
*/
|
|
112
|
-
export function getStorageModule(type
|
|
108
|
+
export function getStorageModule(type) {
|
|
113
109
|
const Storage = getStorageObject(type);
|
|
114
110
|
|
|
115
111
|
/**
|
|
@@ -120,11 +116,7 @@ export function getStorageModule(type: string): StorageI {
|
|
|
120
116
|
* @param {?String} namespace
|
|
121
117
|
* @returns {Promise<Boolean|Error>}
|
|
122
118
|
*/
|
|
123
|
-
function setItem(
|
|
124
|
-
key: string,
|
|
125
|
-
value: string,
|
|
126
|
-
namespace: ?string = DEFAULT_NAMESPACE
|
|
127
|
-
): Promise<boolean | Error> {
|
|
119
|
+
function setItem(key, value, namespace = DEFAULT_NAMESPACE) {
|
|
128
120
|
const keyName = applyNamespaceToKeyName(
|
|
129
121
|
key,
|
|
130
122
|
namespace || DEFAULT_NAMESPACE
|
|
@@ -144,10 +136,7 @@ export function getStorageModule(type: string): StorageI {
|
|
|
144
136
|
* @param {?String} namespace
|
|
145
137
|
* @returns {Promise<Any|Error>}
|
|
146
138
|
*/
|
|
147
|
-
function getItem(
|
|
148
|
-
key: string,
|
|
149
|
-
namespace: ?string = DEFAULT_NAMESPACE
|
|
150
|
-
): Promise<any> {
|
|
139
|
+
function getItem(key, namespace = DEFAULT_NAMESPACE) {
|
|
151
140
|
const keyName = applyNamespaceToKeyName(
|
|
152
141
|
key,
|
|
153
142
|
namespace || DEFAULT_NAMESPACE
|
|
@@ -163,7 +152,7 @@ export function getStorageModule(type: string): StorageI {
|
|
|
163
152
|
* @param {?String} namespace
|
|
164
153
|
* @returns {Promise<Boolean|Error>}
|
|
165
154
|
*/
|
|
166
|
-
function removeItem(key
|
|
155
|
+
function removeItem(key, namespace = DEFAULT_NAMESPACE) {
|
|
167
156
|
const keyName = applyNamespaceToKeyName(key, namespace);
|
|
168
157
|
|
|
169
158
|
return tryAndResolve(() => Storage.callMethod("removeItem", keyName));
|
|
@@ -174,7 +163,7 @@ export function getStorageModule(type: string): StorageI {
|
|
|
174
163
|
* @param {?String} namespace
|
|
175
164
|
* @returns {Promise<Object|Error>}
|
|
176
165
|
*/
|
|
177
|
-
function getAllItems(namespace
|
|
166
|
+
function getAllItems(namespace = null) {
|
|
178
167
|
return tryAndResolve(() => {
|
|
179
168
|
const keys = Storage.getKeys();
|
|
180
169
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-dom-app",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0-alpha.1632352572",
|
|
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": "
|
|
26
|
-
"@applicaster/zapp-react-native-bridge": "
|
|
27
|
-
"@applicaster/zapp-react-native-redux": "
|
|
28
|
-
"@applicaster/zapp-react-native-ui-components": "
|
|
29
|
-
"@applicaster/zapp-react-native-utils": "
|
|
25
|
+
"@applicaster/zapp-react-dom-ui-components": "13.0.0-alpha.1632352572",
|
|
26
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1632352572",
|
|
27
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.1632352572",
|
|
28
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.1632352572",
|
|
29
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.1632352572",
|
|
30
30
|
"abortcontroller-polyfill": "^1.7.5",
|
|
31
31
|
"history": "^4.7.2",
|
|
32
32
|
"react-router-dom": "^5.1.2",
|