@applicaster/zapp-react-native-ui-components 13.0.0-alpha.5771418585 → 13.0.0-alpha.5953040243
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/Components/AppContainer/__tests__/AppContainer.test.js +4 -6
- package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +54 -111
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +36 -20
- package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
- package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
- package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
- package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
- package/Components/AudioPlayer/__tests__/title.test.js +3 -5
- package/Components/BaseFocusable/index.tsx +1 -2
- package/Components/Cell/Cell.tsx +1 -0
- package/Components/Cell/CellWithFocusable.tsx +1 -0
- package/Components/Cell/TvOSCellComponent.tsx +20 -22
- package/Components/Cell/index.js +3 -1
- package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +46 -48
- package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
- package/Components/ComponentResolver/__tests__/componentResolver.test.js +16 -22
- package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
- package/Components/Focusable/FocusableTvOS.tsx +5 -1
- package/Components/Focusable/index.android.tsx +10 -3
- package/Components/FocusableGroup/FocusableTvOS.tsx +34 -83
- package/Components/FocusableGroup/index.tsx +1 -3
- package/Components/FocusableList/index.tsx +26 -9
- package/Components/FocusableScrollView/index.tsx +43 -13
- package/Components/Layout/TV/NavBarContainer.tsx +19 -23
- package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -2
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +3 -2
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
- package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
- package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +4 -12
- package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +0 -229
- package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
- package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
- package/Components/MasterCell/utils/behaviorProvider.ts +131 -0
- package/Components/MasterCell/utils/index.ts +3 -129
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
- package/Components/PlayerImageBackground/index.tsx +23 -3
- package/Components/River/TV/index.tsx +6 -1
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
- package/Components/River/__tests__/river.test.js +75 -40
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -4
- package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
- package/Components/RouteManager/__tests__/testId.test.js +8 -6
- package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
- package/Components/Transitioner/__tests__/Scene.test.js +25 -14
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -68
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
- package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
- package/Components/VideoModal/PlayerDetails.tsx +4 -1
- package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
- package/Components/Viewport/__tests__/utils.test.js +5 -4
- package/Components/ZappUIComponent/Placeholder.tsx +3 -1
- package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
- package/Components/ZappUIComponent/index.tsx +3 -16
- package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
- package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
- package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
- package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
- package/Decorators/Navigator/index.tsx +1 -1
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +18 -24
- package/Decorators/RiverResolver/index.tsx +1 -1
- package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
- package/Decorators/ZappPipesDataConnector/index.tsx +2 -29
- package/package.json +7 -7
- package/Components/Cell/CellWithFocusable.ios.tsx +0 -126
- package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
- package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
- package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
- package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
- package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
- package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
import { shallowToJson } from "enzyme-to-json";
|
|
3
|
+
import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
|
|
5
4
|
|
|
6
5
|
import { testCellStyle } from "./TestCellStyle";
|
|
7
6
|
import { singleView } from "./SingleView";
|
|
8
7
|
import { entry } from "./testEntry";
|
|
9
8
|
import { singleElement } from "./testElements";
|
|
10
9
|
|
|
11
|
-
jest.mock(
|
|
12
|
-
useRoute
|
|
13
|
-
|
|
10
|
+
jest.mock(
|
|
11
|
+
"@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute",
|
|
12
|
+
() => ({
|
|
13
|
+
useRoute: jest.fn(() => ({ screenData: { id: "test" } })),
|
|
14
|
+
})
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
jest.mock(
|
|
18
|
+
"@applicaster/zapp-react-native-utils/reactHooks/navigation/useIsScreenActive",
|
|
19
|
+
() => ({
|
|
20
|
+
useIsScreenActive: jest.fn(() => true),
|
|
21
|
+
})
|
|
22
|
+
);
|
|
14
23
|
|
|
15
24
|
jest.mock("@applicaster/zapp-react-native-utils/screenState", () => ({
|
|
16
25
|
useScreenState: jest.fn(() => ({
|
|
@@ -27,36 +36,27 @@ describe("masterCellBuilder", () => {
|
|
|
27
36
|
describe("when using default options", () => {
|
|
28
37
|
const MasterCell = masterCellBuilder({ cellConfiguration: testCellStyle });
|
|
29
38
|
|
|
30
|
-
it("returns a function", () => {
|
|
31
|
-
expect(MasterCell).toMatchSnapshot();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
39
|
it("renders correctly", () => {
|
|
35
|
-
const wrapper =
|
|
36
|
-
<View>
|
|
40
|
+
const wrapper = renderWithProviders(
|
|
41
|
+
<View testID="master-cell">
|
|
37
42
|
<MasterCell item={entry} />
|
|
38
43
|
</View>
|
|
39
44
|
);
|
|
40
45
|
|
|
41
|
-
expect(
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("can be invoked as a React Component", () => {
|
|
45
|
-
const wrapper = shallow(<MasterCell item={entry} state={null} />);
|
|
46
|
-
|
|
47
|
-
expect(shallowToJson(wrapper)).toMatchSnapshot();
|
|
46
|
+
expect(wrapper.getByTestId("master-cell").children[0]).toBeDefined();
|
|
48
47
|
});
|
|
49
48
|
});
|
|
50
49
|
|
|
51
|
-
describe("when using custom containerStyle", () => {
|
|
50
|
+
describe.skip("when using custom containerStyle", () => {
|
|
52
51
|
const MasterCell = masterCellBuilder({
|
|
53
52
|
cellConfiguration: singleView,
|
|
54
53
|
containerStyle: { backgroundColor: "black" },
|
|
55
54
|
});
|
|
56
55
|
|
|
57
56
|
it("renders correctly", () => {
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
renderWithProviders(<MasterCell item={entry} />);
|
|
58
|
+
|
|
59
|
+
// TODO define the test need
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
|
|
@@ -69,14 +69,14 @@ describe("masterCellBuilder", () => {
|
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
it("renders correctly", () => {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
renderWithProviders(<MasterCell item={entry} />);
|
|
73
|
+
// TODO define the test need
|
|
74
74
|
|
|
75
75
|
expect(dataAdapter).toHaveBeenCalledWith(singleView);
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
describe("when using custom default components", () => {
|
|
79
|
+
describe.skip("when using custom default components", () => {
|
|
80
80
|
// the collapsable prop is added here to easily check from the snapshot that the mock
|
|
81
81
|
// component is being used instead of the default one
|
|
82
82
|
const CustomView = jest.fn((props) => <View {...props} collapsable />);
|
|
@@ -88,8 +88,8 @@ describe("masterCellBuilder", () => {
|
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
it("renders correctly", () => {
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
renderWithProviders(<MasterCell item={entry} />);
|
|
92
|
+
// TODO define the test need
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
95
|
});
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
2
|
+
import { StorageSingleValueProvider } from "@applicaster/zapp-react-native-bridge/ZappStorage/StorageSingleSelectProvider";
|
|
3
|
+
import { PushTopicManager } from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
|
|
4
|
+
import { StorageMultiSelectProvider } from "@applicaster/zapp-react-native-bridge/ZappStorage/StorageMultiSelectProvider";
|
|
5
|
+
import React, { useEffect } from "react";
|
|
6
|
+
import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
|
|
7
|
+
import { BehaviorSubject } from "rxjs";
|
|
8
|
+
import { masterCellLogger } from "../logger";
|
|
9
|
+
|
|
10
|
+
const parseContextKey = (key: string): string | null => {
|
|
11
|
+
if (!key?.startsWith("@{ctx/")) return null;
|
|
12
|
+
|
|
13
|
+
return key.substring("@{ctx/".length, key.length - 1);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getDataSourceProvider = (
|
|
17
|
+
behavior: Behavior
|
|
18
|
+
): BehaviorSubject<string[] | string> | null => {
|
|
19
|
+
if (!behavior) return null;
|
|
20
|
+
|
|
21
|
+
const selection = String(behavior.current_selection);
|
|
22
|
+
const contextKey = parseContextKey(selection);
|
|
23
|
+
|
|
24
|
+
if (contextKey) {
|
|
25
|
+
if (behavior.select_mode === "multi") {
|
|
26
|
+
return StorageMultiSelectProvider.getProvider(contextKey).getObservable();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (behavior.select_mode === "single") {
|
|
30
|
+
return StorageSingleValueProvider.getProvider(contextKey).getObservable();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (behavior.selection_source === "@{push/topics}") {
|
|
35
|
+
return PushTopicManager.getInstance().getEntryObservable();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return null;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const useBehaviorUpdate = (behavior: Behavior) => {
|
|
42
|
+
const [lastUpdate, setLastUpdate] = React.useState<number | null>(null);
|
|
43
|
+
const player = usePlayer();
|
|
44
|
+
|
|
45
|
+
const triggerUpdate = () => setLastUpdate(Date.now());
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!behavior) return;
|
|
49
|
+
|
|
50
|
+
const dataSource = getDataSourceProvider(behavior);
|
|
51
|
+
|
|
52
|
+
if (dataSource) {
|
|
53
|
+
const subscription = dataSource.subscribe(triggerUpdate);
|
|
54
|
+
|
|
55
|
+
return () => subscription.unsubscribe();
|
|
56
|
+
}
|
|
57
|
+
}, [behavior]);
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (!behavior || !player || behavior.selection_source !== "now_playing") {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const subscription = player.getEntryObservable().subscribe(triggerUpdate);
|
|
65
|
+
|
|
66
|
+
return () => subscription.unsubscribe();
|
|
67
|
+
}, [behavior, player]);
|
|
68
|
+
|
|
69
|
+
return lastUpdate;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const isCellSelected = (
|
|
73
|
+
id: string | number,
|
|
74
|
+
behavior?: Behavior
|
|
75
|
+
): boolean => {
|
|
76
|
+
if (!behavior) return false;
|
|
77
|
+
|
|
78
|
+
if (behavior.selection_source === "now_playing") {
|
|
79
|
+
const player = playerManager.getActivePlayer();
|
|
80
|
+
|
|
81
|
+
return player?.entry?.id === id;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (behavior.selection_source === "@{push/topics}") {
|
|
85
|
+
if (behavior.select_mode === "single") {
|
|
86
|
+
masterCellLogger.warning(
|
|
87
|
+
"Unexpected single selection mode for push topics"
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const tags = PushTopicManager.getInstance().getRegisteredTags();
|
|
92
|
+
|
|
93
|
+
return tags.includes(String(id));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const selection = String(behavior.current_selection);
|
|
97
|
+
const contextKey = parseContextKey(selection);
|
|
98
|
+
|
|
99
|
+
if (contextKey) {
|
|
100
|
+
if (behavior.select_mode === "single") {
|
|
101
|
+
const selectedItem =
|
|
102
|
+
StorageSingleValueProvider.getProvider(contextKey)?.getValue();
|
|
103
|
+
|
|
104
|
+
return selectedItem === String(id);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (behavior.select_mode === "multi") {
|
|
108
|
+
const selectedItems =
|
|
109
|
+
StorageMultiSelectProvider.getProvider(contextKey)?.getSelectedItems();
|
|
110
|
+
|
|
111
|
+
return selectedItems?.includes(String(id));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (behavior.select_mode === "single") {
|
|
116
|
+
return behavior.current_selection === id;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (
|
|
120
|
+
behavior.select_mode === "multi" &&
|
|
121
|
+
Array.isArray(behavior.current_selection)
|
|
122
|
+
) {
|
|
123
|
+
const currentSelection: string[] = behavior.current_selection.map(
|
|
124
|
+
(item): string => String(item)
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
return currentSelection.includes(String(id));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return false;
|
|
131
|
+
};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
import validateColor from "validate-color";
|
|
4
4
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
5
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
6
6
|
|
|
7
7
|
import { masterCellLogger } from "../logger";
|
|
8
|
-
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
9
|
-
import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
|
|
10
|
-
import { PushTopicManager } from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
|
|
11
|
-
import { StorageMultiSelectProvider } from "@applicaster/zapp-react-native-bridge/ZappStorage/StorageMultiSelectProvider";
|
|
12
8
|
import { getCellState } from "../../Cell/utils";
|
|
13
9
|
import { getColorFromData } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
10
|
+
import { isCellSelected, useBehaviorUpdate } from "./behaviorProvider";
|
|
14
11
|
|
|
15
12
|
const hasElementSpecificViewType = (viewType) => (element) => {
|
|
16
13
|
if (R.isNil(element)) {
|
|
@@ -194,130 +191,7 @@ export const getFocusedButtonId = (focusable) => {
|
|
|
194
191
|
};
|
|
195
192
|
|
|
196
193
|
export const isSelected = (id: string | number, behavior?: Behavior) => {
|
|
197
|
-
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (behavior?.selection_source === "now_playing") {
|
|
202
|
-
const player = playerManager.getActivePlayer();
|
|
203
|
-
|
|
204
|
-
if (player?.entry?.id === id) {
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (behavior?.select_mode === "single") {
|
|
210
|
-
return behavior.current_selection === id;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if (behavior?.select_mode === "multi") {
|
|
214
|
-
// TODO: Use generic resolver source
|
|
215
|
-
|
|
216
|
-
if (behavior.selection_source === "@{push/topics}") {
|
|
217
|
-
const tags = PushTopicManager.getInstance().getRegisteredTags();
|
|
218
|
-
|
|
219
|
-
return tags.includes(String(id));
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (Array.isArray(behavior.current_selection)) {
|
|
223
|
-
return behavior.current_selection.includes(id);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
const currentSelection = String(behavior.current_selection);
|
|
227
|
-
|
|
228
|
-
if (currentSelection?.startsWith("@{ctx/")) {
|
|
229
|
-
const keyWithoutCtx = currentSelection.substring(
|
|
230
|
-
"@{ctx/".length,
|
|
231
|
-
currentSelection.length - 1
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
const selectedItems =
|
|
235
|
-
StorageMultiSelectProvider.getProvider(
|
|
236
|
-
keyWithoutCtx
|
|
237
|
-
)?.getSelectedItems();
|
|
238
|
-
|
|
239
|
-
return selectedItems?.includes(String(id));
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return false;
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
export const useBehaviorUpdate = (behavior: Behavior) => {
|
|
247
|
-
const [lastUpdate, setLastUpdate] = React.useState(null);
|
|
248
|
-
|
|
249
|
-
const player = usePlayer();
|
|
250
|
-
|
|
251
|
-
const triggerUpdate = () => {
|
|
252
|
-
setLastUpdate(Date.now());
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
// TODO: Create generic RX to state update
|
|
256
|
-
useEffect(() => {
|
|
257
|
-
// TODO: Use generic resolver source
|
|
258
|
-
if (!behavior) {
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
const currentSelection = String(behavior.current_selection);
|
|
263
|
-
|
|
264
|
-
if (currentSelection?.startsWith("@{ctx/")) {
|
|
265
|
-
const keyWithoutCtx = currentSelection.substring(
|
|
266
|
-
"@{ctx/".length,
|
|
267
|
-
currentSelection.length - 1
|
|
268
|
-
);
|
|
269
|
-
|
|
270
|
-
if (keyWithoutCtx) {
|
|
271
|
-
const subscription = StorageMultiSelectProvider.getProvider(
|
|
272
|
-
keyWithoutCtx
|
|
273
|
-
)
|
|
274
|
-
.getObservable()
|
|
275
|
-
.subscribe(() => {
|
|
276
|
-
triggerUpdate();
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
return () => {
|
|
280
|
-
subscription.unsubscribe();
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}, [behavior]);
|
|
285
|
-
|
|
286
|
-
useEffect(() => {
|
|
287
|
-
if (!behavior) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (behavior?.selection_source === "@{push/topics}") {
|
|
292
|
-
const subscription = PushTopicManager.getInstance()
|
|
293
|
-
.getEntryObservable()
|
|
294
|
-
.subscribe(() => {
|
|
295
|
-
triggerUpdate();
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
return () => {
|
|
299
|
-
subscription.unsubscribe();
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
}, [behavior]);
|
|
303
|
-
|
|
304
|
-
useEffect(() => {
|
|
305
|
-
if (!behavior) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
if (behavior?.selection_source === "now_playing" && player) {
|
|
310
|
-
const subscription = player.getEntryObservable().subscribe(() => {
|
|
311
|
-
triggerUpdate();
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
return () => {
|
|
315
|
-
subscription.unsubscribe();
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
}, [behavior, player]);
|
|
319
|
-
|
|
320
|
-
return lastUpdate;
|
|
194
|
+
return isCellSelected(id, behavior);
|
|
321
195
|
};
|
|
322
196
|
|
|
323
197
|
export const useCellState = ({
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Text, Animated } from "react-native";
|
|
3
3
|
|
|
4
|
-
import { shallow } from "enzyme";
|
|
5
4
|
import renderer from "react-test-renderer";
|
|
6
5
|
|
|
7
6
|
jest.useFakeTimers();
|
|
@@ -40,10 +39,6 @@ const {
|
|
|
40
39
|
} = require("../NotificationView");
|
|
41
40
|
|
|
42
41
|
describe("NotificationView", () => {
|
|
43
|
-
it("renders", () => {
|
|
44
|
-
shallow(<NotificationView dismiss={dismiss} />);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
42
|
it("Show online message when Online", () => {
|
|
48
43
|
const component = renderer.create(
|
|
49
44
|
<NotificationView online dismiss={dismiss} />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from "react";
|
|
1
|
+
import React, { PropsWithChildren, useEffect, useState } from "react";
|
|
2
2
|
import { ImageBackground, View } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type Props = PropsWithChildren<{
|
|
13
13
|
entry: ZappEntry;
|
|
14
14
|
style?: { [K: string]: any };
|
|
15
|
+
docked?: boolean;
|
|
15
16
|
imageStyle?: { [K: string]: any };
|
|
16
17
|
imageKey?: string;
|
|
17
18
|
defaultImageDimensions?: { [K: string]: any };
|
|
@@ -23,6 +24,7 @@ const PlayerImageBackgroundComponent = ({
|
|
|
23
24
|
entry,
|
|
24
25
|
children,
|
|
25
26
|
style,
|
|
27
|
+
docked,
|
|
26
28
|
imageStyle,
|
|
27
29
|
imageKey,
|
|
28
30
|
defaultImageDimensions,
|
|
@@ -34,8 +36,22 @@ const PlayerImageBackgroundComponent = ({
|
|
|
34
36
|
|
|
35
37
|
const { playerAnimationState } = useModalAnimationContext();
|
|
36
38
|
|
|
39
|
+
const [lastNonNullAnimationState, setLastNonNullAnimationState] =
|
|
40
|
+
useState(playerAnimationState);
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (playerAnimationState !== null) {
|
|
44
|
+
setLastNonNullAnimationState(playerAnimationState);
|
|
45
|
+
}
|
|
46
|
+
}, [playerAnimationState]);
|
|
47
|
+
|
|
37
48
|
if (!source) return <>{children}</>;
|
|
38
49
|
|
|
50
|
+
const imageBackgroundStyle =
|
|
51
|
+
lastNonNullAnimationState !== PlayerAnimationStateEnum.minimize && !docked
|
|
52
|
+
? defaultImageDimensions
|
|
53
|
+
: imageSize;
|
|
54
|
+
|
|
39
55
|
return (
|
|
40
56
|
<View
|
|
41
57
|
style={
|
|
@@ -45,13 +61,17 @@ const PlayerImageBackgroundComponent = ({
|
|
|
45
61
|
}
|
|
46
62
|
>
|
|
47
63
|
<AnimationComponent
|
|
48
|
-
style={
|
|
64
|
+
style={
|
|
65
|
+
playerAnimationState === PlayerAnimationStateEnum.maximaze
|
|
66
|
+
? defaultImageDimensions
|
|
67
|
+
: style
|
|
68
|
+
}
|
|
49
69
|
animationType={ComponentAnimationType.player}
|
|
50
70
|
additionalData={defaultImageDimensions}
|
|
51
71
|
>
|
|
52
72
|
<ImageBackground
|
|
53
73
|
resizeMode="cover"
|
|
54
|
-
style={
|
|
74
|
+
style={imageBackgroundStyle}
|
|
55
75
|
imageStyle={imageStyle}
|
|
56
76
|
source={source}
|
|
57
77
|
>
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import { compose } from "ramda";
|
|
1
2
|
import { River as RiverComponent } from "./River";
|
|
2
3
|
import { withTvEventHandler } from "./withTVEventHandler";
|
|
4
|
+
import { withComponentsMapOffsetContext } from "../../../Contexts/ComponentsMapOffsetContext";
|
|
3
5
|
|
|
4
|
-
export const River =
|
|
6
|
+
export const River = compose(
|
|
7
|
+
withTvEventHandler,
|
|
8
|
+
withComponentsMapOffsetContext
|
|
9
|
+
)(RiverComponent);
|
|
@@ -1,89 +1,27 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`When River has a general_content type
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<RiverWithData
|
|
8
|
-
appData={
|
|
9
|
-
{
|
|
10
|
-
"layoutVersion": "v1",
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
dispatch={[Function]}
|
|
14
|
-
rivers={
|
|
15
|
-
{
|
|
16
|
-
"A1234": {
|
|
17
|
-
"home": true,
|
|
18
|
-
"id": "A1234",
|
|
19
|
-
"name": "foo",
|
|
20
|
-
"type": "general_content",
|
|
21
|
-
"ui_components": [
|
|
22
|
-
{
|
|
23
|
-
"component_type": "hero",
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"component_type": "grid",
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
"B4567": {
|
|
31
|
-
"id": "B4567",
|
|
32
|
-
},
|
|
33
|
-
"C0987": {
|
|
34
|
-
"home": false,
|
|
35
|
-
"id": "C0987",
|
|
36
|
-
"name": "Some-Screen-Plugin",
|
|
37
|
-
"type": "some-screen-plugin",
|
|
38
|
-
"ui_components": [],
|
|
39
|
-
},
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
screenId="A1234"
|
|
43
|
-
store={
|
|
44
|
-
{
|
|
45
|
-
"clearActions": [Function],
|
|
46
|
-
"dispatch": [Function],
|
|
47
|
-
"getActions": [Function],
|
|
48
|
-
"getState": [Function],
|
|
49
|
-
"replaceReducer": [Function],
|
|
50
|
-
"subscribe": [Function],
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/>
|
|
54
|
-
</ContextProvider>
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
exports[`When River has a general_content type <RiverComponent /> renders correctly 1`] = `
|
|
58
|
-
<GeneralContentScreen
|
|
59
|
-
groupId="ZF-C4"
|
|
60
|
-
screenId="A1234"
|
|
61
|
-
/>
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
exports[`When River has any other type other than general_content <RiverComponent /> renders correctly 1`] = `
|
|
65
|
-
<WithProvider
|
|
66
|
-
screenData={
|
|
3
|
+
exports[`When River has a general_content type renders River component correctly 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
onLayout={[Function]}
|
|
6
|
+
style={
|
|
67
7
|
{
|
|
68
|
-
"
|
|
69
|
-
"home": false,
|
|
70
|
-
"id": "C0987",
|
|
71
|
-
"name": "Some-Screen-Plugin",
|
|
72
|
-
"type": "some-screen-plugin",
|
|
73
|
-
"ui_components": [],
|
|
8
|
+
"flex": 1,
|
|
74
9
|
}
|
|
75
10
|
}
|
|
76
|
-
|
|
77
|
-
screenType="some-screen-plugin"
|
|
78
|
-
/>
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
exports[`When River has feed url <RiverComponent /> renders correctly 1`] = `
|
|
82
|
-
<Connect(FeedLoaderComponent)
|
|
83
|
-
feedUrl="https://some-feed-url.net"
|
|
84
|
-
refreshCallback={[Function]}
|
|
85
|
-
refreshing={false}
|
|
11
|
+
testID="on-layout-view"
|
|
86
12
|
>
|
|
87
|
-
<
|
|
88
|
-
|
|
13
|
+
<View
|
|
14
|
+
style={
|
|
15
|
+
{
|
|
16
|
+
"display": "none",
|
|
17
|
+
"flex": 1,
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
>
|
|
21
|
+
<View
|
|
22
|
+
screenId="A1234"
|
|
23
|
+
testID="general-content-screen"
|
|
24
|
+
/>
|
|
25
|
+
</View>
|
|
26
|
+
</View>
|
|
89
27
|
`;
|