@applicaster/zapp-react-dom-app 12.0.5 → 13.0.0-alpha.1035032144
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 +64 -43
- package/App/Loader/SplashLoader.js +8 -7
- package/App/Loader/__tests__/__snapshots__/loadDomPlugins.test.js.snap +6 -6
- package/App/Loader/loadSessionStorageData.js +0 -1
- package/App/Loader/utils/platform.js +46 -27
- package/App/Splash/Splash.js +9 -6
- package/Polyfills/Storage/__tests__/__snapshots__/storage.test.js.snap +4 -4
- package/Polyfills/Storage/index.js +15 -28
- package/index.js +0 -7
- package/package.json +17 -8
- package/App/Router/index.js +0 -18
|
@@ -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) {
|
|
@@ -365,13 +386,14 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
365
386
|
this.longPressDetector.monitorKeyPress(event.code, event);
|
|
366
387
|
}
|
|
367
388
|
|
|
368
|
-
//
|
|
369
|
-
if (event.repeat) return;
|
|
389
|
+
// Only handle repeat events for arrow keys
|
|
390
|
+
if (event.repeat && !keyCode(event).matchesAny(...ARROW_KEYS)) return;
|
|
370
391
|
|
|
371
392
|
/**
|
|
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
|
}
|
|
@@ -451,7 +479,9 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
451
479
|
const isHookInHomescreen = entryData?.payload?.home;
|
|
452
480
|
|
|
453
481
|
const isHookFlowBlocker =
|
|
454
|
-
entryData?.hookPlugin?.module?.isFlowBlocker
|
|
482
|
+
typeof entryData?.hookPlugin?.module?.isFlowBlocker === "function"
|
|
483
|
+
? entryData?.hookPlugin?.module?.isFlowBlocker()
|
|
484
|
+
: entryData?.hookPlugin?.module?.isFlowBlocker;
|
|
455
485
|
|
|
456
486
|
if (isHookInHomescreen && isHookFlowBlocker) {
|
|
457
487
|
this.platformBack();
|
|
@@ -473,7 +503,10 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
473
503
|
}
|
|
474
504
|
}
|
|
475
505
|
|
|
476
|
-
if (
|
|
506
|
+
if (
|
|
507
|
+
keyCode(event).matches(KEYS.Enter) ||
|
|
508
|
+
(__DEV__ && keyCode(event).matches(KEYS.X))
|
|
509
|
+
) {
|
|
477
510
|
if (displayState === DISPLAY_STATES.PLAYER) {
|
|
478
511
|
setDisplayState(DISPLAY_STATES.HUD);
|
|
479
512
|
} else {
|
|
@@ -689,54 +722,43 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
689
722
|
}, SEQUENCE_ENTRY_TIME);
|
|
690
723
|
}
|
|
691
724
|
|
|
725
|
+
// TODO: Delete it on next PR if not needed
|
|
692
726
|
private handleLongPress = (event: CustomEvent) => {
|
|
693
727
|
const { keyCode } = event.detail;
|
|
694
|
-
const { displayState } = this.props;
|
|
695
|
-
const playerState = displayState === DISPLAY_STATES.PLAYER;
|
|
696
|
-
const hudState = displayState === DISPLAY_STATES.HUD;
|
|
697
|
-
const playbackState = playerState || hudState;
|
|
698
728
|
this.longPressActive = true;
|
|
699
729
|
this.cancelHudTimeout();
|
|
700
730
|
|
|
701
731
|
switch (keyCode) {
|
|
702
|
-
case KEYS.Forward.code:
|
|
703
|
-
playbackState && this.props.seekMethods.onForwardLongPress();
|
|
704
|
-
break;
|
|
705
|
-
|
|
706
|
-
case KEYS.Rewind.code:
|
|
707
|
-
playbackState && this.props.seekMethods.onRewindLongPress();
|
|
708
|
-
break;
|
|
709
|
-
|
|
710
732
|
case KEYS.Enter.code:
|
|
733
|
+
case KEYS.X.code:
|
|
711
734
|
focusManager.longPress();
|
|
712
735
|
break;
|
|
713
736
|
}
|
|
714
737
|
};
|
|
715
738
|
|
|
739
|
+
// TODO: Delete it on next PR if not needed
|
|
716
740
|
private handleLongPressRelease = (event: CustomEvent) => {
|
|
717
741
|
const { keyCode } = event.detail;
|
|
718
742
|
this.longPressActive = false;
|
|
719
743
|
this.resetHudTimeout();
|
|
720
744
|
|
|
721
745
|
switch (keyCode) {
|
|
722
|
-
case KEYS.Forward.code:
|
|
723
|
-
this.props.seekMethods.onForwardPressOut();
|
|
724
|
-
break;
|
|
725
|
-
|
|
726
|
-
case KEYS.Rewind.code:
|
|
727
|
-
this.props.seekMethods.onRewindPressOut();
|
|
728
|
-
break;
|
|
729
|
-
|
|
730
746
|
case KEYS.Enter.code:
|
|
731
|
-
|
|
747
|
+
case KEYS.X.code:
|
|
748
|
+
// focusManager.pressOut();
|
|
732
749
|
break;
|
|
733
750
|
}
|
|
734
751
|
};
|
|
735
752
|
|
|
736
753
|
private keySupportsLongPress(event: KeyboardEvent): boolean {
|
|
737
|
-
return [
|
|
738
|
-
|
|
739
|
-
|
|
754
|
+
return [
|
|
755
|
+
KEYS.Forward.code,
|
|
756
|
+
KEYS.Rewind.code,
|
|
757
|
+
KEYS.Enter.code,
|
|
758
|
+
KEYS.Z.code,
|
|
759
|
+
KEYS.X.code,
|
|
760
|
+
KEYS.C.code,
|
|
761
|
+
].includes(event.code);
|
|
740
762
|
}
|
|
741
763
|
|
|
742
764
|
render() {
|
|
@@ -755,7 +777,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
755
777
|
|
|
756
778
|
export const InteractionManager = R.compose(
|
|
757
779
|
withNavigator,
|
|
758
|
-
withUseSeek,
|
|
759
780
|
withXray,
|
|
760
781
|
connectToStore(R.pick(["rivers"])),
|
|
761
782
|
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);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`loadDomPlugins when there are plugins requiring to write to the dom skips plugins without init method 1`] = `
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
[
|
|
5
|
+
[
|
|
6
6
|
"could not initialize plugin Plugin with Dom node & no init method - it doesn't have an init method",
|
|
7
|
-
|
|
8
|
-
"plugin":
|
|
9
|
-
"configuration":
|
|
7
|
+
{
|
|
8
|
+
"plugin": {
|
|
9
|
+
"configuration": {
|
|
10
10
|
"foo": "bar",
|
|
11
11
|
},
|
|
12
|
-
"module":
|
|
12
|
+
"module": {
|
|
13
13
|
"requiresAppendingDomNode": true,
|
|
14
14
|
},
|
|
15
15
|
"name": "Plugin with Dom node & no init method",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
/* global webOS */
|
|
3
2
|
/* global tizen */
|
|
4
3
|
/* eslint-disable no-console */
|
|
@@ -12,11 +11,28 @@ import {
|
|
|
12
11
|
PLATFORMS,
|
|
13
12
|
} from "./const";
|
|
14
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {"tv" | "web" | "other"} DeviceType
|
|
16
|
+
* @typedef {"samsung_tv" | "lg_tv" | unknown} CustomPlatformTypes
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the user agent string from the browser or global navigator.
|
|
21
|
+
* @returns {string} The user agent string.
|
|
22
|
+
*/
|
|
15
23
|
export const getUserAgent = () =>
|
|
16
24
|
window?.navigator?.userAgent || global?.navigator?.userAgent;
|
|
17
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the device is HD (1280 width).
|
|
28
|
+
* @returns {boolean} True if the device is HD, false otherwise.
|
|
29
|
+
*/
|
|
18
30
|
export const isHD = () => window.innerWidth === 1280;
|
|
19
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Checks if the platform is LG.
|
|
34
|
+
* @returns {boolean} True if the platform is LG, false otherwise.
|
|
35
|
+
*/
|
|
20
36
|
export const isLgPlatform = () => {
|
|
21
37
|
const userAgent = getUserAgent();
|
|
22
38
|
|
|
@@ -24,10 +40,13 @@ export const isLgPlatform = () => {
|
|
|
24
40
|
return false;
|
|
25
41
|
}
|
|
26
42
|
|
|
27
|
-
// Note: LG uses the number 0 in their userAgent, possibly because of Palm WebOS
|
|
28
43
|
return hasWebOS || userAgent.includes(PLATFORMS.webos);
|
|
29
44
|
};
|
|
30
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Checks if the platform is Samsung.
|
|
48
|
+
* @returns {boolean} True if the platform is Samsung, false otherwise.
|
|
49
|
+
*/
|
|
31
50
|
export const isSamsungPlatform = () => {
|
|
32
51
|
const userAgent = getUserAgent();
|
|
33
52
|
|
|
@@ -43,42 +62,39 @@ export const isSamsungPlatform = () => {
|
|
|
43
62
|
};
|
|
44
63
|
|
|
45
64
|
/**
|
|
46
|
-
* Checks if
|
|
47
|
-
*
|
|
48
|
-
* Use this method when you need to identify the platform on runtime
|
|
49
|
-
* before the VIZIO Companion Library has loaded
|
|
65
|
+
* Checks if the platform is Vizio by using the user agent string.
|
|
66
|
+
* @returns {boolean} True if the platform is Vizio, false otherwise.
|
|
50
67
|
*/
|
|
51
68
|
export const isVizioPlatform = () => {
|
|
52
69
|
const userAgent = getUserAgent();
|
|
53
70
|
|
|
54
|
-
|
|
71
|
+
return (
|
|
55
72
|
userAgent.includes(PLATFORMS.vizio) ||
|
|
56
73
|
userAgent.includes(PLATFORMS.smartcast) ||
|
|
57
|
-
userAgent.includes(PLATFORMS.conjure)
|
|
58
|
-
|
|
59
|
-
return isVizioAgent;
|
|
74
|
+
userAgent.includes(PLATFORMS.conjure)
|
|
75
|
+
);
|
|
60
76
|
};
|
|
61
77
|
|
|
62
78
|
/**
|
|
63
|
-
* Checks if
|
|
64
|
-
*
|
|
65
|
-
* because it mainly checks whether we have access to apis, which may not be available yet
|
|
79
|
+
* Checks if the Vizio APIs are available.
|
|
80
|
+
* @returns {boolean} True if the Vizio APIs are available, false otherwise.
|
|
66
81
|
*/
|
|
67
82
|
export const hasVizioAPIs = () => {
|
|
68
|
-
|
|
83
|
+
return (
|
|
69
84
|
typeof window.VIZIO !== "undefined" &&
|
|
70
|
-
window?.applicaster?.vizioLibraryDidLoad
|
|
71
|
-
|
|
72
|
-
return hasAPIs;
|
|
85
|
+
window?.applicaster?.vizioLibraryDidLoad
|
|
86
|
+
);
|
|
73
87
|
};
|
|
74
88
|
|
|
75
89
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* @returns {"tv" | "web" | "other"} value
|
|
90
|
+
* Determines the device type based on the platform.
|
|
91
|
+
* @returns {DeviceType} The device type ("tv", "web", or "other").
|
|
79
92
|
*/
|
|
80
93
|
export const getDeviceType = () => {
|
|
81
|
-
|
|
94
|
+
/** @type {CustomPlatformTypes} */
|
|
95
|
+
const platformOS = Platform.OS;
|
|
96
|
+
|
|
97
|
+
switch (platformOS) {
|
|
82
98
|
case "samsung_tv":
|
|
83
99
|
return isSamsungPlatform() ? "tv" : "web";
|
|
84
100
|
case "lg_tv":
|
|
@@ -89,14 +105,15 @@ export const getDeviceType = () => {
|
|
|
89
105
|
};
|
|
90
106
|
|
|
91
107
|
/**
|
|
92
|
-
*
|
|
93
|
-
* @param {string} key - key
|
|
108
|
+
* Renames keys based on a predefined map.
|
|
109
|
+
* @param {string} key - The key to rename.
|
|
110
|
+
* @returns {string} The renamed key.
|
|
94
111
|
*/
|
|
95
112
|
export const renameKeys = (key) => desiredKeysMap?.[key] || key;
|
|
96
113
|
|
|
97
114
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
115
|
+
* Retrieves the connection info from WebOS.
|
|
116
|
+
* @returns {Promise<{networkType: string} | null>} A promise that resolves with the connection info or null.
|
|
100
117
|
*/
|
|
101
118
|
export const getWebOSConnectionInfo = () => {
|
|
102
119
|
return new Promise((resolve, reject) => {
|
|
@@ -109,7 +126,6 @@ export const getWebOSConnectionInfo = () => {
|
|
|
109
126
|
webOS.service.request("luna://com.palm.connectionmanager", {
|
|
110
127
|
method: "getStatus",
|
|
111
128
|
parameters: { subscribe: false },
|
|
112
|
-
|
|
113
129
|
onSuccess: (args) => {
|
|
114
130
|
const types = Object.keys(args)
|
|
115
131
|
.filter((key) => args[key].state === "connected")
|
|
@@ -117,7 +133,6 @@ export const getWebOSConnectionInfo = () => {
|
|
|
117
133
|
|
|
118
134
|
resolve({ networkType: types });
|
|
119
135
|
},
|
|
120
|
-
|
|
121
136
|
onFailure: (error) => {
|
|
122
137
|
console.error(
|
|
123
138
|
"getWebOSConnectionInfo: There was an error getting connection info",
|
|
@@ -130,6 +145,10 @@ export const getWebOSConnectionInfo = () => {
|
|
|
130
145
|
});
|
|
131
146
|
};
|
|
132
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Retrieves the connection info from Tizen.
|
|
150
|
+
* @returns {Promise<{networkType: string} | null>} A promise that resolves with the connection info or null.
|
|
151
|
+
*/
|
|
133
152
|
export const getTizenConnectionInfo = () => {
|
|
134
153
|
return new Promise((resolve, reject) => {
|
|
135
154
|
if (!isSamsungPlatform) {
|
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,7 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`storageObject when the requested storage exists getAllItems returns all keys 1`] = `
|
|
4
|
-
|
|
4
|
+
{
|
|
5
5
|
"baz_::_foo": "baz",
|
|
6
6
|
"baz_::_otherKey": "otherValue",
|
|
7
7
|
"foo": "bar",
|
|
@@ -10,7 +10,7 @@ Object {
|
|
|
10
10
|
`;
|
|
11
11
|
|
|
12
12
|
exports[`storageObject when the requested storage exists getAllItems returns all keys 2`] = `
|
|
13
|
-
|
|
13
|
+
{
|
|
14
14
|
"baz_::_foo": "baz",
|
|
15
15
|
"baz_::_otherKey": "otherValue",
|
|
16
16
|
"foo": "bar",
|
|
@@ -19,14 +19,14 @@ Object {
|
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
21
|
exports[`storageObject when the requested storage exists getAllItems returns all keys in the namespace if provided 1`] = `
|
|
22
|
-
|
|
22
|
+
{
|
|
23
23
|
"foo": "baz",
|
|
24
24
|
"otherKey": "otherValue",
|
|
25
25
|
}
|
|
26
26
|
`;
|
|
27
27
|
|
|
28
28
|
exports[`storageObject when the requested storage exists getAllItems returns all keys in the namespace if provided 2`] = `
|
|
29
|
-
|
|
29
|
+
{
|
|
30
30
|
"foo": "baz",
|
|
31
31
|
"otherKey": "otherValue",
|
|
32
32
|
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
// @ts-ignore
|
|
4
1
|
import * as R from "ramda";
|
|
5
2
|
|
|
6
3
|
import {
|
|
@@ -9,11 +6,11 @@ import {
|
|
|
9
6
|
} from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
10
7
|
import { mapKeys } from "@applicaster/zapp-react-native-utils/objectUtils";
|
|
11
8
|
|
|
12
|
-
export type StorageI = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
9
|
+
// export type StorageI = {
|
|
10
|
+
// setItem: (string, string, ?string) => Promise<any>,
|
|
11
|
+
// getItem: (string, ?string) => Promise<any>,
|
|
12
|
+
// getAllItems: () => Promise<any>,
|
|
13
|
+
// };
|
|
17
14
|
|
|
18
15
|
export const STORAGE_TYPES = ["localStorage", "sessionStorage"];
|
|
19
16
|
|
|
@@ -27,10 +24,7 @@ const NAMESPACE_SEPARATOR = "_::_";
|
|
|
27
24
|
* @param {?String} namespace
|
|
28
25
|
* @returns {String}
|
|
29
26
|
*/
|
|
30
|
-
export function applyNamespaceToKeyName(
|
|
31
|
-
key: string,
|
|
32
|
-
namespace: ?string
|
|
33
|
-
): string {
|
|
27
|
+
export function applyNamespaceToKeyName(key, namespace) {
|
|
34
28
|
return namespace ? `${namespace}${NAMESPACE_SEPARATOR}${key}` : key;
|
|
35
29
|
}
|
|
36
30
|
|
|
@@ -42,7 +36,7 @@ export function applyNamespaceToKeyName(
|
|
|
42
36
|
* @param {Function} fn function to run
|
|
43
37
|
* @returns {Promise}
|
|
44
38
|
*/
|
|
45
|
-
function tryAndResolve(fn
|
|
39
|
+
function tryAndResolve(fn) {
|
|
46
40
|
try {
|
|
47
41
|
return R.compose(
|
|
48
42
|
(value) => Promise.resolve(value),
|
|
@@ -64,7 +58,7 @@ function tryAndResolve(fn: (any) => any): Promise<any> {
|
|
|
64
58
|
* @returns {Function} storageObject.callMethod: invokes methods on the storage object
|
|
65
59
|
* @returns {Function} storageObject.getKeys: returns all existing keys in the storage object
|
|
66
60
|
*/
|
|
67
|
-
function getStorageObject(type
|
|
61
|
+
function getStorageObject(type) {
|
|
68
62
|
const storage = R.prop(type, window);
|
|
69
63
|
|
|
70
64
|
if (!R.includes(type, STORAGE_TYPES) || !storage) {
|
|
@@ -82,7 +76,7 @@ function getStorageObject(type: string): (any) => void | Promise<any> {
|
|
|
82
76
|
* @param {Array} args array of arguments to use when invoking the method
|
|
83
77
|
* @returns response of the method call
|
|
84
78
|
*/
|
|
85
|
-
function callMethod(method
|
|
79
|
+
function callMethod(method, ...args) {
|
|
86
80
|
return storage[method](...args);
|
|
87
81
|
}
|
|
88
82
|
|
|
@@ -109,9 +103,9 @@ function getStorageObject(type: string): (any) => void | Promise<any> {
|
|
|
109
103
|
/**
|
|
110
104
|
* returns an object to interact with a storage module (localStorage or sessionStorage)
|
|
111
105
|
* @param {String} type of storage
|
|
112
|
-
* @returns {
|
|
106
|
+
* @returns {StorageI}
|
|
113
107
|
*/
|
|
114
|
-
export function getStorageModule(type
|
|
108
|
+
export function getStorageModule(type) {
|
|
115
109
|
const Storage = getStorageObject(type);
|
|
116
110
|
|
|
117
111
|
/**
|
|
@@ -122,11 +116,7 @@ export function getStorageModule(type: string): StorageI {
|
|
|
122
116
|
* @param {?String} namespace
|
|
123
117
|
* @returns {Promise<Boolean|Error>}
|
|
124
118
|
*/
|
|
125
|
-
function setItem(
|
|
126
|
-
key: string,
|
|
127
|
-
value: string,
|
|
128
|
-
namespace: ?string = DEFAULT_NAMESPACE
|
|
129
|
-
): Promise<boolean | Error> {
|
|
119
|
+
function setItem(key, value, namespace = DEFAULT_NAMESPACE) {
|
|
130
120
|
const keyName = applyNamespaceToKeyName(
|
|
131
121
|
key,
|
|
132
122
|
namespace || DEFAULT_NAMESPACE
|
|
@@ -146,10 +136,7 @@ export function getStorageModule(type: string): StorageI {
|
|
|
146
136
|
* @param {?String} namespace
|
|
147
137
|
* @returns {Promise<Any|Error>}
|
|
148
138
|
*/
|
|
149
|
-
function getItem(
|
|
150
|
-
key: string,
|
|
151
|
-
namespace: ?string = DEFAULT_NAMESPACE
|
|
152
|
-
): Promise<any> {
|
|
139
|
+
function getItem(key, namespace = DEFAULT_NAMESPACE) {
|
|
153
140
|
const keyName = applyNamespaceToKeyName(
|
|
154
141
|
key,
|
|
155
142
|
namespace || DEFAULT_NAMESPACE
|
|
@@ -165,7 +152,7 @@ export function getStorageModule(type: string): StorageI {
|
|
|
165
152
|
* @param {?String} namespace
|
|
166
153
|
* @returns {Promise<Boolean|Error>}
|
|
167
154
|
*/
|
|
168
|
-
function removeItem(key
|
|
155
|
+
function removeItem(key, namespace = DEFAULT_NAMESPACE) {
|
|
169
156
|
const keyName = applyNamespaceToKeyName(key, namespace);
|
|
170
157
|
|
|
171
158
|
return tryAndResolve(() => Storage.callMethod("removeItem", keyName));
|
|
@@ -176,7 +163,7 @@ export function getStorageModule(type: string): StorageI {
|
|
|
176
163
|
* @param {?String} namespace
|
|
177
164
|
* @returns {Promise<Object|Error>}
|
|
178
165
|
*/
|
|
179
|
-
function getAllItems(namespace
|
|
166
|
+
function getAllItems(namespace = null) {
|
|
180
167
|
return tryAndResolve(() => {
|
|
181
168
|
const keys = Storage.getKeys();
|
|
182
169
|
|
package/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/// <reference types="@applicaster/applicaster-types" />
|
|
2
2
|
import * as R from "ramda";
|
|
3
|
-
import { useHistory, useLocation } from "react-router-dom";
|
|
4
3
|
|
|
5
4
|
import { createQuickBrickApp } from "@applicaster/quick-brick-core";
|
|
6
5
|
import * as QuickBrickManager from "@applicaster/zapp-react-native-bridge/QuickBrick";
|
|
7
6
|
import * as Contexts from "@applicaster/zapp-react-native-ui-components/Contexts";
|
|
8
7
|
import { OfflineHandler } from "@applicaster/zapp-react-native-ui-components/Components/OfflineHandler";
|
|
9
8
|
import { getXray } from "@applicaster/zapp-react-native-utils/logger";
|
|
10
|
-
import { ZappDomRouter } from "./App/Router";
|
|
11
9
|
import { Layout } from "./App/Layout";
|
|
12
10
|
import { SplashLoader } from "./App/Loader/SplashLoader";
|
|
13
11
|
import { appLoader } from "./App/Loader";
|
|
@@ -24,11 +22,6 @@ const contextProviders = R.map(R.prop("withProvider"), R.values(Contexts));
|
|
|
24
22
|
if (withXray) contextProviders.push(withXray);
|
|
25
23
|
|
|
26
24
|
export const ZappApp = createQuickBrickApp({
|
|
27
|
-
navigations: {
|
|
28
|
-
Router: ZappDomRouter,
|
|
29
|
-
useLocation,
|
|
30
|
-
useHistory,
|
|
31
|
-
},
|
|
32
25
|
QuickBrickManager,
|
|
33
26
|
Layout,
|
|
34
27
|
OfflineHandler,
|
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.1035032144",
|
|
4
4
|
"description": "Zapp App Component for Applicaster's Quick Brick React Native App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,13 +22,12 @@
|
|
|
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.1035032144",
|
|
26
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1035032144",
|
|
27
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.1035032144",
|
|
28
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.1035032144",
|
|
29
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.1035032144",
|
|
30
30
|
"abortcontroller-polyfill": "^1.7.5",
|
|
31
|
-
"history": "^4.7.2",
|
|
32
31
|
"react-router-dom": "^5.1.2",
|
|
33
32
|
"typeface-montserrat": "^0.0.54",
|
|
34
33
|
"video.js": "7.14.3",
|
|
@@ -36,9 +35,19 @@
|
|
|
36
35
|
"videojs-contrib-quality-levels": "3.0.0"
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
|
38
|
+
"@applicaster/zapp-pipes-v2-client": "*",
|
|
39
|
+
"@react-native-community/netinfo": "*",
|
|
40
|
+
"@types/node": "*",
|
|
39
41
|
"core-js": "3.29.1",
|
|
42
|
+
"immer": "*",
|
|
40
43
|
"react": "17.0.2",
|
|
41
44
|
"react-dom": "17.0.2",
|
|
42
|
-
"react-native
|
|
45
|
+
"react-native": "*",
|
|
46
|
+
"react-native-safe-area-context": "*",
|
|
47
|
+
"react-native-svg": "*",
|
|
48
|
+
"react-native-web": "0.18.11",
|
|
49
|
+
"uglify-js": "*",
|
|
50
|
+
"validate-color": "*",
|
|
51
|
+
"zustand": "*"
|
|
43
52
|
}
|
|
44
53
|
}
|
package/App/Router/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
import { Router } from "react-router";
|
|
6
|
-
import { createMemoryHistory } from "history";
|
|
7
|
-
|
|
8
|
-
type Props = {
|
|
9
|
-
children: any;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const history = createMemoryHistory();
|
|
13
|
-
|
|
14
|
-
export const ZappDomRouter = ({ children, ...otherProps }: Props) => (
|
|
15
|
-
<Router history={history} {...otherProps}>
|
|
16
|
-
{children}
|
|
17
|
-
</Router>
|
|
18
|
-
);
|