@24i/bigscreen-sdk 1.0.11 → 1.0.12-alpha.2254
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/package.json +7 -7
- package/packages/developer-tools/src/DeveloperToolsService/DeveloperToolsList.tsx +11 -0
- package/packages/device/src/getKeyDigit.ts +2 -2
- package/packages/driver-androidtv/src/DeviceAndroidTV.ts +3 -1
- package/packages/driver-androidtv/src/keymap.ts +14 -1
- package/packages/driver-xbox/src/keymap.ts +1 -1
- package/packages/epg/src/v2/DataManager.ts +5 -2
- package/packages/jsx/src/index.ts +1 -1
- package/packages/router/src/Route.tsx +14 -0
- package/packages/router/src/history.ts +8 -1
- package/packages/router/src/index.ts +1 -1
- package/packages/utils/src/wait.ts +3 -1
- package/packages/utils/src/xhr/xhrSendRetry.ts +3 -1
- package/packages/zapping/src/ChannelZapping.ts +9 -0
- package/packages/zapping/src/Zapping.tsx +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@24i/bigscreen-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12-alpha.2254",
|
|
4
4
|
"description": "SmartApps BIGscreen SDK monorepo",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@types/prop-types": "^15.7.5",
|
|
45
45
|
"@types/scheduler": "^0.16.2",
|
|
46
46
|
"csstype": "^3.1.1",
|
|
47
|
-
"lottie-web": "5.
|
|
47
|
+
"lottie-web": "5.10.2",
|
|
48
48
|
"prop-types": "^15.8.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
@@ -53,31 +53,31 @@
|
|
|
53
53
|
"@24i/smartapps-bigscreen-changelog-generator": "0.17.0",
|
|
54
54
|
"@babel/core": "^7.19.0",
|
|
55
55
|
"@babel/preset-env": "^7.20.2",
|
|
56
|
-
"@types/fs-extra": "^
|
|
56
|
+
"@types/fs-extra": "^11.0.1",
|
|
57
57
|
"@types/inquirer": "^9.0.3",
|
|
58
58
|
"@types/jest": "^29.2.3",
|
|
59
59
|
"@types/minimist": "^1.2.2",
|
|
60
60
|
"@types/node": "^18.7.18",
|
|
61
61
|
"@types/react": "^18.0.26",
|
|
62
|
-
"babel-jest": "^29.
|
|
62
|
+
"babel-jest": "^29.4.1",
|
|
63
63
|
"chalk": "^5.2.0",
|
|
64
64
|
"coveralls": "^3.1.1",
|
|
65
65
|
"cross-env": "^7.0.3",
|
|
66
|
-
"fs-extra": "^
|
|
66
|
+
"fs-extra": "^11.1.0",
|
|
67
67
|
"full-icu": "^1.5.0",
|
|
68
68
|
"identity-obj-proxy": "^3.0.0",
|
|
69
69
|
"inquirer": "^9.1.4",
|
|
70
70
|
"jest": "^29.3.1",
|
|
71
71
|
"jest-canvas-mock": "^2.4.0",
|
|
72
72
|
"jest-environment-jsdom": "^29.0.3",
|
|
73
|
-
"minimist": "^1.2.
|
|
73
|
+
"minimist": "^1.2.7",
|
|
74
74
|
"patch-package": "^6.5.0",
|
|
75
75
|
"sass": "^1.54.9",
|
|
76
76
|
"sass-true": "^6.1.0",
|
|
77
77
|
"ts-jest": "^29.0.3",
|
|
78
78
|
"ts-node": "^10.9.1",
|
|
79
79
|
"tsconfig-paths-jest": "0.0.1",
|
|
80
|
-
"typescript": "^4.
|
|
80
|
+
"typescript": "^4.9.5"
|
|
81
81
|
},
|
|
82
82
|
"exports": {
|
|
83
83
|
"./adobe-heartbeat": "./packages/adobe-heartbeat/src/index.ts",
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { BACK } from '@24i/bigscreen-sdk/device/keymap';
|
|
8
8
|
import { DISPLAY_NONE, getDisplayToggler, stopEvent } from '@24i/bigscreen-sdk/utils';
|
|
9
9
|
import { map } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
10
|
+
import { Storage } from '@24i/bigscreen-sdk/storage';
|
|
10
11
|
import { IDeveloperTool, DeveloperToolProps } from '../IDeveloperTool';
|
|
11
12
|
import { DeveloperToolItem } from './DeveloperToolItem';
|
|
12
13
|
import { reloadApp } from '../utils/reload';
|
|
@@ -39,6 +40,11 @@ export class DeveloperToolsList extends Component<Props> {
|
|
|
39
40
|
reloadApp();
|
|
40
41
|
};
|
|
41
42
|
|
|
43
|
+
async onClearDataToolPress() {
|
|
44
|
+
await Storage.clear();
|
|
45
|
+
reloadApp();
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
onKeyDown = (event: KeyboardEvent) => {
|
|
43
49
|
if (BACK.is(event)) {
|
|
44
50
|
const { onBack } = this.props;
|
|
@@ -90,6 +96,11 @@ export class DeveloperToolsList extends Component<Props> {
|
|
|
90
96
|
/>
|
|
91
97
|
);
|
|
92
98
|
})}
|
|
99
|
+
<DeveloperToolItem
|
|
100
|
+
ref={this.getNavigationRef()}
|
|
101
|
+
label="Clear data"
|
|
102
|
+
onPress={this.onClearDataToolPress}
|
|
103
|
+
/>
|
|
93
104
|
<DeveloperToolItem
|
|
94
105
|
ref={this.getNavigationRef()}
|
|
95
106
|
label="Restart app"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { KeycodeKeyMap } from '@24i/bigscreen-sdk/driver-base';
|
|
2
2
|
|
|
3
3
|
export const createGetKeyDigit = (
|
|
4
|
-
getKeyMap: () => Partial<KeycodeKeyMap
|
|
5
|
-
|
|
4
|
+
getKeyMap: () => Partial<KeycodeKeyMap>,
|
|
5
|
+
): (event: KeyboardEvent) => number | undefined => {
|
|
6
6
|
const {
|
|
7
7
|
NUM_0, NUM_1, NUM_2, NUM_3, NUM_4, NUM_5, NUM_6, NUM_7, NUM_8, NUM_9,
|
|
8
8
|
KP_0, KP_1, KP_2, KP_3, KP_4, KP_5, KP_6, KP_7, KP_8, KP_9,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from '@24i/bigscreen-sdk/driver-base';
|
|
7
7
|
import { IJavaScriptBridge, DeviceInfo } from './types';
|
|
8
8
|
import { getFirmware } from './formatUserAgent';
|
|
9
|
-
import { getKeyMap } from './keymap';
|
|
9
|
+
import { getKeyMap, AndroidKeyMap } from './keymap';
|
|
10
10
|
|
|
11
11
|
interface CustomKeyboardEvent extends KeyboardEvent {
|
|
12
12
|
/** Flag indicating that the driver has already re-emitted this event. */
|
|
@@ -69,6 +69,8 @@ export class DeviceAndroidTV extends DeviceBase {
|
|
|
69
69
|
if (key === 'ColorF2Yellow') keyCode = this.keyMap.YELLOW;
|
|
70
70
|
if (key === 'ColorF3Blue') keyCode = this.keyMap.BLUE;
|
|
71
71
|
if (key === 'ClosedCaptionToggle') keyCode = this.keyMap.SUBTITLES;
|
|
72
|
+
if (keyCode === AndroidKeyMap.STOP) keyCode = this.keyMap.STOP;
|
|
73
|
+
if (keyCode === AndroidKeyMap.PAUSE) keyCode = this.keyMap.PAUSE;
|
|
72
74
|
|
|
73
75
|
if (keyCode === this.keyMap.BACK
|
|
74
76
|
|| keyCode === this.keyMap.STOP
|
|
@@ -4,11 +4,24 @@ import { KeyMap } from '@24i/bigscreen-sdk/driver-base';
|
|
|
4
4
|
export const getKeyMap = () => {
|
|
5
5
|
KeyMap.overrideValues({
|
|
6
6
|
BACK: { keyCode: 4 },
|
|
7
|
-
STOP: { keyCode:
|
|
7
|
+
STOP: { keyCode: 86 },
|
|
8
8
|
FF: { keyCode: 90 },
|
|
9
9
|
REW: { keyCode: 89 },
|
|
10
10
|
PLAY: { keyCode: 126 },
|
|
11
|
+
PAUSE: { keyCode: 127 },
|
|
12
|
+
PLAYPAUSE: { keyCode: 85 },
|
|
11
13
|
SUBTITLES: { keyCode: 175 },
|
|
12
14
|
});
|
|
13
15
|
return KeyMap.generateKeyCodeKeyMap();
|
|
14
16
|
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* For the specific AndroidTV devices like Sony Bravia or Nvidia Shield
|
|
20
|
+
* there are different KeyCodes for some buttons than on other platforms.
|
|
21
|
+
* In that case we need to re-map this specific KeyCodes to the
|
|
22
|
+
* same values as we using in generic KeyMap list for the AndroidTV.
|
|
23
|
+
*/
|
|
24
|
+
export const AndroidKeyMap = {
|
|
25
|
+
STOP: 178,
|
|
26
|
+
PAUSE: 85,
|
|
27
|
+
};
|
|
@@ -356,10 +356,13 @@ export class DataManager implements IDataManager {
|
|
|
356
356
|
const current = data[i];
|
|
357
357
|
const previous = data[i - 1];
|
|
358
358
|
if (previous.program!.endTime < current.program!.startTime) {
|
|
359
|
-
data.splice(
|
|
359
|
+
data.splice(
|
|
360
|
+
i,
|
|
361
|
+
0,
|
|
360
362
|
this.generateNoDataProgram(
|
|
361
363
|
previous.program!.endTime, current.program!.startTime,
|
|
362
|
-
)
|
|
364
|
+
),
|
|
365
|
+
);
|
|
363
366
|
}
|
|
364
367
|
}
|
|
365
368
|
}
|
|
@@ -27,5 +27,5 @@ export type {
|
|
|
27
27
|
ClassComponentInterface,
|
|
28
28
|
DeclareProps,
|
|
29
29
|
} from './types';
|
|
30
|
-
// eslint-disable-next-line import/no-default-export
|
|
30
|
+
// eslint-disable-next-line import/no-default-export, no-restricted-exports
|
|
31
31
|
export { createElement as default } from './virtualDOM';
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
replaceNode,
|
|
7
7
|
} from '@24i/bigscreen-sdk/jsx';
|
|
8
8
|
import { filter, forEach } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
9
|
+
import { addClass, removeClass } from '@24i/bigscreen-sdk/utils';
|
|
10
|
+
import { menuService } from '@24i/bigscreen-sdk/menu';
|
|
9
11
|
import { getCurrentHash } from './utils';
|
|
10
12
|
import { IRoute, RouteParams } from './types';
|
|
11
13
|
|
|
@@ -17,6 +19,8 @@ type Props = {
|
|
|
17
19
|
Component: Function,
|
|
18
20
|
};
|
|
19
21
|
|
|
22
|
+
const MRCU_DISABLED = 'mrcu-disabled';
|
|
23
|
+
|
|
20
24
|
export class Route extends Component<Props> {
|
|
21
25
|
wasCreated = false;
|
|
22
26
|
|
|
@@ -49,7 +53,16 @@ export class Route extends Component<Props> {
|
|
|
49
53
|
return {};
|
|
50
54
|
}
|
|
51
55
|
|
|
56
|
+
onMenuVisibilityChange = (isVisible: boolean) => {
|
|
57
|
+
if (isVisible) {
|
|
58
|
+
addClass(this.domRef, MRCU_DISABLED);
|
|
59
|
+
} else {
|
|
60
|
+
removeClass(this.domRef, MRCU_DISABLED);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
52
64
|
show() {
|
|
65
|
+
menuService.addEventListener('visibilitychange', this.onMenuVisibilityChange);
|
|
53
66
|
this.showRoute();
|
|
54
67
|
if (!this.wasCreated) {
|
|
55
68
|
this.mountRoute();
|
|
@@ -60,6 +73,7 @@ export class Route extends Component<Props> {
|
|
|
60
73
|
}
|
|
61
74
|
|
|
62
75
|
hide() {
|
|
76
|
+
menuService.removeEventListener('visibilitychange', this.onMenuVisibilityChange);
|
|
63
77
|
if (this.wasCreated) {
|
|
64
78
|
this.component.current?.deactivate();
|
|
65
79
|
this.hideRoute();
|
|
@@ -2,8 +2,10 @@ import { NavigationConfig } from './types';
|
|
|
2
2
|
|
|
3
3
|
export const history: string[] = [];
|
|
4
4
|
|
|
5
|
+
const pathWithHash = (path:string) => `#${path}`;
|
|
6
|
+
|
|
5
7
|
const navigate = (path: string) => {
|
|
6
|
-
window.location.href =
|
|
8
|
+
window.location.href = pathWithHash(path);
|
|
7
9
|
};
|
|
8
10
|
|
|
9
11
|
export const go = (path: string, { skipHistory, replaceHistory }: NavigationConfig = {}) => {
|
|
@@ -22,3 +24,8 @@ export const back = () => {
|
|
|
22
24
|
export const clearHistory = () => {
|
|
23
25
|
history.length = 0;
|
|
24
26
|
};
|
|
27
|
+
|
|
28
|
+
export const replaceState = (path: string) => {
|
|
29
|
+
history[history.length - 1] = path;
|
|
30
|
+
window.history.replaceState(null, '', pathWithHash(path));
|
|
31
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Router } from './Router';
|
|
2
2
|
export { Route } from './Route';
|
|
3
3
|
export type { IRoute } from './types';
|
|
4
|
-
export { history, go, back, clearHistory } from './history';
|
|
4
|
+
export { history, go, back, clearHistory, replaceState } from './history';
|
|
5
5
|
export { focusActiveRoute } from './focusActiveRoute';
|
|
6
6
|
export { fromSafeUrl, toSafeUrl } from './utils';
|
|
@@ -68,7 +68,9 @@ Promise<XhrResponse | TypeError> {
|
|
|
68
68
|
const shouldRetryFn = config.shouldRetry || defaultRetryConfig.shouldRetry;
|
|
69
69
|
const shouldRetry = shouldRetryFn({ options, response, error });
|
|
70
70
|
if (shouldRetry) {
|
|
71
|
-
await new Promise((res) =>
|
|
71
|
+
await new Promise((res) => {
|
|
72
|
+
window.setTimeout(res, config.retryDelay);
|
|
73
|
+
});
|
|
72
74
|
config.currentRetryAttempt += 1;
|
|
73
75
|
return xhrSendRetry(url, options);
|
|
74
76
|
}
|
|
@@ -99,6 +99,15 @@ export class ChannelZapping<T extends Asset = Asset> {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Updates the current index of channel zapping.
|
|
104
|
+
* @param channels the array of all channels
|
|
105
|
+
* @param currentChannel currently active channel
|
|
106
|
+
*/
|
|
107
|
+
onUpdate(channels: T[], currentChannel: T) {
|
|
108
|
+
this.currentIndex = getCurrentChannelIndex(channels, currentChannel);
|
|
109
|
+
}
|
|
110
|
+
|
|
102
111
|
/**
|
|
103
112
|
* Changes to the next/previous channel.
|
|
104
113
|
* @param direction direction of the change
|
|
@@ -96,10 +96,20 @@ export class Zapping<T extends Asset = Asset> extends Component<Props<T>> {
|
|
|
96
96
|
this.channelZapping!.onKeyDown(event);
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Updates channel zapping with new data.
|
|
101
|
+
* @param channels the array of all channels
|
|
102
|
+
* @param currentChannel currently active channel
|
|
103
|
+
*/
|
|
104
|
+
onUpdate(channels: T[], currentChannel: T) {
|
|
105
|
+
this.channelZapping!.onUpdate(channels, currentChannel);
|
|
106
|
+
}
|
|
107
|
+
|
|
99
108
|
render() {
|
|
100
109
|
const { numericZapper } = this.props;
|
|
101
110
|
return numericZapper
|
|
102
111
|
? <NumericZapper {...numericZapper} ref={zapperServiceRef} />
|
|
112
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
103
113
|
: <></>;
|
|
104
114
|
}
|
|
105
115
|
}
|