@applicaster/zapp-react-native-ui-components 13.0.0-alpha.3755455151 → 13.0.0-alpha.3923423021
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.ios.ts +1 -1
- package/Components/BaseFocusable/index.tsx +2 -3
- package/Components/Cell/Cell.tsx +8 -3
- package/Components/Cell/CellWithFocusable.ios.tsx +126 -0
- package/Components/Cell/CellWithFocusable.tsx +43 -58
- package/Components/Cell/TvOSCellComponent.tsx +20 -26
- package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
- 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/ErrorScreen/index.tsx +6 -6
- package/Components/Focusable/Focusable.tsx +1 -0
- package/Components/Focusable/FocusableTvOS.tsx +6 -2
- package/Components/Focusable/Touchable.tsx +19 -20
- package/Components/Focusable/index.android.tsx +10 -3
- package/Components/FocusableList/index.tsx +26 -10
- 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/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +6 -12
- package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
- package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- 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/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
- package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
- package/Components/MasterCell/utils/index.ts +1 -1
- package/Components/ModalComponent/Button/index.tsx +6 -6
- package/Components/ModalComponent/Header/index.tsx +3 -3
- package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
- package/Components/PlayerContainer/PlayerContainer.tsx +11 -15
- package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
- package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
- package/Components/PlayerImageBackground/index.tsx +23 -3
- package/Components/River/ComponentsMap/ComponentsMap.tsx +39 -65
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
- package/Components/River/RiverFooter.tsx +39 -9
- package/Components/River/RiverItem.tsx +37 -2
- package/Components/River/TV/index.tsx +6 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +100 -31
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
- package/Components/River/__tests__/componentsMap.test.js +17 -5
- 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/Screen/hooks.ts +56 -0
- package/Components/Screen/index.tsx +16 -42
- package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
- package/Components/Tabs/Tab.tsx +11 -9
- package/Components/TextInputTv/index.tsx +4 -3
- package/Components/Transitioner/AnimationManager.js +8 -8
- package/Components/Transitioner/Scene.tsx +53 -24
- package/Components/Transitioner/Transitioner.tsx +3 -3
- package/Components/Transitioner/__tests__/Scene.test.js +25 -14
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +9 -49
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
- package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
- package/Components/Transitioner/index.js +8 -4
- package/Components/VideoLive/LiveImageManager.ts +27 -1
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +32 -24
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +51 -1
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +0 -5
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +16 -12
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +5 -1
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +15 -14
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +2 -3
- package/Components/VideoModal/ModalAnimation/utils.ts +2 -2
- package/Components/VideoModal/OpaqueLayer.tsx +33 -0
- package/Components/VideoModal/PlayerDetails.tsx +9 -6
- package/Components/VideoModal/PlayerWrapper.tsx +17 -36
- package/Components/VideoModal/VideoModal.tsx +14 -23
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -1
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +0 -90
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
- package/Components/VideoModal/hooks/index.ts +7 -0
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
- package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
- package/Components/VideoModal/hooks/utils/index.ts +33 -0
- package/Components/VideoModal/utils.ts +1 -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/Contexts/ScreenContext/index.tsx +3 -2
- 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__/Hero.js +1 -1
- package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
- package/Decorators/ZappPipesDataConnector/index.tsx +31 -1
- package/package.json +7 -7
- 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,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
|
+
|
|
4
|
+
import { Scene } from "../Scene";
|
|
4
5
|
|
|
5
6
|
const overlayStyle = { opacity: 1 };
|
|
6
7
|
const contentStyle = { paddingBottom: 49 };
|
|
@@ -23,28 +24,38 @@ jest.mock(
|
|
|
23
24
|
})
|
|
24
25
|
);
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
jest.mock("../../../Contexts/PathnameContext", () => ({
|
|
28
|
+
PathnameContext: jest.requireActual("react").createContext({ pathname: "" }),
|
|
29
|
+
}));
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
31
|
+
jest.mock("../../../Contexts/ScreenDataContext", () => ({
|
|
32
|
+
ScreenDataContext: jest.requireActual("react").createContext({}),
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
jest.mock("../../../Contexts/ScreenContext", () => ({
|
|
36
|
+
ScreenContextProvider: jest.requireActual("react-native").View,
|
|
37
|
+
}));
|
|
35
38
|
|
|
36
39
|
describe("<Scene />", () => {
|
|
40
|
+
const wrapper = render(
|
|
41
|
+
<Scene
|
|
42
|
+
style={style}
|
|
43
|
+
overlayStyle={overlayStyle}
|
|
44
|
+
contentStyle={contentStyle}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
|
|
37
48
|
it("renders correctly", () => {
|
|
38
|
-
expect(
|
|
49
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
39
50
|
});
|
|
40
51
|
|
|
41
52
|
// skipped - this isn't a very useful test, and it doesn't work as it used to on the new version of RN
|
|
42
53
|
it.skip("renders children surrounded by AnimatedComponent", () => {
|
|
43
|
-
expect(
|
|
54
|
+
expect(wrapper.toJSON()).toEqual("AnimatedComponent");
|
|
44
55
|
});
|
|
45
56
|
|
|
46
57
|
it("renders the overlay while animating", () => {
|
|
47
|
-
const wrapperWithOverlay =
|
|
58
|
+
const wrapperWithOverlay = render(
|
|
48
59
|
<Scene
|
|
49
60
|
style={style}
|
|
50
61
|
overlayStyle={overlayStyle}
|
|
@@ -53,6 +64,6 @@ describe("<Scene />", () => {
|
|
|
53
64
|
/>
|
|
54
65
|
);
|
|
55
66
|
|
|
56
|
-
expect(
|
|
67
|
+
expect(wrapperWithOverlay.toJSON).toMatchSnapshot();
|
|
57
68
|
});
|
|
58
69
|
});
|
|
@@ -1,63 +1,23 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<Scene /> renders correctly 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
<View>
|
|
5
|
+
<View
|
|
6
|
+
collapsable={false}
|
|
7
|
+
pointerEvents="auto"
|
|
8
|
+
style={
|
|
8
9
|
{
|
|
9
10
|
"flex": 1,
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"paddingBottom": 49,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
11
|
"fontScale": 2,
|
|
16
12
|
"height": 1334,
|
|
13
|
+
"paddingBottom": 49,
|
|
17
14
|
"scale": 2,
|
|
18
15
|
"statusBarHeight": null,
|
|
19
16
|
"width": 750,
|
|
20
|
-
},
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
>
|
|
24
|
-
<ContextProvider>
|
|
25
|
-
<ContextProvider>
|
|
26
|
-
<ScreenContextProvider />
|
|
27
|
-
</ContextProvider>
|
|
28
|
-
</ContextProvider>
|
|
29
|
-
</ForwardRef(AnimatedComponentWrapper)>
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
exports[`<Scene /> renders the overlay while animating 1`] = `
|
|
33
|
-
<ForwardRef(AnimatedComponentWrapper)
|
|
34
|
-
pointerEvents="auto"
|
|
35
|
-
style={
|
|
36
|
-
[
|
|
37
|
-
{
|
|
38
|
-
"flex": 1,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"paddingBottom": 49,
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"height": "100%",
|
|
45
|
-
"width": "100%",
|
|
46
|
-
},
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
>
|
|
50
|
-
<ContextProvider>
|
|
51
|
-
<ContextProvider>
|
|
52
|
-
<ScreenContextProvider />
|
|
53
|
-
</ContextProvider>
|
|
54
|
-
</ContextProvider>
|
|
55
|
-
<ForwardRef(AnimatedComponentWrapper)
|
|
56
|
-
style={
|
|
57
|
-
{
|
|
58
|
-
"opacity": 1,
|
|
59
17
|
}
|
|
60
18
|
}
|
|
61
19
|
/>
|
|
62
|
-
</
|
|
20
|
+
</View>
|
|
63
21
|
`;
|
|
22
|
+
|
|
23
|
+
exports[`<Scene /> renders the overlay while animating 1`] = `[Function]`;
|
|
@@ -9,7 +9,7 @@ exports[`<TransitionerComponent /> renders correctly 1`] = `
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
>
|
|
12
|
-
<
|
|
12
|
+
<View
|
|
13
13
|
isActive={true}
|
|
14
14
|
screenUniqueId="mocked-uuid"
|
|
15
15
|
style={{}}
|
|
@@ -23,6 +23,6 @@ exports[`<TransitionerComponent /> renders correctly 1`] = `
|
|
|
23
23
|
children
|
|
24
24
|
</Text>
|
|
25
25
|
</View>
|
|
26
|
-
</
|
|
26
|
+
</View>
|
|
27
27
|
</View>
|
|
28
28
|
`;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Text, View } from "react-native";
|
|
3
|
-
import { shallow } from "enzyme";
|
|
4
|
-
import { shallowToJson } from "enzyme-to-json";
|
|
5
3
|
|
|
6
4
|
import { TransitionerComponent } from "../Transitioner";
|
|
5
|
+
import { render } from "@testing-library/react-native";
|
|
6
|
+
|
|
7
|
+
jest.mock("../Scene", () => {
|
|
8
|
+
const View = jest.requireActual("react-native").View;
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
Scene(props) {
|
|
12
|
+
return <View {...props} />;
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
});
|
|
7
16
|
|
|
8
17
|
const children = (
|
|
9
18
|
<View foo="bar">
|
|
@@ -33,12 +42,12 @@ jest.mock("uuid");
|
|
|
33
42
|
|
|
34
43
|
describe("<TransitionerComponent />", () => {
|
|
35
44
|
it("renders correctly", () => {
|
|
36
|
-
const wrapper =
|
|
45
|
+
const wrapper = render(
|
|
37
46
|
<TransitionerComponent {...transitionerComponentProps}>
|
|
38
47
|
{children}
|
|
39
48
|
</TransitionerComponent>
|
|
40
49
|
);
|
|
41
50
|
|
|
42
|
-
expect(
|
|
51
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
43
52
|
});
|
|
44
53
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { useWindowDimensions } from "react-native";
|
|
3
2
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
4
3
|
import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks/layout";
|
|
5
4
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
@@ -7,10 +6,15 @@ import { TransitionerComponent } from "./Transitioner";
|
|
|
7
6
|
|
|
8
7
|
export const Transitioner = (props) => {
|
|
9
8
|
const navigator = useNavigation();
|
|
10
|
-
const { height, width } = useWindowDimensions();
|
|
11
9
|
|
|
12
|
-
const
|
|
13
|
-
|
|
10
|
+
const {
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
deviceInfo: { isTablet },
|
|
14
|
+
} = useDimensions("window", {
|
|
15
|
+
updateForInactiveScreens: false,
|
|
16
|
+
deviceInfo: true,
|
|
17
|
+
});
|
|
14
18
|
|
|
15
19
|
const { appData } = usePickFromState(["appData"]);
|
|
16
20
|
const isTabletPortrait = appData?.isTabletPortrait;
|
|
@@ -8,6 +8,8 @@ import { loggerLiveImageManager } from "./loggerHelper";
|
|
|
8
8
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
9
9
|
import { Component } from "react";
|
|
10
10
|
|
|
11
|
+
const TIMEOUT_FOR_DELAY_CHECK_PLAYER_POSITION = 500; // ms
|
|
12
|
+
|
|
11
13
|
const { log_debug, log_info, log_error } = loggerLiveImageManager;
|
|
12
14
|
|
|
13
15
|
export type LiveImageManagerEvent =
|
|
@@ -62,6 +64,9 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
62
64
|
protected currentlyPlaying: LiveImage | null = null;
|
|
63
65
|
protected primaryPlayer: Player | null = null;
|
|
64
66
|
|
|
67
|
+
private checkPlayerPositionTimeout: ReturnType<typeof setTimeout> | null =
|
|
68
|
+
null;
|
|
69
|
+
|
|
65
70
|
protected listeners: Record<
|
|
66
71
|
string,
|
|
67
72
|
Record<LiveImageManagerEvent, (event?: Record<string, any>) => void>
|
|
@@ -118,6 +123,11 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
118
123
|
});
|
|
119
124
|
};
|
|
120
125
|
|
|
126
|
+
private cancelCheckPlayerPositionTimeout = () => {
|
|
127
|
+
clearTimeout(this.checkPlayerPositionTimeout);
|
|
128
|
+
this.checkPlayerPositionTimeout = null;
|
|
129
|
+
};
|
|
130
|
+
|
|
121
131
|
public onViewportEnter = (item: LiveImage) => {
|
|
122
132
|
log_debug(
|
|
123
133
|
`onViewportEnter: live-image ${playerInfo(
|
|
@@ -125,7 +135,21 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
125
135
|
)}, primary ${playerInfo(this.primaryPlayer)}`
|
|
126
136
|
);
|
|
127
137
|
|
|
128
|
-
|
|
138
|
+
if (!isTV()) {
|
|
139
|
+
// mobile only
|
|
140
|
+
// we have to delay running checkPlayerPosition, because sometimes on fast scrolling we get wrong order onEnter, then onLeave.
|
|
141
|
+
// which could cause select wrong item to play
|
|
142
|
+
|
|
143
|
+
this.cancelCheckPlayerPositionTimeout();
|
|
144
|
+
|
|
145
|
+
this.checkPlayerPositionTimeout = setTimeout(() => {
|
|
146
|
+
this.cancelCheckPlayerPositionTimeout();
|
|
147
|
+
|
|
148
|
+
this.checkPlayerPosition(item);
|
|
149
|
+
}, TIMEOUT_FOR_DELAY_CHECK_PLAYER_POSITION);
|
|
150
|
+
} else {
|
|
151
|
+
this.checkPlayerPosition(item);
|
|
152
|
+
}
|
|
129
153
|
};
|
|
130
154
|
|
|
131
155
|
public onViewportLeave = (item: LiveImage) => {
|
|
@@ -246,6 +270,8 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
246
270
|
};
|
|
247
271
|
|
|
248
272
|
public checkPlayerPosition = (item: LiveImage) => {
|
|
273
|
+
this.cancelCheckPlayerPositionTimeout();
|
|
274
|
+
|
|
249
275
|
log_debug(
|
|
250
276
|
`checkPlayerPosition: live-image playerId: ${playerInfo(
|
|
251
277
|
item.player
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// /// <reference types="@applicaster/applicaster-types" />
|
|
2
2
|
//
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import { useEffect } from "react";
|
|
4
5
|
|
|
5
6
|
import { AppState, AppStateStatus, View } from "react-native";
|
|
6
7
|
import { TrackedView } from "../TrackedView";
|
|
@@ -25,7 +26,6 @@ import { PlayerRole } from "@applicaster/zapp-react-native-utils/appUtils/player
|
|
|
25
26
|
import { getAutoplaySettings } from "./utils";
|
|
26
27
|
import { isString } from "@applicaster/zapp-react-native-utils/stringUtils";
|
|
27
28
|
import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
|
|
28
|
-
import { useEffect } from "react";
|
|
29
29
|
|
|
30
30
|
const { log_error, log_debug } = loggerLiveImageComponent;
|
|
31
31
|
|
|
@@ -44,7 +44,10 @@ type Props = {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
const PlayerLiveImageComponent = (props: Props) => {
|
|
47
|
-
const dimensions = useDimensions("screen", {
|
|
47
|
+
const dimensions = useDimensions("screen", {
|
|
48
|
+
fullDimensions: true,
|
|
49
|
+
updateForInactiveScreens: false,
|
|
50
|
+
});
|
|
48
51
|
|
|
49
52
|
const { item, style, playerId } = props;
|
|
50
53
|
|
|
@@ -135,13 +138,16 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
135
138
|
} else {
|
|
136
139
|
throw new Error("Player factory item is null");
|
|
137
140
|
}
|
|
138
|
-
}, [playerId, item, playerPluginId, screenConfig]);
|
|
141
|
+
}, [playerId, item.id, playerPluginId, screenConfig]);
|
|
139
142
|
|
|
140
143
|
React.useEffect(() => {
|
|
141
144
|
liveImageItem.setMode = setModeDebounced;
|
|
142
145
|
}, [setModeDebounced, liveImageItem]);
|
|
143
146
|
|
|
144
|
-
const { start, end } = React.useMemo(
|
|
147
|
+
const { start, end } = React.useMemo(
|
|
148
|
+
() => getAutoplaySettings(item),
|
|
149
|
+
[item.id]
|
|
150
|
+
);
|
|
145
151
|
|
|
146
152
|
const controller = liveImageItem.getPlayer();
|
|
147
153
|
const player = usePlayer(playerId);
|
|
@@ -174,7 +180,7 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
174
180
|
|
|
175
181
|
unregister();
|
|
176
182
|
};
|
|
177
|
-
}, [item, liveImageItem]);
|
|
183
|
+
}, [item.id, liveImageItem]);
|
|
178
184
|
|
|
179
185
|
React.useEffect(() => {
|
|
180
186
|
if (!player) {
|
|
@@ -244,25 +250,27 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
244
250
|
}, [item.id]);
|
|
245
251
|
|
|
246
252
|
React.useEffect(() => {
|
|
247
|
-
if (playerManager) {
|
|
248
|
-
|
|
253
|
+
if (isMeasurement(item) || !playerManager) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
249
256
|
|
|
250
|
-
|
|
251
|
-
log_error(
|
|
252
|
-
`PlayerLiveImageComponent: player ${playerId} already registered`
|
|
253
|
-
);
|
|
254
|
-
} else {
|
|
255
|
-
playerManager.registerPlayer({
|
|
256
|
-
id: playerId,
|
|
257
|
-
playerController: controller,
|
|
258
|
-
});
|
|
257
|
+
const isPlayerRegistered = playerManager.isPlayerRegistered(playerId);
|
|
259
258
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
259
|
+
if (isPlayerRegistered) {
|
|
260
|
+
log_error(
|
|
261
|
+
`PlayerLiveImageComponent: player ${playerId} already registered`
|
|
262
|
+
);
|
|
263
|
+
} else {
|
|
264
|
+
playerManager.registerPlayer({
|
|
265
|
+
id: playerId,
|
|
266
|
+
playerController: controller,
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
return () => {
|
|
270
|
+
playerManager.unregisterPlayer(playerId);
|
|
271
|
+
};
|
|
264
272
|
}
|
|
265
|
-
}, [liveImageItem, playerId, controller]);
|
|
273
|
+
}, [liveImageItem, playerId, controller, item.id]);
|
|
266
274
|
|
|
267
275
|
const onPositionUpdated = React.useCallback(
|
|
268
276
|
(data) => {
|
|
@@ -302,7 +310,7 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
302
310
|
LiveImageManager.instance.checkPlayerPosition(liveImageItem);
|
|
303
311
|
}
|
|
304
312
|
},
|
|
305
|
-
[liveImageItem, dimensions]
|
|
313
|
+
[liveImageItem, dimensions.height, dimensions.width]
|
|
306
314
|
);
|
|
307
315
|
|
|
308
316
|
const platformSpecificProps = isApplePlatform()
|
|
@@ -322,7 +330,7 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
322
330
|
onPositionUpdated={onPositionUpdated}
|
|
323
331
|
>
|
|
324
332
|
<View ref={trackViewRef}>
|
|
325
|
-
{isVideoMode
|
|
333
|
+
{isVideoMode ? (
|
|
326
334
|
<Player
|
|
327
335
|
autoplay={false}
|
|
328
336
|
ref={_assignRoot}
|
|
@@ -334,7 +342,7 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
334
342
|
resizeMode={"cover"}
|
|
335
343
|
{...platformSpecificProps}
|
|
336
344
|
/>
|
|
337
|
-
)}
|
|
345
|
+
) : null}
|
|
338
346
|
{
|
|
339
347
|
<AnimatedInOut
|
|
340
348
|
visible={isBackgroundImageVisible}
|
|
@@ -4,6 +4,7 @@ import { render } from "@testing-library/react-native";
|
|
|
4
4
|
import * as PlayerFactory from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerFactory";
|
|
5
5
|
import { ThemeContext } from "@applicaster/zapp-react-native-utils/theme";
|
|
6
6
|
import * as navigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
7
|
+
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
|
|
7
8
|
|
|
8
9
|
import { PlayerLiveImage } from "../PlayerLiveImageComponent";
|
|
9
10
|
import * as useNavigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
|
|
@@ -32,7 +33,7 @@ const mockStore = configureStore();
|
|
|
32
33
|
|
|
33
34
|
const store = mockStore({ appData: {} });
|
|
34
35
|
|
|
35
|
-
const Wrapper = ({ children }: { children: React.
|
|
36
|
+
const Wrapper = ({ children }: { children: React.ReactNode }) => (
|
|
36
37
|
/* @ts-ignore */
|
|
37
38
|
<Provider store={store}>
|
|
38
39
|
<ThemeContext.Provider
|
|
@@ -118,4 +119,53 @@ describe("PlayerLiveImageComponent", () => {
|
|
|
118
119
|
|
|
119
120
|
// TODO: implement this test
|
|
120
121
|
});
|
|
122
|
+
|
|
123
|
+
it("should register the player for normal item", () => {
|
|
124
|
+
render(
|
|
125
|
+
<Wrapper>
|
|
126
|
+
<PlayerLiveImage {...defaultProps} />
|
|
127
|
+
</Wrapper>
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
const isPlayerRegistered = playerManager.isPlayerRegistered(
|
|
131
|
+
defaultProps.playerId
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
expect(isPlayerRegistered).toBe(true);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it("should unregister the player for normal item", () => {
|
|
138
|
+
const component = render(
|
|
139
|
+
<Wrapper>
|
|
140
|
+
<PlayerLiveImage {...defaultProps} />
|
|
141
|
+
</Wrapper>
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
component.unmount();
|
|
145
|
+
|
|
146
|
+
const isPlayerRegistered = playerManager.isPlayerRegistered(
|
|
147
|
+
defaultProps.playerId
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
expect(isPlayerRegistered).toBe(false);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("should not register the player for 'pre-measurement' item", () => {
|
|
154
|
+
const props = {
|
|
155
|
+
...defaultProps,
|
|
156
|
+
item: {
|
|
157
|
+
...defaultProps.item,
|
|
158
|
+
id: "pre-measurement-1",
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
render(
|
|
163
|
+
<Wrapper>
|
|
164
|
+
<PlayerLiveImage {...props} />
|
|
165
|
+
</Wrapper>
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
const isPlayerRegistered = playerManager.isPlayerRegistered(props.playerId);
|
|
169
|
+
expect(isPlayerRegistered).toBe(false);
|
|
170
|
+
});
|
|
121
171
|
});
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Animated, StyleSheet, View
|
|
2
|
+
import { Animated, Platform, StyleSheet, View } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
5
5
|
import {
|
|
6
|
+
GestureHandlerRootView,
|
|
6
7
|
NativeViewGestureHandler,
|
|
7
8
|
PanGestureHandler,
|
|
8
9
|
State,
|
|
9
10
|
TapGestureHandler,
|
|
10
|
-
GestureHandlerRootView,
|
|
11
11
|
} from "react-native-gesture-handler";
|
|
12
12
|
|
|
13
13
|
import { PlayerContainerContext } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainerContext";
|
|
14
14
|
import {
|
|
15
|
-
useModalAnimationContext,
|
|
16
15
|
PlayerAnimationStateEnum,
|
|
16
|
+
useModalAnimationContext,
|
|
17
17
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
18
18
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
19
19
|
import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
|
-
setScrollModalAnimatedValue,
|
|
23
22
|
resetScrollAnimatedValues,
|
|
23
|
+
setScrollModalAnimatedValue,
|
|
24
24
|
} from "./utils";
|
|
25
25
|
|
|
26
26
|
const getAnimatedConfig = (toValue) => {
|
|
@@ -62,14 +62,17 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
62
62
|
} = useModalAnimationContext();
|
|
63
63
|
|
|
64
64
|
const [enableGesture, setIEnableGesture] = React.useState<boolean>(true);
|
|
65
|
-
|
|
65
|
+
|
|
66
|
+
const { isLanguageOverlayVisible, isSeekBarTouch } = React.useContext(
|
|
67
|
+
PlayerContainerContext
|
|
68
|
+
);
|
|
66
69
|
|
|
67
70
|
const { maximiseVideoModal, minimiseVideoModal, videoModalState } =
|
|
68
71
|
useNavigation();
|
|
69
72
|
|
|
70
73
|
const { mode: videoModalMode, item: videoModalItem } = videoModalState;
|
|
71
|
-
const
|
|
72
|
-
const isMinimizedModal = videoModalMode === "MINIMIZED";
|
|
74
|
+
const isMaximizedModal: boolean = videoModalMode === "MAXIMIZED";
|
|
75
|
+
const isMinimizedModal: boolean = videoModalMode === "MINIMIZED";
|
|
73
76
|
const previousItemId = usePrevious(videoModalItem?.id);
|
|
74
77
|
|
|
75
78
|
const isNotMinimizeMaximazeAnimation =
|
|
@@ -80,7 +83,8 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
80
83
|
enableGesture &&
|
|
81
84
|
!isLanguageOverlayVisible &&
|
|
82
85
|
isNotMinimizeMaximazeAnimation &&
|
|
83
|
-
|
|
86
|
+
!isSeekBarTouch &&
|
|
87
|
+
(isMaximizedModal || isMinimizedModal);
|
|
84
88
|
|
|
85
89
|
const isAudioItem = React.useMemo(
|
|
86
90
|
() =>
|
|
@@ -342,6 +346,8 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
342
346
|
[]
|
|
343
347
|
);
|
|
344
348
|
|
|
349
|
+
const scrollEnabled = isMaximizedModal && isNotMinimizeMaximazeAnimation;
|
|
350
|
+
|
|
345
351
|
return (
|
|
346
352
|
<Wrapper style={generalStyles.container}>
|
|
347
353
|
<TapGestureHandler
|
|
@@ -355,7 +361,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
355
361
|
enabled={isEnablePanGesture}
|
|
356
362
|
ref={panHandlerRef}
|
|
357
363
|
simultaneousHandlers={[scrollRef, tapHandlerRef]}
|
|
358
|
-
shouldCancelWhenOutside={
|
|
364
|
+
shouldCancelWhenOutside={isMaximizedModal}
|
|
359
365
|
onGestureEvent={onGestureEvent}
|
|
360
366
|
onHandlerStateChange={onHandlerStateChange}
|
|
361
367
|
activeOffsetY={[-5, 5]}
|
|
@@ -367,9 +373,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
367
373
|
simultaneousHandlers={panHandlerRef}
|
|
368
374
|
>
|
|
369
375
|
<Animated.ScrollView
|
|
370
|
-
scrollEnabled={
|
|
371
|
-
isMaximazedModal && isNotMinimizeMaximazeAnimation
|
|
372
|
-
}
|
|
376
|
+
scrollEnabled={scrollEnabled}
|
|
373
377
|
bounces={false}
|
|
374
378
|
onScrollBeginDrag={onRegisterLastScroll}
|
|
375
379
|
onScroll={onScroll}
|
|
@@ -41,7 +41,10 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
41
41
|
videoModalState: { mode: videoModalMode },
|
|
42
42
|
} = useNavigation();
|
|
43
43
|
|
|
44
|
-
const { isLanguageOverlayVisible } = React.useContext(
|
|
44
|
+
const { isLanguageOverlayVisible, isSeekBarTouch } = React.useContext(
|
|
45
|
+
PlayerContainerContext
|
|
46
|
+
);
|
|
47
|
+
|
|
45
48
|
const isMaximazedModal = videoModalMode === "MAXIMIZED";
|
|
46
49
|
const isMinimizedModal = videoModalMode === "MINIMIZED";
|
|
47
50
|
|
|
@@ -52,6 +55,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
52
55
|
const isEnablePanGesture =
|
|
53
56
|
!isLanguageOverlayVisible &&
|
|
54
57
|
isNotMinimizeMaximazeAnimation &&
|
|
58
|
+
!isSeekBarTouch &&
|
|
55
59
|
(isMaximazedModal || isMinimizedModal);
|
|
56
60
|
|
|
57
61
|
const onGestureEvent = Animated.event(
|
|
@@ -4,26 +4,26 @@ import { Animated, View } from "react-native";
|
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
useModalAnimationContext,
|
|
8
7
|
PlayerAnimationStateEnum,
|
|
8
|
+
useModalAnimationContext,
|
|
9
9
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
|
+
useDimensions,
|
|
12
13
|
useGetBottomTabBarHeight,
|
|
13
14
|
useNavigation,
|
|
14
|
-
useDimensions,
|
|
15
15
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
16
16
|
import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
|
|
17
17
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
18
18
|
import { useAppState } from "@applicaster/zapp-react-native-utils/reactHooks/app";
|
|
19
19
|
|
|
20
20
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
AUDIO_PLAYER_HORIZONTAL_PADDING,
|
|
22
|
+
ComponentAnimationType,
|
|
23
23
|
defaultAspectRatioWidth,
|
|
24
|
+
gestureListenerHelper,
|
|
24
25
|
getAnimationDefaultValue,
|
|
25
|
-
|
|
26
|
-
AUDIO_PLAYER_HORIZONTAL_PADDING,
|
|
26
|
+
getAnimationStyle,
|
|
27
27
|
} from "./utils";
|
|
28
28
|
|
|
29
29
|
type Props = {
|
|
@@ -77,7 +77,7 @@ export const AnimationView = ({
|
|
|
77
77
|
const measureView = React.useCallback(() => {
|
|
78
78
|
if (isTabletLandscape && tabletLandscapePlayerTopPosition === 0) {
|
|
79
79
|
animationComponentRef.current.measure(
|
|
80
|
-
(
|
|
80
|
+
(_x, _y, _width, _height, _pageX, pageY) => {
|
|
81
81
|
setTabletLandscapePlayerTopPosition(pageY - 20);
|
|
82
82
|
}
|
|
83
83
|
);
|
|
@@ -100,10 +100,11 @@ export const AnimationView = ({
|
|
|
100
100
|
const moveUpValue = additionalData.saveArea
|
|
101
101
|
? -insets.top + (isAudioItem ? 0 : progressBarHeight)
|
|
102
102
|
: isTablet
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
? isTabletLandscape &&
|
|
104
|
+
(!isAudioItem || (isAudioItem && inlineAudioPlayer))
|
|
105
|
+
? -tabletLandscapePlayerTopPosition + progressBarHeight
|
|
106
|
+
: -130
|
|
107
|
+
: -50 + progressBarHeight;
|
|
107
108
|
|
|
108
109
|
const moveComponentHorizontalValue = additionalData.moveValue
|
|
109
110
|
? isRTL
|
|
@@ -404,7 +405,7 @@ export const AnimationView = ({
|
|
|
404
405
|
|
|
405
406
|
return (
|
|
406
407
|
<Animated.View
|
|
407
|
-
onLayout={additionalData.useLayoutMeasure
|
|
408
|
+
onLayout={additionalData.useLayoutMeasure ? measureView : undefined}
|
|
408
409
|
ref={animationComponentRef}
|
|
409
410
|
style={[
|
|
410
411
|
...preparedStyles,
|
|
@@ -434,8 +435,8 @@ export const AnimationComponent = (props: Props) => {
|
|
|
434
435
|
const Component = useAnimation
|
|
435
436
|
? AnimationView
|
|
436
437
|
: style
|
|
437
|
-
|
|
438
|
-
|
|
438
|
+
? View
|
|
439
|
+
: React.Fragment;
|
|
439
440
|
|
|
440
441
|
if (
|
|
441
442
|
additionalData.extraAnimation &&
|