@applicaster/zapp-react-dom-app 12.0.2 → 13.0.0-alpha.1102149799
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 +3 -1
- package/App/Loader/SplashLoader.js +8 -7
- package/App/Loader/loadSessionStorageData.js +0 -1
- package/App/Loader/utils/platform.js +46 -27
- 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 +17 -7
|
@@ -451,7 +451,9 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
451
451
|
const isHookInHomescreen = entryData?.payload?.home;
|
|
452
452
|
|
|
453
453
|
const isHookFlowBlocker =
|
|
454
|
-
entryData?.hookPlugin?.module?.isFlowBlocker
|
|
454
|
+
typeof entryData?.hookPlugin?.module?.isFlowBlocker === "function"
|
|
455
|
+
? entryData?.hookPlugin?.module?.isFlowBlocker()
|
|
456
|
+
: entryData?.hookPlugin?.module?.isFlowBlocker;
|
|
455
457
|
|
|
456
458
|
if (isHookInHomescreen && isHookFlowBlocker) {
|
|
457
459
|
this.platformBack();
|
|
@@ -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,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/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.1102149799",
|
|
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.1102149799",
|
|
26
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1102149799",
|
|
27
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.1102149799",
|
|
28
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.1102149799",
|
|
29
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.1102149799",
|
|
30
30
|
"abortcontroller-polyfill": "^1.7.5",
|
|
31
31
|
"history": "^4.7.2",
|
|
32
32
|
"react-router-dom": "^5.1.2",
|
|
@@ -36,9 +36,19 @@
|
|
|
36
36
|
"videojs-contrib-quality-levels": "3.0.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
+
"@applicaster/zapp-pipes-v2-client": "*",
|
|
40
|
+
"@react-native-community/netinfo": "*",
|
|
41
|
+
"@types/node": "*",
|
|
39
42
|
"core-js": "3.29.1",
|
|
43
|
+
"immer": "*",
|
|
40
44
|
"react": "17.0.2",
|
|
41
45
|
"react-dom": "17.0.2",
|
|
42
|
-
"react-native
|
|
46
|
+
"react-native": "*",
|
|
47
|
+
"react-native-safe-area-context": "*",
|
|
48
|
+
"react-native-svg": "*",
|
|
49
|
+
"react-native-web": "0.18.11",
|
|
50
|
+
"uglify-js": "*",
|
|
51
|
+
"validate-color": "*",
|
|
52
|
+
"zustand": "*"
|
|
43
53
|
}
|
|
44
54
|
}
|