@applicaster/zapp-react-dom-app 13.0.0-alpha.9270615060 → 13.0.0-alpha.9433330286
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 +26 -41
- package/App/Loader/utils/platform.js +46 -26
- package/package.json +6 -6
|
@@ -23,6 +23,8 @@ 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
|
+
|
|
26
28
|
import {
|
|
27
29
|
DISPLAY_STATES,
|
|
28
30
|
DisplayStateContext,
|
|
@@ -46,7 +48,6 @@ import {
|
|
|
46
48
|
|
|
47
49
|
import { OnScreenKeyboard } from "@applicaster/zapp-react-dom-ui-components/Components/OnScreenKeyboard";
|
|
48
50
|
import { KeyboardLongPressManager } from "@applicaster/zapp-react-dom-ui-components/Utils/KeyboardLongPressManager";
|
|
49
|
-
import { KeyInputHandler } from "@applicaster/zapp-react-native-utils/appUtils/keyInputHandler/KeyInputHandler";
|
|
50
51
|
|
|
51
52
|
const { withXray } = getXray();
|
|
52
53
|
const globalAny: any = global;
|
|
@@ -61,6 +62,14 @@ type Props = {
|
|
|
61
62
|
navigator: QuickBrickAppNavigator;
|
|
62
63
|
rivers: {};
|
|
63
64
|
xray: XRayContext;
|
|
65
|
+
seekMethods: {
|
|
66
|
+
onRewindPress: () => void;
|
|
67
|
+
onRewindLongPress: () => void;
|
|
68
|
+
onForwardPress: () => void;
|
|
69
|
+
onForwardLongPress: () => void;
|
|
70
|
+
onRewindPressOut: () => void;
|
|
71
|
+
onForwardPressOut: () => void;
|
|
72
|
+
};
|
|
64
73
|
confirmDialog: typeof confirmationDialogStore;
|
|
65
74
|
};
|
|
66
75
|
|
|
@@ -172,11 +181,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
172
181
|
|
|
173
182
|
window.addEventListener("onLongPress", this.handleLongPress.bind(this));
|
|
174
183
|
|
|
175
|
-
window.addEventListener(
|
|
176
|
-
"onPressRelease",
|
|
177
|
-
this.handleLongPressRelease.bind(this)
|
|
178
|
-
);
|
|
179
|
-
|
|
180
184
|
window.addEventListener(
|
|
181
185
|
"onLongPressRelease",
|
|
182
186
|
this.handleLongPressRelease.bind(this)
|
|
@@ -341,8 +345,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
341
345
|
}
|
|
342
346
|
|
|
343
347
|
onKeyDown(event) {
|
|
344
|
-
// console.log("Anton: event", event);
|
|
345
|
-
// debugger;
|
|
346
348
|
const { displayState, setDisplayState, navigator } = this.props;
|
|
347
349
|
const { isKeyboardVisible } = this.state;
|
|
348
350
|
|
|
@@ -370,7 +372,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
370
372
|
When the player is displayed, we listen to Native Play / Pause / Stop
|
|
371
373
|
buttons. Any other key press will display the transport controls
|
|
372
374
|
*/
|
|
373
|
-
|
|
374
375
|
if (
|
|
375
376
|
displayState === DISPLAY_STATES.PLAYER ||
|
|
376
377
|
displayState === DISPLAY_STATES.HUD
|
|
@@ -403,22 +404,16 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
403
404
|
return;
|
|
404
405
|
}
|
|
405
406
|
|
|
406
|
-
if (
|
|
407
|
-
keyCode(event).matches(KEYS.Forward) ||
|
|
408
|
-
keyCode(event).matches(KEYS.C)
|
|
409
|
-
) {
|
|
407
|
+
if (keyCode(event).matches(KEYS.Forward)) {
|
|
410
408
|
setDisplayState(DISPLAY_STATES.HUD);
|
|
411
|
-
|
|
409
|
+
this.props.seekMethods.onForwardPress();
|
|
412
410
|
|
|
413
411
|
return;
|
|
414
412
|
}
|
|
415
413
|
|
|
416
|
-
if (
|
|
417
|
-
keyCode(event).matches(KEYS.Rewind) ||
|
|
418
|
-
keyCode(event).matches(KEYS.Z)
|
|
419
|
-
) {
|
|
414
|
+
if (keyCode(event).matches(KEYS.Rewind)) {
|
|
420
415
|
setDisplayState(DISPLAY_STATES.HUD);
|
|
421
|
-
|
|
416
|
+
this.props.seekMethods.onRewindPress();
|
|
422
417
|
|
|
423
418
|
return;
|
|
424
419
|
}
|
|
@@ -456,7 +451,9 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
456
451
|
const isHookInHomescreen = entryData?.payload?.home;
|
|
457
452
|
|
|
458
453
|
const isHookFlowBlocker =
|
|
459
|
-
entryData?.hookPlugin?.module?.isFlowBlocker
|
|
454
|
+
typeof entryData?.hookPlugin?.module?.isFlowBlocker === "function"
|
|
455
|
+
? entryData?.hookPlugin?.module?.isFlowBlocker()
|
|
456
|
+
: entryData?.hookPlugin?.module?.isFlowBlocker;
|
|
460
457
|
|
|
461
458
|
if (isHookInHomescreen && isHookFlowBlocker) {
|
|
462
459
|
this.platformBack();
|
|
@@ -478,7 +475,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
478
475
|
}
|
|
479
476
|
}
|
|
480
477
|
|
|
481
|
-
if (keyCode(event).matches(KEYS.Enter)
|
|
478
|
+
if (keyCode(event).matches(KEYS.Enter)) {
|
|
482
479
|
if (displayState === DISPLAY_STATES.PLAYER) {
|
|
483
480
|
setDisplayState(DISPLAY_STATES.HUD);
|
|
484
481
|
} else {
|
|
@@ -704,18 +701,14 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
704
701
|
|
|
705
702
|
switch (keyCode) {
|
|
706
703
|
case KEYS.Forward.code:
|
|
707
|
-
|
|
708
|
-
playbackState && KeyInputHandler.getInstance().onForwardLongPress();
|
|
709
|
-
|
|
704
|
+
playbackState && this.props.seekMethods.onForwardLongPress();
|
|
710
705
|
break;
|
|
711
706
|
|
|
712
707
|
case KEYS.Rewind.code:
|
|
713
|
-
|
|
714
|
-
playbackState && KeyInputHandler.getInstance().onRewindLongPress();
|
|
708
|
+
playbackState && this.props.seekMethods.onRewindLongPress();
|
|
715
709
|
break;
|
|
716
710
|
|
|
717
711
|
case KEYS.Enter.code:
|
|
718
|
-
case KEYS.X.code:
|
|
719
712
|
focusManager.longPress();
|
|
720
713
|
break;
|
|
721
714
|
}
|
|
@@ -725,35 +718,26 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
725
718
|
const { keyCode } = event.detail;
|
|
726
719
|
this.longPressActive = false;
|
|
727
720
|
this.resetHudTimeout();
|
|
728
|
-
// debugger;
|
|
729
721
|
|
|
730
722
|
switch (keyCode) {
|
|
731
723
|
case KEYS.Forward.code:
|
|
732
|
-
|
|
733
|
-
KeyInputHandler.getInstance().onForwardPressOut();
|
|
724
|
+
this.props.seekMethods.onForwardPressOut();
|
|
734
725
|
break;
|
|
735
726
|
|
|
736
727
|
case KEYS.Rewind.code:
|
|
737
|
-
|
|
738
|
-
KeyInputHandler.getInstance().onRewindPressOut();
|
|
728
|
+
this.props.seekMethods.onRewindPressOut();
|
|
739
729
|
break;
|
|
740
730
|
|
|
741
731
|
case KEYS.Enter.code:
|
|
742
|
-
case KEYS.X.code:
|
|
743
732
|
focusManager.pressOut();
|
|
744
733
|
break;
|
|
745
734
|
}
|
|
746
735
|
};
|
|
747
736
|
|
|
748
737
|
private keySupportsLongPress(event: KeyboardEvent): boolean {
|
|
749
|
-
return [
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
KEYS.Enter.code,
|
|
753
|
-
KEYS.Z.code,
|
|
754
|
-
KEYS.X.code,
|
|
755
|
-
KEYS.C.code,
|
|
756
|
-
].includes(event.code);
|
|
738
|
+
return [KEYS.Forward.code, KEYS.Rewind.code, KEYS.Enter.code].includes(
|
|
739
|
+
event.code
|
|
740
|
+
);
|
|
757
741
|
}
|
|
758
742
|
|
|
759
743
|
render() {
|
|
@@ -772,6 +756,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
772
756
|
|
|
773
757
|
export const InteractionManager = R.compose(
|
|
774
758
|
withNavigator,
|
|
759
|
+
withUseSeek,
|
|
775
760
|
withXray,
|
|
776
761
|
connectToStore(R.pick(["rivers"])),
|
|
777
762
|
PlayerContentContext.withConsumer,
|
|
@@ -11,11 +11,28 @@ import {
|
|
|
11
11
|
PLATFORMS,
|
|
12
12
|
} from "./const";
|
|
13
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
|
+
*/
|
|
14
23
|
export const getUserAgent = () =>
|
|
15
24
|
window?.navigator?.userAgent || global?.navigator?.userAgent;
|
|
16
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the device is HD (1280 width).
|
|
28
|
+
* @returns {boolean} True if the device is HD, false otherwise.
|
|
29
|
+
*/
|
|
17
30
|
export const isHD = () => window.innerWidth === 1280;
|
|
18
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Checks if the platform is LG.
|
|
34
|
+
* @returns {boolean} True if the platform is LG, false otherwise.
|
|
35
|
+
*/
|
|
19
36
|
export const isLgPlatform = () => {
|
|
20
37
|
const userAgent = getUserAgent();
|
|
21
38
|
|
|
@@ -23,10 +40,13 @@ export const isLgPlatform = () => {
|
|
|
23
40
|
return false;
|
|
24
41
|
}
|
|
25
42
|
|
|
26
|
-
// Note: LG uses the number 0 in their userAgent, possibly because of Palm WebOS
|
|
27
43
|
return hasWebOS || userAgent.includes(PLATFORMS.webos);
|
|
28
44
|
};
|
|
29
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Checks if the platform is Samsung.
|
|
48
|
+
* @returns {boolean} True if the platform is Samsung, false otherwise.
|
|
49
|
+
*/
|
|
30
50
|
export const isSamsungPlatform = () => {
|
|
31
51
|
const userAgent = getUserAgent();
|
|
32
52
|
|
|
@@ -42,42 +62,39 @@ export const isSamsungPlatform = () => {
|
|
|
42
62
|
};
|
|
43
63
|
|
|
44
64
|
/**
|
|
45
|
-
* Checks if
|
|
46
|
-
*
|
|
47
|
-
* Use this method when you need to identify the platform on runtime
|
|
48
|
-
* 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.
|
|
49
67
|
*/
|
|
50
68
|
export const isVizioPlatform = () => {
|
|
51
69
|
const userAgent = getUserAgent();
|
|
52
70
|
|
|
53
|
-
|
|
71
|
+
return (
|
|
54
72
|
userAgent.includes(PLATFORMS.vizio) ||
|
|
55
73
|
userAgent.includes(PLATFORMS.smartcast) ||
|
|
56
|
-
userAgent.includes(PLATFORMS.conjure)
|
|
57
|
-
|
|
58
|
-
return isVizioAgent;
|
|
74
|
+
userAgent.includes(PLATFORMS.conjure)
|
|
75
|
+
);
|
|
59
76
|
};
|
|
60
77
|
|
|
61
78
|
/**
|
|
62
|
-
* Checks if
|
|
63
|
-
*
|
|
64
|
-
* 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.
|
|
65
81
|
*/
|
|
66
82
|
export const hasVizioAPIs = () => {
|
|
67
|
-
|
|
83
|
+
return (
|
|
68
84
|
typeof window.VIZIO !== "undefined" &&
|
|
69
|
-
window?.applicaster?.vizioLibraryDidLoad
|
|
70
|
-
|
|
71
|
-
return hasAPIs;
|
|
85
|
+
window?.applicaster?.vizioLibraryDidLoad
|
|
86
|
+
);
|
|
72
87
|
};
|
|
73
88
|
|
|
74
89
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* @returns {"tv" | "web" | "other"} value
|
|
90
|
+
* Determines the device type based on the platform.
|
|
91
|
+
* @returns {DeviceType} The device type ("tv", "web", or "other").
|
|
78
92
|
*/
|
|
79
93
|
export const getDeviceType = () => {
|
|
80
|
-
|
|
94
|
+
/** @type {CustomPlatformTypes} */
|
|
95
|
+
const platformOS = Platform.OS;
|
|
96
|
+
|
|
97
|
+
switch (platformOS) {
|
|
81
98
|
case "samsung_tv":
|
|
82
99
|
return isSamsungPlatform() ? "tv" : "web";
|
|
83
100
|
case "lg_tv":
|
|
@@ -88,14 +105,15 @@ export const getDeviceType = () => {
|
|
|
88
105
|
};
|
|
89
106
|
|
|
90
107
|
/**
|
|
91
|
-
*
|
|
92
|
-
* @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.
|
|
93
111
|
*/
|
|
94
112
|
export const renameKeys = (key) => desiredKeysMap?.[key] || key;
|
|
95
113
|
|
|
96
114
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
115
|
+
* Retrieves the connection info from WebOS.
|
|
116
|
+
* @returns {Promise<{networkType: string} | null>} A promise that resolves with the connection info or null.
|
|
99
117
|
*/
|
|
100
118
|
export const getWebOSConnectionInfo = () => {
|
|
101
119
|
return new Promise((resolve, reject) => {
|
|
@@ -108,7 +126,6 @@ export const getWebOSConnectionInfo = () => {
|
|
|
108
126
|
webOS.service.request("luna://com.palm.connectionmanager", {
|
|
109
127
|
method: "getStatus",
|
|
110
128
|
parameters: { subscribe: false },
|
|
111
|
-
|
|
112
129
|
onSuccess: (args) => {
|
|
113
130
|
const types = Object.keys(args)
|
|
114
131
|
.filter((key) => args[key].state === "connected")
|
|
@@ -116,7 +133,6 @@ export const getWebOSConnectionInfo = () => {
|
|
|
116
133
|
|
|
117
134
|
resolve({ networkType: types });
|
|
118
135
|
},
|
|
119
|
-
|
|
120
136
|
onFailure: (error) => {
|
|
121
137
|
console.error(
|
|
122
138
|
"getWebOSConnectionInfo: There was an error getting connection info",
|
|
@@ -129,6 +145,10 @@ export const getWebOSConnectionInfo = () => {
|
|
|
129
145
|
});
|
|
130
146
|
};
|
|
131
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
|
+
*/
|
|
132
152
|
export const getTizenConnectionInfo = () => {
|
|
133
153
|
return new Promise((resolve, reject) => {
|
|
134
154
|
if (!isSamsungPlatform) {
|
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.9433330286",
|
|
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.9433330286",
|
|
26
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.9433330286",
|
|
27
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.9433330286",
|
|
28
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.9433330286",
|
|
29
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.9433330286",
|
|
30
30
|
"abortcontroller-polyfill": "^1.7.5",
|
|
31
31
|
"history": "^4.7.2",
|
|
32
32
|
"react-router-dom": "^5.1.2",
|