@24i/bigscreen-sdk 1.0.2-alpha.2078 → 1.0.2-alpha.2089
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 +2 -2
- package/packages/developer-tools/src/TechnicalInfo/styles/TechnicalInfo.scss +1 -0
- package/packages/driver-vidaa/src/DeviceVidaa.ts +7 -1
- package/packages/driver-vidaa/src/__mocks__/vidaa.ts +1 -0
- package/packages/driver-vidaa/src/constants.ts +8 -0
- package/packages/driver-vidaa/src/types.ts +8 -0
- package/packages/grid/src/UnifiedGridController/UnifiedGridController.ts +2 -0
- package/packages/list/src/Base/Base.tsx +4 -2
- package/packages/list/src/EdgeOffsetList/EdgeOffsetList.tsx +3 -1
- package/packages/list/src/types.ts +6 -0
- package/packages/menu/src/MenuAndContentContainer/MenuAndContentContainer.tsx +31 -16
- package/packages/menu/src/MenuAndContentContainer/interface.ts +0 -8
- package/packages/menu/src/WhitelabelMenu/SideMenu.scss +1 -1
- package/packages/menu/src/WhitelabelMenu/SideMenu.tsx +1 -1
- package/packages/menu/src/WhitelabelMenu/_animated.scss +1 -1
- package/packages/menu/src/WhitelabelMenu/rtl.scss +1 -1
- package/packages/mouse-navigation/src/MouseNavigation.tsx +18 -0
- package/packages/player-ui/src/PlayerUI.tsx +1 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@24i/bigscreen-sdk",
|
|
3
|
-
"version": "1.0.2-alpha.
|
|
3
|
+
"version": "1.0.2-alpha.2089",
|
|
4
4
|
"description": "SmartApps BIGscreen SDK monorepo",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"homepage": "https://github.com/24i/smartapps-bigscreen-sdk#readme",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@24i/player-base": "6.10.0",
|
|
41
|
-
"@24i/smartapps-datalayer": "2.3.
|
|
41
|
+
"@24i/smartapps-datalayer": "2.3.3",
|
|
42
42
|
"@sentry/browser": "^7.8.0",
|
|
43
43
|
"@types/prop-types": "^15.7.5",
|
|
44
44
|
"@types/scheduler": "^0.16.1",
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
ScreenSaverStatus,
|
|
5
5
|
VolumeRange,
|
|
6
6
|
} from '@24i/bigscreen-sdk/driver-base';
|
|
7
|
+
import { NetworkConnectionTypeMap } from './constants';
|
|
7
8
|
import { getPlatformInfo } from './formatUserAgent';
|
|
8
9
|
import { HisenseVidaaApi } from './types';
|
|
9
10
|
import { getKeyMap } from './keymap';
|
|
@@ -118,7 +119,12 @@ export class DeviceVidaa extends DeviceBase {
|
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
async getConnectionType(): Promise<ConnectionType> {
|
|
121
|
-
|
|
122
|
+
try {
|
|
123
|
+
const netType = window.Hisense_GetNetType();
|
|
124
|
+
return NetworkConnectionTypeMap[netType] || 'unknown';
|
|
125
|
+
} catch (e) {
|
|
126
|
+
console.error('[DeviceVidaa] Failed getConnectionType', e);
|
|
127
|
+
}
|
|
122
128
|
return 'unknown';
|
|
123
129
|
}
|
|
124
130
|
|
|
@@ -6,6 +6,7 @@ export const mockHisenseVidaaApi: HisenseVidaaApi = {
|
|
|
6
6
|
Hisense_GetFirmWareVersion: () => 'V0000.01.00Q.L0301',
|
|
7
7
|
Hisense_Get4KSupportState: () => true,
|
|
8
8
|
Hisense_GetDeviceID: () => '861003009000001000000641123456789012',
|
|
9
|
+
Hisense_GetNetType: () => 'wireless',
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
// Key constants are set to random number values
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type HisenseNetType = 'OFF' | 'wired' | 'wireless';
|
|
2
|
+
|
|
1
3
|
export interface HisenseVidaaApi {
|
|
2
4
|
/**
|
|
3
5
|
* This interface will retrieve Hisense Unique ID for the device.
|
|
@@ -27,6 +29,12 @@ export interface HisenseVidaaApi {
|
|
|
27
29
|
* @return a string that represents the TV model name.
|
|
28
30
|
*/
|
|
29
31
|
Hisense_GetModelName: () => string,
|
|
32
|
+
/**
|
|
33
|
+
* This interface retrieves the network type of the device.
|
|
34
|
+
* @return a string that represents the network type for the device.
|
|
35
|
+
* The one from "OFF", "wired", "wireless".
|
|
36
|
+
*/
|
|
37
|
+
Hisense_GetNetType: () => HisenseNetType,
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
export type HisenseVidaaKeys = {
|
|
@@ -524,6 +524,7 @@ export class UnifiedGridController<T> implements IUnifiedGridController<T> {
|
|
|
524
524
|
forEach(this.groups, (group, index) => {
|
|
525
525
|
this.updateItemsInGroup(group, index * itemsInGroup);
|
|
526
526
|
});
|
|
527
|
+
base.mrcuRef.current?.handleArrowState();
|
|
527
528
|
}
|
|
528
529
|
|
|
529
530
|
prependData(data: T[]) {
|
|
@@ -549,5 +550,6 @@ export class UnifiedGridController<T> implements IUnifiedGridController<T> {
|
|
|
549
550
|
this.scrollIndexToPixels(this.scrollIndex),
|
|
550
551
|
);
|
|
551
552
|
this.focusCurrentItem();
|
|
553
|
+
base.mrcuRef.current?.handleArrowState();
|
|
552
554
|
}
|
|
553
555
|
}
|
|
@@ -49,6 +49,8 @@ export class ListBase<T extends Item<U>, U>
|
|
|
49
49
|
|
|
50
50
|
mrcuRef = createRef<IMouseNavigation>();
|
|
51
51
|
|
|
52
|
+
// mrcuRef2: Reference<HTMLDivElement>;
|
|
53
|
+
|
|
52
54
|
itemRefs: Reference<T>[] = [];
|
|
53
55
|
|
|
54
56
|
index = 0;
|
|
@@ -344,7 +346,7 @@ export class ListBase<T extends Item<U>, U>
|
|
|
344
346
|
}
|
|
345
347
|
|
|
346
348
|
render() {
|
|
347
|
-
const { horizontal, className } = this.props;
|
|
349
|
+
const { horizontal, className, mrcuMountingPoint } = this.props;
|
|
348
350
|
return (
|
|
349
351
|
<Scroller
|
|
350
352
|
className={className}
|
|
@@ -357,7 +359,7 @@ export class ListBase<T extends Item<U>, U>
|
|
|
357
359
|
<MouseNavigation
|
|
358
360
|
// @ts-ignore - needed to convert fallback (false) to interface
|
|
359
361
|
ref={this.mrcuRef}
|
|
360
|
-
getMountingPoint={() => this.scroller.current!.wrapRef}
|
|
362
|
+
getMountingPoint={() => mrcuMountingPoint || this.scroller.current!.wrapRef}
|
|
361
363
|
{...this.props}
|
|
362
364
|
/>
|
|
363
365
|
</Scroller>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, createRef, DeclareProps } from '@24i/bigscreen-sdk/jsx';
|
|
1
|
+
import { Component, createRef, DeclareProps, Reference } from '@24i/bigscreen-sdk/jsx';
|
|
2
2
|
import { IFocusable } from '@24i/bigscreen-sdk/focus';
|
|
3
3
|
import { noop } from '@24i/bigscreen-sdk/utils/noop';
|
|
4
4
|
import { ListBase } from '../Base';
|
|
@@ -29,6 +29,8 @@ export class EdgeOffsetList<T extends Item<U>, U>
|
|
|
29
29
|
*/
|
|
30
30
|
base = createRef<ListBase<T, U>>();
|
|
31
31
|
|
|
32
|
+
//mrcuRef = createRef<HTMLDivElement>();
|
|
33
|
+
|
|
32
34
|
/**
|
|
33
35
|
* Unified controller for leveraging common behaviour
|
|
34
36
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Reference, Component } from '@24i/bigscreen-sdk/jsx';
|
|
2
2
|
import { EasingType } from '@24i/bigscreen-sdk/animations';
|
|
3
|
+
import { HtmlAttributes } from 'csstype';
|
|
3
4
|
|
|
4
5
|
export interface Item<T> extends Component<any> {
|
|
5
6
|
focus: (options?: FocusOptions) => void,
|
|
@@ -66,6 +67,11 @@ export type BasicProps<T extends Item<U>, U> = {
|
|
|
66
67
|
*/
|
|
67
68
|
fastFocusingOptimization?: boolean,
|
|
68
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Returns a reference to the custom HTML div for the mrcu arrows.
|
|
72
|
+
*/
|
|
73
|
+
mrcuMountingPoint?: Reference<HTMLDivElement>,
|
|
74
|
+
|
|
69
75
|
/**
|
|
70
76
|
* Function called every time before list performs one full scroll.
|
|
71
77
|
* @param item Reference to item on current scroll
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component, createRef } from '@24i/bigscreen-sdk/jsx';
|
|
2
2
|
import { device } from '@24i/bigscreen-sdk/device';
|
|
3
3
|
import { stopEvent } from '@24i/bigscreen-sdk/utils/stopEvent';
|
|
4
|
+
import { getDisplayToggler, DISPLAY_NONE } from '@24i/bigscreen-sdk/utils/displayToggler';
|
|
4
5
|
import { service } from './service';
|
|
5
6
|
import {
|
|
6
7
|
Props,
|
|
@@ -25,6 +26,16 @@ export class MenuAndContentContainer<T extends string = string>
|
|
|
25
26
|
*/
|
|
26
27
|
listensToMouse = false;
|
|
27
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Element for triggering menu by mouse event.
|
|
31
|
+
*/
|
|
32
|
+
mouseTriggerElement = createRef<HTMLDivElement>();
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* DisplayToggler for {@link mouseTriggerElement}.
|
|
36
|
+
*/
|
|
37
|
+
mouseTriggerElementDisplayToggler = getDisplayToggler(this.mouseTriggerElement, true);
|
|
38
|
+
|
|
28
39
|
/**
|
|
29
40
|
* Adds event listeners:
|
|
30
41
|
* - keydown to {@link Props.elementForEvents elementForEvents}
|
|
@@ -58,10 +69,12 @@ export class MenuAndContentContainer<T extends string = string>
|
|
|
58
69
|
onVisibilityChange = (visible: boolean) => {
|
|
59
70
|
if (visible) {
|
|
60
71
|
this.menu.current!.focus();
|
|
72
|
+
if (this.listensToMouse) this.mouseTriggerElementDisplayToggler.hide();
|
|
61
73
|
service.triggerEvent('visibilitychange', true);
|
|
62
74
|
} else {
|
|
63
75
|
const { router: { current: router } } = this.props;
|
|
64
76
|
router!.focus();
|
|
77
|
+
if (this.listensToMouse) this.mouseTriggerElementDisplayToggler.show();
|
|
65
78
|
service.triggerEvent('visibilitychange', false);
|
|
66
79
|
}
|
|
67
80
|
};
|
|
@@ -88,14 +101,10 @@ export class MenuAndContentContainer<T extends string = string>
|
|
|
88
101
|
* @param event mouse event
|
|
89
102
|
*/
|
|
90
103
|
onMouseMove = (event: MouseEvent) => {
|
|
91
|
-
const { Menu } = this.props;
|
|
92
104
|
const menu = this.menu.current!;
|
|
93
105
|
if (this.isMenuAvailable() && !menu.isOpen()) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
menu.open();
|
|
97
|
-
stopEvent(event);
|
|
98
|
-
}
|
|
106
|
+
menu.open();
|
|
107
|
+
stopEvent(event);
|
|
99
108
|
}
|
|
100
109
|
};
|
|
101
110
|
|
|
@@ -127,8 +136,8 @@ export class MenuAndContentContainer<T extends string = string>
|
|
|
127
136
|
addMouseListener() {
|
|
128
137
|
if (!this.listensToMouse) {
|
|
129
138
|
this.listensToMouse = true;
|
|
130
|
-
|
|
131
|
-
|
|
139
|
+
if (!this.menu.current!.isOpen()) this.mouseTriggerElementDisplayToggler.show();
|
|
140
|
+
this.mouseTriggerElement.current!.addEventListener('mousemove', this.onMouseMove);
|
|
132
141
|
}
|
|
133
142
|
}
|
|
134
143
|
|
|
@@ -138,8 +147,8 @@ export class MenuAndContentContainer<T extends string = string>
|
|
|
138
147
|
removeMouseListener() {
|
|
139
148
|
if (this.listensToMouse) {
|
|
140
149
|
this.listensToMouse = false;
|
|
141
|
-
|
|
142
|
-
|
|
150
|
+
if (!this.menu.current!.isOpen()) this.mouseTriggerElementDisplayToggler.hide();
|
|
151
|
+
this.mouseTriggerElement.current!.removeEventListener('mousemove', this.onMouseMove);
|
|
143
152
|
}
|
|
144
153
|
}
|
|
145
154
|
|
|
@@ -155,12 +164,18 @@ export class MenuAndContentContainer<T extends string = string>
|
|
|
155
164
|
const { children, items, Menu } = this.props;
|
|
156
165
|
return (
|
|
157
166
|
<>
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
167
|
+
<div className="menu-container">
|
|
168
|
+
<Menu
|
|
169
|
+
ref={this.menu}
|
|
170
|
+
items={items}
|
|
171
|
+
onVisibilityChange={this.onVisibilityChange}
|
|
172
|
+
contentContainer={this}
|
|
173
|
+
/>
|
|
174
|
+
<div
|
|
175
|
+
ref={this.mouseTriggerElement}
|
|
176
|
+
className={`menu-mouse-trigger ${DISPLAY_NONE}`}
|
|
177
|
+
/>
|
|
178
|
+
</div>
|
|
164
179
|
{children}
|
|
165
180
|
</>
|
|
166
181
|
);
|
|
@@ -119,13 +119,6 @@ export interface Menu<
|
|
|
119
119
|
updateItems(items: MenuItem<T>[]): void,
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
/**
|
|
123
|
-
* Function for deciding whether to open menu based on mouse position.
|
|
124
|
-
*/
|
|
125
|
-
type MouseMenuOpenResolver = (
|
|
126
|
-
({ clientX, clientY }: { clientX: number, clientY: number }) => boolean
|
|
127
|
-
);
|
|
128
|
-
|
|
129
122
|
/**
|
|
130
123
|
* Function for deciding whether to open menu based on pressed key.
|
|
131
124
|
*/
|
|
@@ -145,7 +138,6 @@ type KeyboardMenuCloseResolver = (
|
|
|
145
138
|
*/
|
|
146
139
|
export interface MenuComponent<T extends string = string, P extends MenuProps<T> = MenuProps<T>> {
|
|
147
140
|
new (props: P): Menu<T, P>,
|
|
148
|
-
shouldOpenMenuWithMouse: MouseMenuOpenResolver,
|
|
149
141
|
shouldOpenMenu: KeyboardMenuOpenResolver,
|
|
150
142
|
shouldCloseMenu: KeyboardMenuCloseResolver,
|
|
151
143
|
}
|
|
@@ -220,7 +220,7 @@ export class SideMenu extends Component<Props> implements ISideMenu {
|
|
|
220
220
|
render() {
|
|
221
221
|
const { items } = this.props;
|
|
222
222
|
return (
|
|
223
|
-
<div ref={this.visualController.div} className={`menu
|
|
223
|
+
<div ref={this.visualController.div} className={`side-menu ${DISPLAY_NONE}`}>
|
|
224
224
|
<div
|
|
225
225
|
ref={this.visualController.overlay}
|
|
226
226
|
className={`overlay ${animated ? DISPLAY_NONE : ''}`}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@import '@24i/bigscreen-sdk/sass-utils/transition';
|
|
3
3
|
@import '@24i/bigscreen-sdk/sass-utils/prefix-property';
|
|
4
4
|
|
|
5
|
-
.menu-container {
|
|
5
|
+
.menu-container .side-menu {
|
|
6
6
|
@include transform(translate3d(0, 0, 0));
|
|
7
7
|
@include transition(prefix-property(transform), 300ms);
|
|
8
8
|
|
|
@@ -94,6 +94,22 @@ export class MouseNavigation extends Component<Props> {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
+
onWheel = (event: WheelEvent) => {
|
|
98
|
+
const { forward, backward, direction } = this.props;
|
|
99
|
+
const { horizontal } = this.mapDirectionToProps(direction);
|
|
100
|
+
if (horizontal) return;
|
|
101
|
+
if (event.deltaY > 0) forward();
|
|
102
|
+
else if (event.deltaY < 0) backward();
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
addWheelListner() {
|
|
106
|
+
this.arrows.current?.domRef.current?.addEventListener('wheel', this.onWheel);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
removeWheelListner() {
|
|
110
|
+
this.arrows.current?.domRef.current?.removeEventListener('wheel', this.onWheel);
|
|
111
|
+
}
|
|
112
|
+
|
|
97
113
|
isActive() {
|
|
98
114
|
return this.navigationState === 'active';
|
|
99
115
|
}
|
|
@@ -112,6 +128,7 @@ export class MouseNavigation extends Component<Props> {
|
|
|
112
128
|
getMountingPoint(),
|
|
113
129
|
);
|
|
114
130
|
this.handleArrowState();
|
|
131
|
+
this.addWheelListner();
|
|
115
132
|
this.navigationState = 'active';
|
|
116
133
|
};
|
|
117
134
|
|
|
@@ -129,6 +146,7 @@ export class MouseNavigation extends Component<Props> {
|
|
|
129
146
|
destroyArrows() {
|
|
130
147
|
if (this.navigationState === 'inactive') return;
|
|
131
148
|
this.navigationState = 'inactive';
|
|
149
|
+
this.removeWheelListner();
|
|
132
150
|
removeNode(this.arrows.current!.domRef);
|
|
133
151
|
}
|
|
134
152
|
|
|
@@ -189,11 +189,7 @@ export class PlayerUI extends Component<Props>
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
canHideAutomatically() {
|
|
192
|
-
return
|
|
193
|
-
this.isPlaying()
|
|
194
|
-
&& !this.seeking.isSeeking()
|
|
195
|
-
&& !this.isHidingDisabled
|
|
196
|
-
);
|
|
192
|
+
return !this.isHidingDisabled;
|
|
197
193
|
}
|
|
198
194
|
|
|
199
195
|
isPlaying() {
|