@applicaster/zapp-react-native-ui-components 14.0.0-alpha.1473000722 → 14.0.0-alpha.1540936784
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/AudioPlayer/{tv/index.tsx → AudioPlayer.tsx} +58 -19
- package/Components/AudioPlayer/{tv/Layout.tsx → AudioPlayerLayout.tsx} +72 -31
- package/Components/AudioPlayer/{mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap → __tests__/__snapshots__/audioPlayer.test.js.snap} +8 -2
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +72 -0
- package/Components/AudioPlayer/{tv/__tests__ → __tests__}/audioPlayer.test.js +3 -3
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +26 -0
- package/Components/AudioPlayer/{tv/helpers.tsx → helpers.tsx} +2 -1
- package/Components/AudioPlayer/index.ts +1 -0
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +2 -0
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +0 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +22 -10
- package/Components/River/ComponentsMap/ComponentsMap.tsx +5 -1
- package/Components/River/RiverItem.tsx +8 -8
- package/Components/River/TV/River.tsx +3 -0
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +6 -0
- package/Components/TopMarginApplicator/TopMarginApplicator.tsx +15 -16
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +9 -1
- package/Components/VideoModal/PlayerDetails.tsx +24 -2
- package/Components/VideoModal/PlayerWrapper.tsx +26 -142
- package/Components/VideoModal/VideoModal.tsx +3 -17
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -240
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +55 -17
- package/Components/VideoModal/hooks/index.ts +0 -2
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +26 -15
- package/Components/VideoModal/utils.ts +6 -0
- package/index.d.ts +1 -0
- package/package.json +5 -5
- package/Components/AudioPlayer/index.tsx +0 -15
- package/Components/AudioPlayer/mobile/Layout.tsx +0 -61
- package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +0 -18
- package/Components/AudioPlayer/mobile/index.tsx +0 -23
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +0 -170
- package/Components/AudioPlayer/types.ts +0 -40
- package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
- /package/Components/AudioPlayer/{tv/Artwork.tsx → Artwork.tsx} +0 -0
- /package/Components/AudioPlayer/{tv/Channel.tsx → Channel.tsx} +0 -0
- /package/Components/AudioPlayer/{tv/Runtime.tsx → Runtime.tsx} +0 -0
- /package/Components/AudioPlayer/{tv/Summary.tsx → Summary.tsx} +0 -0
- /package/Components/AudioPlayer/{tv/Title.tsx → Title.tsx} +0 -0
- /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/Runtime.test.js +0 -0
- /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/Runtime.test.js.snap +0 -0
- /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/artWork.test.js.snap +0 -0
- /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/channel.test.js.snap +0 -0
- /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/summary.test.js.snap +0 -0
- /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/title.test.js.snap +0 -0
- /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/artWork.test.js +0 -0
- /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/channel.test.js +0 -0
- /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/summary.test.js +0 -0
- /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/title.test.js +0 -0
|
@@ -1,20 +1,58 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from "react";
|
|
2
2
|
|
|
3
3
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
4
|
-
import { getArtworkImage } from "@applicaster/zapp-react-native-utils/audioPlayerUtils";
|
|
5
4
|
|
|
6
|
-
import {
|
|
5
|
+
import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
7
6
|
|
|
7
|
+
import { AudioPlayerLayout } from "./AudioPlayerLayout";
|
|
8
8
|
import { Channel } from "./Channel";
|
|
9
9
|
import { Title } from "./Title";
|
|
10
10
|
import { Summary } from "./Summary";
|
|
11
11
|
import { Runtime } from "./Runtime";
|
|
12
12
|
import { getPropertyFromEntryOrConfig } from "./helpers";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
import { ViewStyle } from "react-native";
|
|
14
|
+
|
|
15
|
+
type Props = {
|
|
16
|
+
audio_item: ZappEntry & {
|
|
17
|
+
extensions?: {
|
|
18
|
+
audio_player_artwork_aspect_ratio?: string;
|
|
19
|
+
audio_player_background_image?: string;
|
|
20
|
+
audio_player_background_color?: string;
|
|
21
|
+
audio_player_channel_icon?: string;
|
|
22
|
+
audio_player_title_color?: string;
|
|
23
|
+
audio_player_summary_color?: string;
|
|
24
|
+
audio_player_rtl?: boolean;
|
|
25
|
+
audio_player_background_image_default_color?: string;
|
|
26
|
+
start_time?: string;
|
|
27
|
+
end_time?: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
plugin_configuration: {
|
|
31
|
+
audio_player_background_color?: string;
|
|
32
|
+
audio_player_title_color?: string;
|
|
33
|
+
audio_player_summary_color?: string;
|
|
34
|
+
audio_player_rtl?: string;
|
|
35
|
+
audio_player_background_image_default_color?: string;
|
|
36
|
+
audio_player_background_image?: string;
|
|
37
|
+
audio_player_artwork_aspect_ratio?: string;
|
|
38
|
+
lg_tv_audio_player_title_font_family?: string;
|
|
39
|
+
lg_tv_audio_player_title_font_size?: number;
|
|
40
|
+
lg_tv_audio_player_summary_font_family?: string;
|
|
41
|
+
lg_tv_audio_player_summary_font_size?: number;
|
|
42
|
+
samsung_tv_audio_player_title_font_family?: string;
|
|
43
|
+
samsung_tv_audio_player_title_font_size?: number;
|
|
44
|
+
samsung_tv_audio_player_summary_font_family?: string;
|
|
45
|
+
samsung_tv_audio_player_summary_font_size?: number;
|
|
46
|
+
tv_os_audio_player_title_font_family?: string;
|
|
47
|
+
tv_os_audio_player_title_font_size?: number;
|
|
48
|
+
tv_os_audio_player_summary_font_family?: string;
|
|
49
|
+
tv_os_audio_player_summary_font_size?: number;
|
|
50
|
+
};
|
|
51
|
+
style?: ViewStyle;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export function AudioPlayer(props: Props) {
|
|
55
|
+
const { audio_item, plugin_configuration } = props;
|
|
18
56
|
const { extensions, title, summary } = audio_item;
|
|
19
57
|
|
|
20
58
|
const getProp = useCallback(
|
|
@@ -26,15 +64,20 @@ export function AudioPlayerTV(props: Props) {
|
|
|
26
64
|
);
|
|
27
65
|
|
|
28
66
|
const config = useMemo(() => {
|
|
29
|
-
// Checking if we are
|
|
67
|
+
// Checking if we are recieving items from the DSP
|
|
30
68
|
const titleColor = getProp("audio_player_title_color");
|
|
31
69
|
const summaryColor = getProp("audio_player_summary_color");
|
|
32
70
|
const backgroundColor = getProp("audio_player_background_color");
|
|
33
71
|
const backgroundImage = getProp("audio_player_background_image");
|
|
72
|
+
const artworkAspectRatio = getProp("audio_player_artwork_aspect_ratio");
|
|
34
73
|
const channelIcon = getProp("audio_player_channel_icon");
|
|
35
74
|
const rtlFlag = getProp("audio_player_rtl");
|
|
36
75
|
const artworkBorderRadius = getProp("audio_player_artwork_border_radius");
|
|
37
76
|
|
|
77
|
+
const audioPlayerBackgroundImageDefaultColor = getProp(
|
|
78
|
+
"audio_player_background_image_default_color"
|
|
79
|
+
);
|
|
80
|
+
|
|
38
81
|
const isRTL = rtlFlag === "1" || rtlFlag === "true" || rtlFlag === true;
|
|
39
82
|
|
|
40
83
|
const titleFontFamily = getProp(
|
|
@@ -109,27 +152,23 @@ export function AudioPlayerTV(props: Props) {
|
|
|
109
152
|
summaryFontSize,
|
|
110
153
|
runTimeFontFamily,
|
|
111
154
|
runTimeFontSize,
|
|
155
|
+
artworkAspectRatio,
|
|
112
156
|
channelIcon,
|
|
157
|
+
audioPlayerBackgroundImageDefaultColor,
|
|
113
158
|
artworkBorderRadius,
|
|
114
159
|
};
|
|
115
160
|
}, [getProp]);
|
|
116
161
|
|
|
117
|
-
const artwork =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
key: "audio_player_artwork_image_key",
|
|
121
|
-
entry: audio_item,
|
|
122
|
-
plugin_configuration,
|
|
123
|
-
}),
|
|
124
|
-
[audio_item, plugin_configuration]
|
|
125
|
-
);
|
|
162
|
+
const artwork = imageSrcFromMediaItem(audio_item, [
|
|
163
|
+
config?.artworkAspectRatio,
|
|
164
|
+
]);
|
|
126
165
|
|
|
127
166
|
return (
|
|
128
|
-
<
|
|
167
|
+
<AudioPlayerLayout artwork={artwork} config={config}>
|
|
129
168
|
<Channel srcImage={config?.channelIcon} config={config} />
|
|
130
169
|
<Title title={title} config={config} />
|
|
131
170
|
<Summary summary={summary} config={config} />
|
|
132
171
|
<Runtime {...extensions} config={config} />
|
|
133
|
-
</
|
|
172
|
+
</AudioPlayerLayout>
|
|
134
173
|
);
|
|
135
174
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { View, ImageBackground,
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
|
+
import { View, ImageBackground, Animated } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
5
|
|
|
@@ -7,30 +7,34 @@ import { Artwork } from "./Artwork";
|
|
|
7
7
|
import { directionStyles } from "./helpers";
|
|
8
8
|
|
|
9
9
|
type Props = {
|
|
10
|
-
artwork
|
|
10
|
+
artwork?: string;
|
|
11
11
|
config: {
|
|
12
12
|
titleColor: string;
|
|
13
13
|
summaryColor: string;
|
|
14
14
|
backgroundColor: string;
|
|
15
|
-
backgroundImage:
|
|
15
|
+
backgroundImage: string;
|
|
16
16
|
isRTL: boolean;
|
|
17
17
|
artworkBorderRadius: Option<number>;
|
|
18
18
|
};
|
|
19
19
|
children: React.ReactNode;
|
|
20
|
-
style: ViewStyle;
|
|
21
20
|
};
|
|
22
21
|
|
|
23
|
-
export function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
export function AudioPlayerLayout({ artwork, config, children }: Props) {
|
|
23
|
+
const fadeAnimation = useRef(new Animated.Value(0)).current;
|
|
24
|
+
|
|
25
|
+
const fadeAudioPlayerIn = () => {
|
|
26
|
+
Animated.timing(fadeAnimation, {
|
|
27
|
+
toValue: 1,
|
|
28
|
+
duration: 3000,
|
|
29
|
+
useNativeDriver: true,
|
|
30
|
+
}).start();
|
|
31
|
+
};
|
|
32
|
+
|
|
29
33
|
const { isRTL, backgroundColor, backgroundImage } = config;
|
|
30
34
|
|
|
31
|
-
const backgroundImageSource = { uri: backgroundImage };
|
|
35
|
+
const backgroundImageSource = { uri: backgroundImage || artwork };
|
|
32
36
|
|
|
33
|
-
const backgroundColorStyle =
|
|
37
|
+
const backgroundColorStyle = backgroundImageSource.uri
|
|
34
38
|
? "transparent"
|
|
35
39
|
: backgroundColor;
|
|
36
40
|
|
|
@@ -62,7 +66,8 @@ export function AudioPlayerTVLayout({
|
|
|
62
66
|
native: {
|
|
63
67
|
backgroundColor: backgroundColorStyle,
|
|
64
68
|
overflow: "hidden",
|
|
65
|
-
|
|
69
|
+
width: "100%",
|
|
70
|
+
height: "100%",
|
|
66
71
|
},
|
|
67
72
|
samsung_tv: {
|
|
68
73
|
position: "absolute",
|
|
@@ -114,6 +119,9 @@ export function AudioPlayerTVLayout({
|
|
|
114
119
|
alignItems: "center",
|
|
115
120
|
justifyContent: "center",
|
|
116
121
|
},
|
|
122
|
+
native: {
|
|
123
|
+
flex: 1,
|
|
124
|
+
},
|
|
117
125
|
});
|
|
118
126
|
|
|
119
127
|
const textContainerStyles = platformSelect({
|
|
@@ -137,25 +145,58 @@ export function AudioPlayerTVLayout({
|
|
|
137
145
|
},
|
|
138
146
|
});
|
|
139
147
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
>
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return (
|
|
148
|
+
const audioPlayerLayoutTV = backgroundImageSource?.uri ? (
|
|
149
|
+
<ImageBackground
|
|
150
|
+
source={backgroundImageSource}
|
|
151
|
+
style={backgroundImgStyles}
|
|
152
|
+
resizeMode="cover"
|
|
153
|
+
>
|
|
154
|
+
<View style={mainContainerStyles}>
|
|
155
|
+
{!!artwork && <Artwork srcImage={artwork} config={config} />}
|
|
156
|
+
<View style={textContainerStyles}>{children}</View>
|
|
157
|
+
</View>
|
|
158
|
+
</ImageBackground>
|
|
159
|
+
) : (
|
|
156
160
|
<View style={mainContainerStyles}>
|
|
157
|
-
<Artwork srcImage={artwork} config={config} />
|
|
161
|
+
{!!artwork && <Artwork srcImage={artwork} config={config} />}
|
|
158
162
|
<View style={textContainerStyles}>{children}</View>
|
|
159
163
|
</View>
|
|
160
164
|
);
|
|
165
|
+
|
|
166
|
+
const audioPlayerLayoutMobile = () => {
|
|
167
|
+
fadeAudioPlayerIn();
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<View style={mainContainerStyles} pointerEvents="none">
|
|
171
|
+
<Animated.View
|
|
172
|
+
style={[
|
|
173
|
+
mainContainerStyles,
|
|
174
|
+
{
|
|
175
|
+
opacity: fadeAnimation,
|
|
176
|
+
},
|
|
177
|
+
]}
|
|
178
|
+
>
|
|
179
|
+
<ImageBackground
|
|
180
|
+
source={backgroundImageSource}
|
|
181
|
+
style={backgroundImgStyles}
|
|
182
|
+
resizeMode="cover"
|
|
183
|
+
>
|
|
184
|
+
<View style={mainContainerStyles} />
|
|
185
|
+
</ImageBackground>
|
|
186
|
+
</Animated.View>
|
|
187
|
+
</View>
|
|
188
|
+
);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const audioPlayerLayout = platformSelect({
|
|
192
|
+
tvos: audioPlayerLayoutTV,
|
|
193
|
+
android_tv: audioPlayerLayoutTV,
|
|
194
|
+
web: audioPlayerLayoutTV,
|
|
195
|
+
samsung_tv: audioPlayerLayoutTV,
|
|
196
|
+
lg_tv: audioPlayerLayoutTV,
|
|
197
|
+
ios: audioPlayerLayoutMobile(),
|
|
198
|
+
android: audioPlayerLayoutMobile(),
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
return audioPlayerLayout;
|
|
161
202
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<
|
|
3
|
+
exports[`<AudioPlayer /> renders correctly 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
pointerEvents="none"
|
|
6
6
|
style={
|
|
7
7
|
{
|
|
8
8
|
"backgroundColor": "transparent",
|
|
9
|
+
"height": "100%",
|
|
9
10
|
"overflow": "hidden",
|
|
11
|
+
"width": "100%",
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
>
|
|
@@ -15,8 +17,10 @@ exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
|
|
|
15
17
|
style={
|
|
16
18
|
{
|
|
17
19
|
"backgroundColor": "transparent",
|
|
20
|
+
"height": "100%",
|
|
18
21
|
"opacity": 0,
|
|
19
22
|
"overflow": "hidden",
|
|
23
|
+
"width": "100%",
|
|
20
24
|
}
|
|
21
25
|
}
|
|
22
26
|
>
|
|
@@ -32,7 +36,7 @@ exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
|
|
|
32
36
|
resizeMode="cover"
|
|
33
37
|
source={
|
|
34
38
|
{
|
|
35
|
-
"uri":
|
|
39
|
+
"uri": "https://example.com",
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
style={
|
|
@@ -56,7 +60,9 @@ exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
|
|
|
56
60
|
style={
|
|
57
61
|
{
|
|
58
62
|
"backgroundColor": "transparent",
|
|
63
|
+
"height": "100%",
|
|
59
64
|
"overflow": "hidden",
|
|
65
|
+
"width": "100%",
|
|
60
66
|
}
|
|
61
67
|
}
|
|
62
68
|
/>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<AudioPlayerLayout /> renders correctly 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
pointerEvents="none"
|
|
6
|
+
style={
|
|
7
|
+
{
|
|
8
|
+
"backgroundColor": "transparent",
|
|
9
|
+
"height": "100%",
|
|
10
|
+
"overflow": "hidden",
|
|
11
|
+
"width": "100%",
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
>
|
|
15
|
+
<View
|
|
16
|
+
collapsable={false}
|
|
17
|
+
style={
|
|
18
|
+
{
|
|
19
|
+
"backgroundColor": "transparent",
|
|
20
|
+
"height": "100%",
|
|
21
|
+
"opacity": 0,
|
|
22
|
+
"overflow": "hidden",
|
|
23
|
+
"width": "100%",
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
>
|
|
27
|
+
<View
|
|
28
|
+
accessibilityIgnoresInvertColors={true}
|
|
29
|
+
style={
|
|
30
|
+
{
|
|
31
|
+
"flex": 1,
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
>
|
|
35
|
+
<Image
|
|
36
|
+
resizeMode="cover"
|
|
37
|
+
source={
|
|
38
|
+
{
|
|
39
|
+
"uri": "https://example.com",
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
style={
|
|
43
|
+
[
|
|
44
|
+
{
|
|
45
|
+
"bottom": 0,
|
|
46
|
+
"left": 0,
|
|
47
|
+
"position": "absolute",
|
|
48
|
+
"right": 0,
|
|
49
|
+
"top": 0,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"height": undefined,
|
|
53
|
+
"width": undefined,
|
|
54
|
+
},
|
|
55
|
+
undefined,
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
/>
|
|
59
|
+
<View
|
|
60
|
+
style={
|
|
61
|
+
{
|
|
62
|
+
"backgroundColor": "transparent",
|
|
63
|
+
"height": "100%",
|
|
64
|
+
"overflow": "hidden",
|
|
65
|
+
"width": "100%",
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/>
|
|
69
|
+
</View>
|
|
70
|
+
</View>
|
|
71
|
+
</View>
|
|
72
|
+
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render } from "@testing-library/react-native";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { AudioPlayer } from "../AudioPlayer";
|
|
5
5
|
|
|
6
6
|
const audioPlayerProps = {
|
|
7
7
|
audio_item: {
|
|
@@ -45,9 +45,9 @@ const audioPlayerProps = {
|
|
|
45
45
|
styles: {},
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
describe("<
|
|
48
|
+
describe("<AudioPlayer />", () => {
|
|
49
49
|
it("renders correctly", () => {
|
|
50
|
-
const { toJSON } = render(<
|
|
50
|
+
const { toJSON } = render(<AudioPlayer {...audioPlayerProps} />);
|
|
51
51
|
expect(toJSON()).toMatchSnapshot();
|
|
52
52
|
});
|
|
53
53
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
|
+
|
|
4
|
+
import { AudioPlayerLayout } from "../AudioPlayerLayout";
|
|
5
|
+
|
|
6
|
+
const audioPlayerLayoutProps = {
|
|
7
|
+
artwork: "string",
|
|
8
|
+
config: {
|
|
9
|
+
titleColor: "white",
|
|
10
|
+
summaryColor: "white",
|
|
11
|
+
backgroundColor: "black",
|
|
12
|
+
backgroundImage: "https://example.com",
|
|
13
|
+
isRTL: true,
|
|
14
|
+
},
|
|
15
|
+
children: [],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
describe("<AudioPlayerLayout />", () => {
|
|
19
|
+
it("renders correctly", () => {
|
|
20
|
+
const { toJSON } = render(
|
|
21
|
+
<AudioPlayerLayout {...audioPlayerLayoutProps} />
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
expect(toJSON()).toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -2,8 +2,9 @@ const defaults = {
|
|
|
2
2
|
audio_player_title_color: "white",
|
|
3
3
|
audio_player_summary_color: "white",
|
|
4
4
|
audio_player_background_color: "black",
|
|
5
|
-
|
|
5
|
+
audio_player_artwork_aspect_ratio: "1:1",
|
|
6
6
|
audio_player_rtl: false,
|
|
7
|
+
audio_player_background_image_default_color: "",
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
export function getPropertyFromEntryOrConfig({ entry, plugin_configuration }) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AudioPlayer } from "./AudioPlayer";
|
|
@@ -30,6 +30,7 @@ export const GeneralContentScreen = ({
|
|
|
30
30
|
isScreenWrappedInContainer,
|
|
31
31
|
componentsMapExtraProps = {},
|
|
32
32
|
focused,
|
|
33
|
+
extraOffset,
|
|
33
34
|
parentFocus,
|
|
34
35
|
containerHeight,
|
|
35
36
|
preferredFocus = false,
|
|
@@ -121,6 +122,7 @@ export const GeneralContentScreen = ({
|
|
|
121
122
|
isScreenWrappedInContainer={isScreenWrappedInContainer}
|
|
122
123
|
parentFocus={parentFocus}
|
|
123
124
|
focused={focused}
|
|
125
|
+
extraOffset={extraOffset}
|
|
124
126
|
containerHeight={containerHeight}
|
|
125
127
|
preferredFocus={preferredFocus}
|
|
126
128
|
{...componentsMapExtraProps}
|
|
@@ -88,7 +88,7 @@ export const VideoModalMode = {
|
|
|
88
88
|
MAXIMIZED: "MAXIMIZED",
|
|
89
89
|
MINIMIZED: "MINIMIZED",
|
|
90
90
|
FULLSCREEN: "FULLSCREEN",
|
|
91
|
-
};
|
|
91
|
+
} as const;
|
|
92
92
|
|
|
93
93
|
export type PlayNextData = {
|
|
94
94
|
state: PlayNextState;
|
|
@@ -105,6 +105,11 @@ const isTvOS = isTvOSPlatform();
|
|
|
105
105
|
// height for container with additional content below player
|
|
106
106
|
const INLINE_CONTAINER_CONTENT_HEIGHT = 400;
|
|
107
107
|
|
|
108
|
+
// Default Y offset for anchor points on non-Android TV platforms
|
|
109
|
+
const DEFAULT_OFFSET_Y = -600;
|
|
110
|
+
|
|
111
|
+
const EXTRA_ANCHOR_POINT_Y_OFFSET = isAndroidTV ? 0 : DEFAULT_OFFSET_Y;
|
|
112
|
+
|
|
108
113
|
const withBorderHack = () => {
|
|
109
114
|
if (isAndroidTV) {
|
|
110
115
|
/* @HACK: see GH#7269 */
|
|
@@ -135,9 +140,6 @@ const webStyles = {
|
|
|
135
140
|
},
|
|
136
141
|
inlineRiver: {
|
|
137
142
|
height: INLINE_CONTAINER_CONTENT_HEIGHT,
|
|
138
|
-
|
|
139
|
-
borderWidth: 4,
|
|
140
|
-
borderColor: "yellow",
|
|
141
143
|
},
|
|
142
144
|
};
|
|
143
145
|
|
|
@@ -148,7 +150,7 @@ const nativeStyles = {
|
|
|
148
150
|
},
|
|
149
151
|
playerScreen: {
|
|
150
152
|
flex: 1,
|
|
151
|
-
|
|
153
|
+
background: "black",
|
|
152
154
|
overflow: "hidden",
|
|
153
155
|
},
|
|
154
156
|
playerWrapper: {
|
|
@@ -568,8 +570,9 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
568
570
|
const isInlineTV = isInlineTVUtil(screenData);
|
|
569
571
|
|
|
570
572
|
const inline =
|
|
571
|
-
[VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(
|
|
572
|
-
|
|
573
|
+
[VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(
|
|
574
|
+
mode as any
|
|
575
|
+
) || isInlineTV;
|
|
573
576
|
|
|
574
577
|
const value = React.useMemo(
|
|
575
578
|
() => ({ playerId: state.playerId }),
|
|
@@ -590,7 +593,11 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
590
593
|
);
|
|
591
594
|
}
|
|
592
595
|
|
|
593
|
-
if (
|
|
596
|
+
if (
|
|
597
|
+
screen_background_color &&
|
|
598
|
+
mode !== VideoModalMode.FULLSCREEN &&
|
|
599
|
+
isTV()
|
|
600
|
+
) {
|
|
594
601
|
updatedStyles.playerScreen.backgroundColor = screen_background_color;
|
|
595
602
|
}
|
|
596
603
|
|
|
@@ -640,14 +647,17 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
640
647
|
preferredFocus
|
|
641
648
|
shouldUsePreferredFocus
|
|
642
649
|
groupId={groupId}
|
|
650
|
+
pointerEvents={mode === "MINIMIZED" ? "box-none" : "auto"}
|
|
643
651
|
>
|
|
644
652
|
{/* Video player and components */}
|
|
645
653
|
<View
|
|
646
654
|
style={styles.playerScreen}
|
|
647
655
|
testID={"player-screen-container"}
|
|
656
|
+
pointerEvents={mode === "MINIMIZED" ? "box-none" : "auto"}
|
|
648
657
|
>
|
|
649
658
|
{/* Player container */}
|
|
650
659
|
<View
|
|
660
|
+
pointerEvents={mode === "MINIMIZED" ? "box-none" : "auto"}
|
|
651
661
|
style={[
|
|
652
662
|
styles.playerWrapper,
|
|
653
663
|
// eslint-disable-next-line react-native/no-inline-styles, react-native/no-color-literals
|
|
@@ -719,11 +729,13 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
719
729
|
key={item.id}
|
|
720
730
|
groupId={FocusableGroupMainContainerId}
|
|
721
731
|
cellTapAction={onCellTap}
|
|
722
|
-
extraAnchorPointYOffset={
|
|
732
|
+
extraAnchorPointYOffset={
|
|
733
|
+
EXTRA_ANCHOR_POINT_Y_OFFSET
|
|
734
|
+
}
|
|
723
735
|
isScreenWrappedInContainer={true}
|
|
724
736
|
containerHeight={styles.inlineRiver.height}
|
|
725
737
|
componentsMapExtraProps={{
|
|
726
|
-
isNestedComponentsMap:
|
|
738
|
+
isNestedComponentsMap: R.T,
|
|
727
739
|
}}
|
|
728
740
|
/>
|
|
729
741
|
)}
|
|
@@ -281,8 +281,8 @@ function ComponentsMapComponent(props: Props) {
|
|
|
281
281
|
scrollIndicatorInsets={scrollIndicatorInsets}
|
|
282
282
|
extraData={feed}
|
|
283
283
|
stickyHeaderIndices={stickyHeaderIndices}
|
|
284
|
-
removeClippedSubviews={isAndroid}
|
|
285
284
|
onLayout={handleOnLayout}
|
|
285
|
+
removeClippedSubviews={isAndroid}
|
|
286
286
|
initialNumToRender={3}
|
|
287
287
|
maxToRenderPerBatch={10}
|
|
288
288
|
windowSize={12}
|
|
@@ -303,6 +303,10 @@ function ComponentsMapComponent(props: Props) {
|
|
|
303
303
|
onMomentumScrollEnd={_onMomentumScrollEnd}
|
|
304
304
|
onScrollEndDrag={_onScrollEndDrag}
|
|
305
305
|
scrollEventThrottle={16}
|
|
306
|
+
maintainVisibleContentPosition={{
|
|
307
|
+
minIndexForVisible: 0,
|
|
308
|
+
autoscrollToTopThreshold: 10,
|
|
309
|
+
}}
|
|
306
310
|
{...scrollViewExtraProps}
|
|
307
311
|
/>
|
|
308
312
|
</ViewportTracker>
|
|
@@ -39,10 +39,6 @@ function getFeedUrl(feed: ZappFeed, index: number) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
const isNextIndex = (index, readyIndex) => {
|
|
43
|
-
return readyIndex + 1 >= index;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
42
|
/**
|
|
47
43
|
* useLoadingState for RiverItemComponent
|
|
48
44
|
* takes currentIndex and loadingState as arguments
|
|
@@ -52,20 +48,24 @@ const useLoadingState = (
|
|
|
52
48
|
loadingState: RiverItemType["loadingState"]
|
|
53
49
|
) => {
|
|
54
50
|
const [readyToBeDisplayed, setReadyToBeDisplayed] = React.useState(
|
|
55
|
-
|
|
51
|
+
loadingState.getValue().index + 1 >= currentIndex
|
|
56
52
|
);
|
|
57
53
|
|
|
58
54
|
useEffect(() => {
|
|
59
55
|
const subscription = loadingState.subscribe(({ index }) => {
|
|
60
|
-
if (
|
|
56
|
+
if (index + 1 >= currentIndex) {
|
|
61
57
|
setReadyToBeDisplayed(true);
|
|
62
58
|
}
|
|
63
59
|
});
|
|
64
60
|
|
|
61
|
+
if (loadingState.getValue().index + 1 >= currentIndex) {
|
|
62
|
+
setReadyToBeDisplayed(true);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
65
|
return () => {
|
|
66
66
|
subscription.unsubscribe();
|
|
67
67
|
};
|
|
68
|
-
}, [currentIndex]);
|
|
68
|
+
}, [loadingState, currentIndex]);
|
|
69
69
|
|
|
70
70
|
return readyToBeDisplayed;
|
|
71
71
|
};
|
|
@@ -151,7 +151,7 @@ function RiverItemComponent(props: RiverItemType) {
|
|
|
151
151
|
component={item}
|
|
152
152
|
componentIndex={index}
|
|
153
153
|
onLoadFailed={onLoadFailed}
|
|
154
|
-
onLoadFinished={() => onLoadFinished(index)}
|
|
154
|
+
onLoadFinished={() => onLoadFinished(index)} // Keeping it here to don't break the plugins.
|
|
155
155
|
groupId={groupId}
|
|
156
156
|
feedUrl={feedUrl}
|
|
157
157
|
isLast={isLast}
|
|
@@ -26,6 +26,7 @@ type Props = {
|
|
|
26
26
|
componentsMapExtraProps?: any;
|
|
27
27
|
isInsideContainer?: boolean;
|
|
28
28
|
extraAnchorPointYOffset: number;
|
|
29
|
+
extraOffset: number;
|
|
29
30
|
river?: ZappRiver | ZappEntry;
|
|
30
31
|
};
|
|
31
32
|
|
|
@@ -38,6 +39,7 @@ export const River = (props: Props) => {
|
|
|
38
39
|
componentsMapExtraProps,
|
|
39
40
|
isInsideContainer,
|
|
40
41
|
extraAnchorPointYOffset,
|
|
42
|
+
extraOffset,
|
|
41
43
|
} = props;
|
|
42
44
|
|
|
43
45
|
const { title: screenTitle, summary: screenSummary } = useNavbarState();
|
|
@@ -118,6 +120,7 @@ export const River = (props: Props) => {
|
|
|
118
120
|
<GeneralContentScreen
|
|
119
121
|
feed={feedData}
|
|
120
122
|
screenId={screenId}
|
|
123
|
+
extraOffset={extraOffset}
|
|
121
124
|
isScreenWrappedInContainer={isInsideContainer}
|
|
122
125
|
extraAnchorPointYOffset={extraAnchorPointYOffset}
|
|
123
126
|
componentsMapExtraProps={componentsMapExtraProps}
|
|
@@ -135,6 +135,12 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
135
135
|
getItemCount={[Function]}
|
|
136
136
|
initialNumToRender={3}
|
|
137
137
|
keyExtractor={[Function]}
|
|
138
|
+
maintainVisibleContentPosition={
|
|
139
|
+
{
|
|
140
|
+
"autoscrollToTopThreshold": 10,
|
|
141
|
+
"minIndexForVisible": 0,
|
|
142
|
+
}
|
|
143
|
+
}
|
|
138
144
|
maxToRenderPerBatch={10}
|
|
139
145
|
onContentSizeChange={[Function]}
|
|
140
146
|
onLayout={[Function]}
|