@applicaster/zapp-react-native-ui-components 16.0.0-rc.99 → 17.0.0-alpha.1037440043
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/CellRendererResolver/index.ts +2 -2
- package/Components/ComponentResolver/ComponentResolver.ts +2 -2
- package/Components/ComponentResolver/__tests__/componentResolver.test.js +13 -5
- package/Components/ContentScreen/index.js +2 -2
- package/Components/FocusableList/hooks/useCheckItemIdsForUnique.ts +2 -7
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +1 -1
- package/Components/GeneralContentScreen/hookAdapter/logger.ts +1 -1
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +158 -1
- package/Components/GeneralContentScreen/utils/index.ts +2 -2
- package/Components/GeneralContentScreen/utils/logger.ts +3 -4
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +32 -10
- package/Components/HandlePlayable/utils.ts +2 -7
- package/Components/HookRenderer/HookRenderer.tsx +2 -2
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +13 -0
- package/Components/MasterCell/DefaultComponents/Image/hoc/utils/__tests__/withDimensions.test.ts +1 -1
- package/Components/MasterCell/DefaultComponents/Image/hoc/utils/index.ts +2 -4
- package/Components/MasterCell/DefaultComponents/Image/hooks/checkTooBigImageSize.ts +2 -7
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +12 -3
- package/Components/MasterCell/DefaultComponents/PressableView.tsx +3 -0
- package/Components/MasterCell/DefaultComponents/Text/hooks/useText.ts +2 -7
- package/Components/MasterCell/DefaultComponents/__tests__/ActionButton.test.tsx +288 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/ActionButton.tsx +2 -1
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/PressableView.test.tsx +4 -2
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/factory.test.ts +2 -2
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +2 -1
- package/Components/MasterCell/__tests__/masterCell.test.js +60 -0
- package/Components/MasterCell/index.tsx +28 -4
- package/Components/MasterCell/logger.ts +2 -2
- package/Components/MasterCell/utils/__tests__/useIsCellSelected.test.ts +91 -0
- package/Components/MasterCell/utils/__tests__/withoutFocusedState.test.js +20 -0
- package/Components/MasterCell/utils/behaviorProvider.ts +57 -38
- package/Components/MasterCell/utils/index.ts +21 -18
- package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +1 -1
- package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +7 -3
- package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +22 -1
- package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +52 -1
- package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +77 -0
- package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +58 -16
- package/Components/ModalComponent/BottomSheetDragArea.web.tsx +15 -0
- package/Components/ModalComponent/BottomSheetModalContent.tsx +51 -82
- package/Components/ModalComponent/SortableList.tsx +2 -3
- package/Components/ModalComponent/__tests__/BottomSheetDragArea.test.tsx +30 -0
- package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +237 -17
- package/Components/ModalComponent/__tests__/showTextInput.test.ts +25 -0
- package/Components/ModalComponent/showTextInput.ts +2 -0
- package/Components/OfflineHandler/__tests__/index.test.tsx +136 -0
- package/Components/OfflineHandler/index.tsx +45 -6
- package/Components/PlayerContainer/PlayerContainer.tsx +30 -6
- package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +51 -0
- package/Components/PlayerContainer/logger.ts +9 -5
- package/Components/River/ComponentsMap/ComponentsMap.tsx +4 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
- package/Components/ScreenFeedLoader/ScreenFeedLoader.tsx +2 -2
- package/Components/ScreenResolver/index.tsx +2 -3
- package/Components/Transitioner/AnimationManager.js +1 -1
- package/Components/Transitioner/Scene.tsx +4 -3
- package/Components/Transitioner/Transitioner.tsx +71 -33
- package/Components/Transitioner/__tests__/transitioner.test.js +372 -3
- package/Components/VideoLive/LiveImageManager.ts +126 -12
- package/Components/VideoLive/MuteUnmuteController.ts +135 -0
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +15 -19
- package/Components/VideoLive/__tests__/LiveImageMuteState.test.ts +311 -0
- package/Components/VideoLive/__tests__/MuteUnmuteController.test.ts +135 -0
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -1
- package/Components/VideoLive/loggerHelper.ts +2 -2
- package/Components/VideoModal/PlayerWrapper.tsx +4 -1
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -0
- package/Components/VideoModal/__tests__/playerWrapperStyle.test.ts +58 -0
- package/Components/VideoModal/__tests__/playerWrapperUtils.test.ts +16 -0
- package/Components/VideoModal/hooks/useModalSize.ts +2 -7
- package/Components/VideoModal/playerWrapperStyle.ts +21 -3
- package/Components/VideoModal/playerWrapperUtils.ts +7 -1
- package/Contexts/ZappPipesContext/ZappPipesContextFactory.tsx +3 -5
- package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +4 -3
- package/Decorators/ZappPipesDataConnector/__tests__/screenToolbox.test.ts +347 -0
- package/Decorators/ZappPipesDataConnector/__tests__/screenToolboxUnavailable.test.ts +53 -0
- package/Decorators/ZappPipesDataConnector/index.tsx +19 -4
- package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +2 -21
- package/Decorators/ZappPipesDataConnector/screenToolbox.ts +384 -0
- package/Decorators/ZappPipesDataConnector/utils/mongoFilter.ts +1 -1
- package/Decorators/ZappPipesDataConnector/utils/useFilter.tsx +1 -1
- package/Helpers/logger.js +2 -2
- package/package.json +5 -5
|
@@ -10,6 +10,55 @@ jest.useFakeTimers({ legacyFakeTimers: true });
|
|
|
10
10
|
// isConnected/isInternetReachable/details fields, so the mock has to mirror
|
|
11
11
|
// that shape for online/offline to actually be distinguishable.
|
|
12
12
|
let mockConnectionStatus = false;
|
|
13
|
+
let mockStillOfflineAfterResumeCount = 0;
|
|
14
|
+
|
|
15
|
+
const mockComponentsLogger = {
|
|
16
|
+
log: jest.fn(),
|
|
17
|
+
debug: jest.fn(),
|
|
18
|
+
info: jest.fn(),
|
|
19
|
+
warning: jest.fn(),
|
|
20
|
+
error: jest.fn(),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
jest.mock("@applicaster/zapp-react-native-utils/logger", () => {
|
|
24
|
+
const actual = jest.requireActual(
|
|
25
|
+
"@applicaster/zapp-react-native-utils/logger"
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
...actual,
|
|
30
|
+
// Only the logger of this subsystem is replaced; every other module keeps its real one.
|
|
31
|
+
subsystemLogger: (subsystem: string) => {
|
|
32
|
+
if (subsystem !== "offline") {
|
|
33
|
+
return actual.subsystemLogger(subsystem);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const logger = {
|
|
37
|
+
log: (event) => mockComponentsLogger.log(event),
|
|
38
|
+
debug: (event) => mockComponentsLogger.debug(event),
|
|
39
|
+
info: (event) => mockComponentsLogger.info(event),
|
|
40
|
+
warning: (event) => mockComponentsLogger.warning(event),
|
|
41
|
+
error: (event) => mockComponentsLogger.error(event),
|
|
42
|
+
addSubsystem: () => logger,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return logger;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
jest.mock("../../../Helpers/logger", () => {
|
|
51
|
+
const proxy = {
|
|
52
|
+
log: (event) => mockComponentsLogger.log(event),
|
|
53
|
+
debug: (event) => mockComponentsLogger.debug(event),
|
|
54
|
+
info: (event) => mockComponentsLogger.info(event),
|
|
55
|
+
warning: (event) => mockComponentsLogger.warning(event),
|
|
56
|
+
error: (event) => mockComponentsLogger.error(event),
|
|
57
|
+
addSubsystem: () => proxy,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return { componentsLogger: proxy };
|
|
61
|
+
});
|
|
13
62
|
|
|
14
63
|
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/connection", () => {
|
|
15
64
|
return {
|
|
@@ -20,6 +69,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/connection", () => {
|
|
|
20
69
|
details: {},
|
|
21
70
|
isConnected: mockConnectionStatus,
|
|
22
71
|
isInternetReachable: mockConnectionStatus,
|
|
72
|
+
stillOfflineAfterResumeCount: mockStillOfflineAfterResumeCount,
|
|
23
73
|
})),
|
|
24
74
|
};
|
|
25
75
|
});
|
|
@@ -58,6 +108,7 @@ describe("OfflineHandler", () => {
|
|
|
58
108
|
|
|
59
109
|
beforeEach(() => {
|
|
60
110
|
mockConnectionStatus = false;
|
|
111
|
+
mockStillOfflineAfterResumeCount = 0;
|
|
61
112
|
});
|
|
62
113
|
|
|
63
114
|
it("renders its children without wrapping them in a notification view", () => {
|
|
@@ -131,4 +182,89 @@ describe("OfflineHandler", () => {
|
|
|
131
182
|
|
|
132
183
|
unsubscribe();
|
|
133
184
|
});
|
|
185
|
+
|
|
186
|
+
it("re-shows the offline toast when still offline after app resume", () => {
|
|
187
|
+
mockConnectionStatus = false;
|
|
188
|
+
|
|
189
|
+
const handleShowToast = jest.fn();
|
|
190
|
+
const unsubscribe = subscriberFor("showToast", handleShowToast);
|
|
191
|
+
|
|
192
|
+
const { rerender } = render(<OfflineHandler />);
|
|
193
|
+
handleShowToast.mockClear();
|
|
194
|
+
|
|
195
|
+
mockStillOfflineAfterResumeCount = 1;
|
|
196
|
+
rerender(<OfflineHandler />);
|
|
197
|
+
|
|
198
|
+
expect(handleShowToast).toHaveBeenCalledTimes(1);
|
|
199
|
+
|
|
200
|
+
expect(handleShowToast).toHaveBeenCalledWith(
|
|
201
|
+
expect.objectContaining({
|
|
202
|
+
id: "offline-status",
|
|
203
|
+
message: "No internet connection",
|
|
204
|
+
timeout: 5000,
|
|
205
|
+
}),
|
|
206
|
+
expect.any(Function)
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
// further renders with the same counter must not re-emit
|
|
210
|
+
rerender(<OfflineHandler />);
|
|
211
|
+
expect(handleShowToast).toHaveBeenCalledTimes(1);
|
|
212
|
+
|
|
213
|
+
unsubscribe();
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it("does not re-show the offline toast for a counter bump while online", () => {
|
|
217
|
+
mockConnectionStatus = true;
|
|
218
|
+
|
|
219
|
+
const handleShowToast = jest.fn();
|
|
220
|
+
const unsubscribe = subscriberFor("showToast", handleShowToast);
|
|
221
|
+
|
|
222
|
+
const { rerender } = render(<OfflineHandler />);
|
|
223
|
+
|
|
224
|
+
mockStillOfflineAfterResumeCount = 1;
|
|
225
|
+
rerender(<OfflineHandler />);
|
|
226
|
+
|
|
227
|
+
expect(handleShowToast).not.toHaveBeenCalled();
|
|
228
|
+
|
|
229
|
+
unsubscribe();
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it("does not emit on mount just because the counter is already > 0", () => {
|
|
233
|
+
mockConnectionStatus = true;
|
|
234
|
+
mockStillOfflineAfterResumeCount = 3;
|
|
235
|
+
|
|
236
|
+
const handleShowToast = jest.fn();
|
|
237
|
+
const unsubscribe = subscriberFor("showToast", handleShowToast);
|
|
238
|
+
|
|
239
|
+
render(<OfflineHandler />);
|
|
240
|
+
|
|
241
|
+
expect(handleShowToast).not.toHaveBeenCalled();
|
|
242
|
+
|
|
243
|
+
unsubscribe();
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
it("logs toast emissions at info level", () => {
|
|
247
|
+
mockConnectionStatus = false;
|
|
248
|
+
mockComponentsLogger.info.mockClear();
|
|
249
|
+
mockComponentsLogger.warning.mockClear();
|
|
250
|
+
|
|
251
|
+
const { rerender } = render(<OfflineHandler />);
|
|
252
|
+
|
|
253
|
+
mockConnectionStatus = true;
|
|
254
|
+
rerender(<OfflineHandler />);
|
|
255
|
+
|
|
256
|
+
expect(mockComponentsLogger.info).toHaveBeenCalledWith(
|
|
257
|
+
expect.objectContaining({
|
|
258
|
+
message: "OfflineHandler: device is offline, emit toast",
|
|
259
|
+
})
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
expect(mockComponentsLogger.info).toHaveBeenCalledWith(
|
|
263
|
+
expect.objectContaining({
|
|
264
|
+
message: "OfflineHandler: device is back online, emit toast",
|
|
265
|
+
})
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
expect(mockComponentsLogger.warning).not.toHaveBeenCalled();
|
|
269
|
+
});
|
|
134
270
|
});
|
|
@@ -4,10 +4,11 @@ import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/uti
|
|
|
4
4
|
import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
|
|
5
5
|
|
|
6
6
|
import { useOfflineHandlerProps } from "./hooks";
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
import { parseConnectionInfo } from "./utils";
|
|
9
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
9
10
|
|
|
10
|
-
const logger =
|
|
11
|
+
const logger = subsystemLogger("offline", "OfflineHandler");
|
|
11
12
|
|
|
12
13
|
// mirrors NOTIFICATION_TOAST_EVENTS.SHOW_TOAST in
|
|
13
14
|
// @applicaster/quick-brick-core/App/NotificationToastRenderer/NotificationToastManager
|
|
@@ -29,12 +30,22 @@ export const OfflineHandler = ({ children }: Props) => {
|
|
|
29
30
|
const { online } = parseConnectionInfo(connectionInfo);
|
|
30
31
|
const prevOnline = usePrevious(online);
|
|
31
32
|
|
|
33
|
+
const stillOfflineAfterResumeCount =
|
|
34
|
+
connectionInfo?.stillOfflineAfterResumeCount ?? 0;
|
|
35
|
+
|
|
36
|
+
const prevStillOfflineAfterResumeCount = usePrevious(
|
|
37
|
+
stillOfflineAfterResumeCount
|
|
38
|
+
);
|
|
39
|
+
|
|
32
40
|
const emitShowToast = useSubscriberFor(SHOW_TOAST_EVENT);
|
|
33
41
|
|
|
34
42
|
const { message, extraMessage, style } = useOfflineHandlerProps(online);
|
|
35
43
|
|
|
36
44
|
const showOnlineToast = useCallback(() => {
|
|
37
|
-
logger.
|
|
45
|
+
logger.info({
|
|
46
|
+
message: "OfflineHandler: device is back online, emit toast",
|
|
47
|
+
data: { online, prevOnline },
|
|
48
|
+
});
|
|
38
49
|
|
|
39
50
|
emitShowToast({
|
|
40
51
|
id: OFFLINE_STATUS_TOAST_ID,
|
|
@@ -43,10 +54,13 @@ export const OfflineHandler = ({ children }: Props) => {
|
|
|
43
54
|
style,
|
|
44
55
|
timeout: timers.goingOnline,
|
|
45
56
|
});
|
|
46
|
-
}, [emitShowToast, message, extraMessage, style]);
|
|
57
|
+
}, [emitShowToast, message, extraMessage, style, online, prevOnline]);
|
|
47
58
|
|
|
48
59
|
const showOfflineToast = useCallback(() => {
|
|
49
|
-
logger.
|
|
60
|
+
logger.info({
|
|
61
|
+
message: "OfflineHandler: device is offline, emit toast",
|
|
62
|
+
data: { online, prevOnline, stillOfflineAfterResumeCount },
|
|
63
|
+
});
|
|
50
64
|
|
|
51
65
|
emitShowToast({
|
|
52
66
|
id: OFFLINE_STATUS_TOAST_ID,
|
|
@@ -55,7 +69,15 @@ export const OfflineHandler = ({ children }: Props) => {
|
|
|
55
69
|
style,
|
|
56
70
|
timeout: timers.goingOffline,
|
|
57
71
|
});
|
|
58
|
-
}, [
|
|
72
|
+
}, [
|
|
73
|
+
emitShowToast,
|
|
74
|
+
message,
|
|
75
|
+
extraMessage,
|
|
76
|
+
style,
|
|
77
|
+
online,
|
|
78
|
+
prevOnline,
|
|
79
|
+
stillOfflineAfterResumeCount,
|
|
80
|
+
]);
|
|
59
81
|
|
|
60
82
|
useEffect(() => {
|
|
61
83
|
// On mount there is no previous state yet: only surface the offline toast
|
|
@@ -79,5 +101,22 @@ export const OfflineHandler = ({ children }: Props) => {
|
|
|
79
101
|
}
|
|
80
102
|
}, [online, prevOnline, showOfflineToast, showOnlineToast]);
|
|
81
103
|
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
// NetworkStatusProvider bumps this counter when the app resumed while offline
|
|
106
|
+
// and is still offline after the verification delay: remind the user.
|
|
107
|
+
if (
|
|
108
|
+
prevStillOfflineAfterResumeCount !== undefined &&
|
|
109
|
+
stillOfflineAfterResumeCount > prevStillOfflineAfterResumeCount &&
|
|
110
|
+
!online
|
|
111
|
+
) {
|
|
112
|
+
showOfflineToast();
|
|
113
|
+
}
|
|
114
|
+
}, [
|
|
115
|
+
stillOfflineAfterResumeCount,
|
|
116
|
+
prevStillOfflineAfterResumeCount,
|
|
117
|
+
online,
|
|
118
|
+
showOfflineToast,
|
|
119
|
+
]);
|
|
120
|
+
|
|
82
121
|
return children;
|
|
83
122
|
};
|
|
@@ -273,7 +273,10 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
273
273
|
const playEntry = (entry: ZappEntry) => navigator.replaceTop(entry, { mode });
|
|
274
274
|
|
|
275
275
|
const onPlayNextPerformNextVideoPlay = React.useCallback(() => {
|
|
276
|
-
|
|
276
|
+
// The overlay's entry, or the player's when the overlay is not showing yet (X-Ray player.next)
|
|
277
|
+
const nextEntry = playNextOverlayState?.entry ?? player?.getPlayNextEntry();
|
|
278
|
+
|
|
279
|
+
if (!nextEntry) {
|
|
277
280
|
log_warning(
|
|
278
281
|
"onPlayNextPerformNextVideoPlay: playNextOverlayState.entry is not defined"
|
|
279
282
|
);
|
|
@@ -282,16 +285,30 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
282
285
|
}
|
|
283
286
|
|
|
284
287
|
log_debug(
|
|
285
|
-
`onPlayNextPerformNextVideoPlay: delay completed, replaceTop to item: ${
|
|
288
|
+
`onPlayNextPerformNextVideoPlay: delay completed, replaceTop to item: ${nextEntry.title}, id: ${nextEntry.id}, outgoing item id: ${item?.id}`
|
|
286
289
|
);
|
|
287
290
|
|
|
288
|
-
|
|
291
|
+
(
|
|
292
|
+
playNextOverlayState?.hidePlayNext ??
|
|
293
|
+
player?.getOverlayObservable()?.hidePlayNext
|
|
294
|
+
)?.();
|
|
289
295
|
|
|
290
296
|
playerEvent(PLAYER_EVENTS.PlayNextTriggered, { id: item?.id });
|
|
291
297
|
|
|
292
298
|
setIsLoadingNextVideo(true);
|
|
293
|
-
playEntry(
|
|
294
|
-
}, [playNextOverlayState, item?.id]);
|
|
299
|
+
playEntry(nextEntry);
|
|
300
|
+
}, [playNextOverlayState, item?.id, player]);
|
|
301
|
+
|
|
302
|
+
// Lets the X-Ray player.next tool run the same Play Next path as the overlay.
|
|
303
|
+
useEffect(() => {
|
|
304
|
+
if (!player) return;
|
|
305
|
+
|
|
306
|
+
player.playNextHandler = onPlayNextPerformNextVideoPlay;
|
|
307
|
+
|
|
308
|
+
return () => {
|
|
309
|
+
player.playNextHandler = null;
|
|
310
|
+
};
|
|
311
|
+
}, [player, onPlayNextPerformNextVideoPlay]);
|
|
295
312
|
|
|
296
313
|
const playNextData: Nullable<PlayNextData> = React.useMemo(() => {
|
|
297
314
|
if (!playNextOverlayState) {
|
|
@@ -404,10 +421,17 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
404
421
|
const { eventType } = event;
|
|
405
422
|
|
|
406
423
|
if (!isLanguageOverlayVisible && eventType === "menu") {
|
|
424
|
+
// First Back dismisses Play Next, the next one closes the player
|
|
425
|
+
if (playNextOverlayState) {
|
|
426
|
+
playNextOverlayState.handleUserCancelPlayNext();
|
|
427
|
+
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
|
|
407
431
|
close();
|
|
408
432
|
}
|
|
409
433
|
},
|
|
410
|
-
[close]
|
|
434
|
+
[close, playNextOverlayState]
|
|
411
435
|
);
|
|
412
436
|
|
|
413
437
|
// Effects
|
|
@@ -127,6 +127,8 @@ jest.mock(
|
|
|
127
127
|
seekTo: jest.fn(),
|
|
128
128
|
getPluginConfiguration: jest.fn(() => ({})),
|
|
129
129
|
getOverlayObservable: jest.fn(() => ({ getPlayNextEntry: () => null })),
|
|
130
|
+
getPlayNextEntry: jest.fn(() => null),
|
|
131
|
+
playNextHandler: null,
|
|
130
132
|
};
|
|
131
133
|
|
|
132
134
|
return {
|
|
@@ -335,3 +337,52 @@ describe("PlayerContainer hardware back handling", () => {
|
|
|
335
337
|
expect(mockNavigator.closeVideoModal).not.toHaveBeenCalled();
|
|
336
338
|
});
|
|
337
339
|
});
|
|
340
|
+
|
|
341
|
+
describe("PlayerContainer Play Next action for X-Ray player.next", () => {
|
|
342
|
+
beforeEach(() => {
|
|
343
|
+
jest.clearAllMocks();
|
|
344
|
+
mockIsTV.mockReturnValue(false);
|
|
345
|
+
mockPlayer.getPluginConfiguration.mockReturnValue({});
|
|
346
|
+
mockPlayerManager.getPluginConfiguration.mockReturnValue({});
|
|
347
|
+
mockPlayerManager.on.mockReturnThis();
|
|
348
|
+
mockPlayerManager.removeHandler.mockReturnThis();
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
it("sets its Play Next action on the player and clears it on unmount", () => {
|
|
352
|
+
const { unmount } = renderPlayerContainer();
|
|
353
|
+
|
|
354
|
+
expect(mockPlayer.playNextHandler).toEqual(expect.any(Function));
|
|
355
|
+
|
|
356
|
+
unmount();
|
|
357
|
+
|
|
358
|
+
expect(mockPlayer.playNextHandler).toBeNull();
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
it("plays the player's next entry once, with analytics and the overlay hidden, when the overlay is not showing", () => {
|
|
362
|
+
const next = { id: "entry-2", title: "Next" };
|
|
363
|
+
const hidePlayNext = jest.fn();
|
|
364
|
+
mockPlayer.getPlayNextEntry.mockReturnValue(next);
|
|
365
|
+
|
|
366
|
+
mockPlayer.getOverlayObservable.mockReturnValue({
|
|
367
|
+
getPlayNextEntry: () => next,
|
|
368
|
+
hidePlayNext,
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
renderPlayerContainer();
|
|
372
|
+
|
|
373
|
+
mockPlayer.playNextHandler();
|
|
374
|
+
|
|
375
|
+
expect(hidePlayNext).toHaveBeenCalledTimes(1);
|
|
376
|
+
|
|
377
|
+
expect(mockPlayerManager.invokeHandler).toHaveBeenCalledWith(
|
|
378
|
+
"play_next_triggered",
|
|
379
|
+
{ id: "entry-1" }
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
expect(mockNavigator.replaceTop).toHaveBeenCalledTimes(1);
|
|
383
|
+
|
|
384
|
+
expect(mockNavigator.replaceTop).toHaveBeenCalledWith(next, {
|
|
385
|
+
mode: VideoModalMode.MAXIMIZED,
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
});
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createLogger,
|
|
3
|
+
subsystemLogger,
|
|
4
|
+
} from "@applicaster/zapp-react-native-utils/logger";
|
|
3
5
|
|
|
4
6
|
export const { log_verbose, log_error, log_debug, log_info, log_warning } =
|
|
5
|
-
createLogger({ category: "
|
|
7
|
+
createLogger({ category: "PlayerContainer", subsystem: "player/container" });
|
|
6
8
|
|
|
7
|
-
export const playerContainerLogger =
|
|
8
|
-
|
|
9
|
+
export const playerContainerLogger = subsystemLogger(
|
|
10
|
+
"player/container",
|
|
11
|
+
"PlayerContainer"
|
|
12
|
+
);
|
|
@@ -118,7 +118,10 @@ function ComponentsMapComponent(props: Props) {
|
|
|
118
118
|
};
|
|
119
119
|
|
|
120
120
|
return (
|
|
121
|
-
<ScreenLoadingMeasurementsListItemWrapper
|
|
121
|
+
<ScreenLoadingMeasurementsListItemWrapper
|
|
122
|
+
index={index}
|
|
123
|
+
testID={`component-${item.id}`}
|
|
124
|
+
>
|
|
122
125
|
<RiverItem {...riverItemProps} />
|
|
123
126
|
</ScreenLoadingMeasurementsListItemWrapper>
|
|
124
127
|
);
|
|
@@ -213,6 +213,7 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
213
213
|
<View
|
|
214
214
|
onLayout={[Function]}
|
|
215
215
|
style={{}}
|
|
216
|
+
testID="component-A1"
|
|
216
217
|
>
|
|
217
218
|
<View />
|
|
218
219
|
</View>
|
|
@@ -225,6 +226,7 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
225
226
|
<View
|
|
226
227
|
onLayout={[Function]}
|
|
227
228
|
style={{}}
|
|
229
|
+
testID="component-A2"
|
|
228
230
|
/>
|
|
229
231
|
</View>
|
|
230
232
|
<View
|
|
@@ -3,9 +3,9 @@ import { PreloaderWrapper } from "../PreloaderWrapper";
|
|
|
3
3
|
import { useScreenContextV2 } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
4
4
|
import { useFeedLoader } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
7
7
|
|
|
8
|
-
const logger =
|
|
8
|
+
const logger = subsystemLogger("ui/screens", "ScreenFeedLoader");
|
|
9
9
|
|
|
10
10
|
/** Loads and provides `feedData` and store to */
|
|
11
11
|
export const ScreenFeedLoader: React.FC<{
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
import { componentsLogger } from "../../Helpers/logger";
|
|
4
|
-
|
|
5
3
|
import { useScreenAnalytics } from "@applicaster/zapp-react-native-utils/analyticsUtils/helpers/hooks";
|
|
6
4
|
|
|
7
5
|
import { ScreenResultCallback } from "@applicaster/zapp-react-native-utils/zappFrameworkUtils/HookCallback/callbackNavigationAction";
|
|
8
6
|
import { useScreenComponentResolver } from "./hooks/useScreenComponentResolver";
|
|
9
7
|
import { withDefaultScreenContext } from "./withDefaultScreenContext";
|
|
8
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
10
9
|
|
|
11
10
|
export enum PresentationType {
|
|
12
11
|
Standalone = "Standalone",
|
|
13
12
|
Hook = "Hook",
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
const logger =
|
|
15
|
+
const logger = subsystemLogger("ui/screens", "ScreenResolver");
|
|
17
16
|
|
|
18
17
|
type Props = {
|
|
19
18
|
screenType: string;
|
|
@@ -66,7 +66,7 @@ export class AnimationManager {
|
|
|
66
66
|
*
|
|
67
67
|
* @param {object} to contains style to animate and scenes index
|
|
68
68
|
* @param {string} action push|back
|
|
69
|
-
* @param {number} stepsBack number of steps back
|
|
69
|
+
* @param {number} [stepsBack] number of steps back, used by the back action only
|
|
70
70
|
*/
|
|
71
71
|
stateForAction({ to, scenes }, action, stepsBack) {
|
|
72
72
|
let rootIndex = to.index;
|
|
@@ -17,13 +17,14 @@ const fullWidthDimensions = {
|
|
|
17
17
|
type Props = {
|
|
18
18
|
children: any;
|
|
19
19
|
style: any;
|
|
20
|
-
pointerEvents
|
|
21
|
-
overlayStyle
|
|
22
|
-
animating
|
|
20
|
+
pointerEvents?: ViewProps["pointerEvents"];
|
|
21
|
+
overlayStyle?: ViewStyle;
|
|
22
|
+
animating?: boolean;
|
|
23
23
|
contentStyle: ViewStyle;
|
|
24
24
|
pathname: string;
|
|
25
25
|
isActive: boolean;
|
|
26
26
|
screenData: NavigationScreenData;
|
|
27
|
+
screenUniqueId?: string;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
export function CurrentScreenContextProvider({
|