@applicaster/zapp-react-native-ui-components 14.0.0-alpha.3552323332 → 14.0.0-alpha.4111088201
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/AnimatedInOut/index.tsx +5 -3
- package/Components/AudioPlayer/index.tsx +15 -0
- package/Components/AudioPlayer/mobile/Layout.tsx +66 -0
- package/Components/AudioPlayer/{__tests__/__snapshots__/audioPlayer.test.js.snap → mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap} +2 -8
- package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
- package/Components/AudioPlayer/mobile/index.tsx +18 -0
- package/Components/AudioPlayer/{AudioPlayerLayout.tsx → tv/Layout.tsx} +31 -72
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +170 -0
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +7 -3
- package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +1 -2
- package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +12 -59
- package/Components/AudioPlayer/types.ts +40 -0
- package/Components/Focusable/FocusableTvOS.tsx +3 -3
- package/Components/HandlePlayable/HandlePlayable.tsx +14 -8
- package/Components/MasterCell/elementMapper.tsx +1 -2
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +13 -18
- package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +9 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +8 -18
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +0 -1
- package/Components/River/TV/withTVEventHandler.tsx +1 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
- package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +34 -0
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +15 -9
- package/Components/VideoLive/animationUtils.ts +3 -3
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +1 -9
- package/Components/VideoModal/PlayerDetails.tsx +2 -24
- package/Components/VideoModal/PlayerWrapper.tsx +142 -26
- package/Components/VideoModal/VideoModal.tsx +17 -3
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +7 -1
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +240 -44
- package/Components/VideoModal/hooks/index.ts +2 -0
- package/Components/VideoModal/hooks/useBackgroundColor.ts +10 -0
- package/Components/VideoModal/utils.ts +0 -6
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -16
- package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +84 -24
- package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
- package/package.json +5 -6
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -72
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -26
- package/Components/AudioPlayer/index.ts +0 -1
- /package/Components/AudioPlayer/{Artwork.tsx → tv/Artwork.tsx} +0 -0
- /package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +0 -0
- /package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +0 -0
- /package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +0 -0
- /package/Components/AudioPlayer/{Title.tsx → tv/Title.tsx} +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/channel.test.js.snap +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/artWork.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/channel.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/summary.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/title.test.js +0 -0
|
@@ -4,9 +4,11 @@ import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/uti
|
|
|
4
4
|
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
5
5
|
import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
6
6
|
|
|
7
|
-
type AnimatedInterpolatedStyle =
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
type AnimatedInterpolatedStyle = any;
|
|
8
|
+
|
|
9
|
+
// type AnimatedInterpolatedStyle =
|
|
10
|
+
// | Animated.AnimatedInterpolation
|
|
11
|
+
// | [{ [Key: string]: Animated.AnimatedInterpolation }];
|
|
10
12
|
|
|
11
13
|
type AnimationConfig = {
|
|
12
14
|
duration: number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
3
|
+
|
|
4
|
+
import { AudioPlayerTV } from "./tv";
|
|
5
|
+
import { AudioPlayerMobile } from "./mobile";
|
|
6
|
+
|
|
7
|
+
import { Props } from "./types";
|
|
8
|
+
|
|
9
|
+
export function AudioPlayer(props: Props) {
|
|
10
|
+
if (isTV()) {
|
|
11
|
+
return <AudioPlayerTV {...props} />;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return <AudioPlayerMobile {...props} />;
|
|
15
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
ImageBackground,
|
|
5
|
+
Animated,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
} from "react-native";
|
|
9
|
+
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
10
|
+
|
|
11
|
+
const THREE_SECONDS = 3000;
|
|
12
|
+
|
|
13
|
+
const styles = StyleSheet.create({
|
|
14
|
+
flex: {
|
|
15
|
+
flex: 1,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
type Props = {
|
|
20
|
+
backgroundImageSource: { uri: string };
|
|
21
|
+
style: ViewStyle;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function AudioPlayerMobileLayout({
|
|
25
|
+
backgroundImageSource,
|
|
26
|
+
style,
|
|
27
|
+
}: Props) {
|
|
28
|
+
const fadeAnimation = useRef(new Animated.Value(0)).current;
|
|
29
|
+
|
|
30
|
+
const mainContainerStyles = platformSelect({
|
|
31
|
+
native: {
|
|
32
|
+
backgroundColor: "transparent",
|
|
33
|
+
overflow: "hidden",
|
|
34
|
+
...style,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
Animated.timing(fadeAnimation, {
|
|
40
|
+
toValue: 1,
|
|
41
|
+
duration: THREE_SECONDS,
|
|
42
|
+
useNativeDriver: true,
|
|
43
|
+
}).start();
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<View style={mainContainerStyles} pointerEvents="none">
|
|
48
|
+
<Animated.View
|
|
49
|
+
style={[
|
|
50
|
+
mainContainerStyles,
|
|
51
|
+
{
|
|
52
|
+
opacity: fadeAnimation,
|
|
53
|
+
},
|
|
54
|
+
]}
|
|
55
|
+
>
|
|
56
|
+
<ImageBackground
|
|
57
|
+
source={backgroundImageSource}
|
|
58
|
+
style={styles.flex}
|
|
59
|
+
resizeMode="cover"
|
|
60
|
+
>
|
|
61
|
+
<View style={mainContainerStyles} />
|
|
62
|
+
</ImageBackground>
|
|
63
|
+
</Animated.View>
|
|
64
|
+
</View>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<
|
|
3
|
+
exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
pointerEvents="none"
|
|
6
6
|
style={
|
|
7
7
|
{
|
|
8
8
|
"backgroundColor": "transparent",
|
|
9
|
-
"height": "100%",
|
|
10
9
|
"overflow": "hidden",
|
|
11
|
-
"width": "100%",
|
|
12
10
|
}
|
|
13
11
|
}
|
|
14
12
|
>
|
|
@@ -17,10 +15,8 @@ exports[`<AudioPlayer /> renders correctly 1`] = `
|
|
|
17
15
|
style={
|
|
18
16
|
{
|
|
19
17
|
"backgroundColor": "transparent",
|
|
20
|
-
"height": "100%",
|
|
21
18
|
"opacity": 0,
|
|
22
19
|
"overflow": "hidden",
|
|
23
|
-
"width": "100%",
|
|
24
20
|
}
|
|
25
21
|
}
|
|
26
22
|
>
|
|
@@ -36,7 +32,7 @@ exports[`<AudioPlayer /> renders correctly 1`] = `
|
|
|
36
32
|
resizeMode="cover"
|
|
37
33
|
source={
|
|
38
34
|
{
|
|
39
|
-
"uri": "
|
|
35
|
+
"uri": "background_image_url",
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
38
|
style={
|
|
@@ -60,9 +56,7 @@ exports[`<AudioPlayer /> renders correctly 1`] = `
|
|
|
60
56
|
style={
|
|
61
57
|
{
|
|
62
58
|
"backgroundColor": "transparent",
|
|
63
|
-
"height": "100%",
|
|
64
59
|
"overflow": "hidden",
|
|
65
|
-
"width": "100%",
|
|
66
60
|
}
|
|
67
61
|
}
|
|
68
62
|
/>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
|
+
|
|
4
|
+
import { AudioPlayerMobileLayout } from "../Layout";
|
|
5
|
+
|
|
6
|
+
const audioPlayerLayoutProps = {
|
|
7
|
+
backgroundImageSource: { uri: "background_image_url" },
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
describe("<AudioPlayerMobileLayout />", () => {
|
|
11
|
+
it("renders correctly", () => {
|
|
12
|
+
const { toJSON } = render(
|
|
13
|
+
<AudioPlayerMobileLayout {...audioPlayerLayoutProps} />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(toJSON()).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useBackgroundImage } from "@applicaster/zapp-react-native-utils/audioPlayerUtils";
|
|
3
|
+
|
|
4
|
+
import { AudioPlayerMobileLayout } from "./Layout";
|
|
5
|
+
import { Props } from "../types";
|
|
6
|
+
|
|
7
|
+
export function AudioPlayerMobile(props: Props) {
|
|
8
|
+
const { audio_item, style = {} } = props;
|
|
9
|
+
|
|
10
|
+
const backgroundImageSource = useBackgroundImage(audio_item);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<AudioPlayerMobileLayout
|
|
14
|
+
backgroundImageSource={backgroundImageSource}
|
|
15
|
+
style={style}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { View, ImageBackground,
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, ImageBackground, ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
5
|
|
|
@@ -7,34 +7,30 @@ 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: string
|
|
15
|
+
backgroundImage: Option<string>;
|
|
16
16
|
isRTL: boolean;
|
|
17
17
|
artworkBorderRadius: Option<number>;
|
|
18
18
|
};
|
|
19
19
|
children: React.ReactNode;
|
|
20
|
+
style: ViewStyle;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
export function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
duration: 3000,
|
|
29
|
-
useNativeDriver: true,
|
|
30
|
-
}).start();
|
|
31
|
-
};
|
|
32
|
-
|
|
23
|
+
export function AudioPlayerTVLayout({
|
|
24
|
+
artwork,
|
|
25
|
+
config,
|
|
26
|
+
children,
|
|
27
|
+
style,
|
|
28
|
+
}: Props) {
|
|
33
29
|
const { isRTL, backgroundColor, backgroundImage } = config;
|
|
34
30
|
|
|
35
|
-
const backgroundImageSource = { uri: backgroundImage
|
|
31
|
+
const backgroundImageSource = { uri: backgroundImage };
|
|
36
32
|
|
|
37
|
-
const backgroundColorStyle =
|
|
33
|
+
const backgroundColorStyle = backgroundImage
|
|
38
34
|
? "transparent"
|
|
39
35
|
: backgroundColor;
|
|
40
36
|
|
|
@@ -66,8 +62,7 @@ export function AudioPlayerLayout({ artwork, config, children }: Props) {
|
|
|
66
62
|
native: {
|
|
67
63
|
backgroundColor: backgroundColorStyle,
|
|
68
64
|
overflow: "hidden",
|
|
69
|
-
|
|
70
|
-
height: "100%",
|
|
65
|
+
...style,
|
|
71
66
|
},
|
|
72
67
|
samsung_tv: {
|
|
73
68
|
position: "absolute",
|
|
@@ -119,9 +114,6 @@ export function AudioPlayerLayout({ artwork, config, children }: Props) {
|
|
|
119
114
|
alignItems: "center",
|
|
120
115
|
justifyContent: "center",
|
|
121
116
|
},
|
|
122
|
-
native: {
|
|
123
|
-
flex: 1,
|
|
124
|
-
},
|
|
125
117
|
});
|
|
126
118
|
|
|
127
119
|
const textContainerStyles = platformSelect({
|
|
@@ -145,58 +137,25 @@ export function AudioPlayerLayout({ artwork, config, children }: Props) {
|
|
|
145
137
|
},
|
|
146
138
|
});
|
|
147
139
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
140
|
+
if (backgroundImage) {
|
|
141
|
+
return (
|
|
142
|
+
<ImageBackground
|
|
143
|
+
source={backgroundImageSource}
|
|
144
|
+
style={backgroundImgStyles}
|
|
145
|
+
resizeMode="cover"
|
|
146
|
+
>
|
|
147
|
+
<View style={mainContainerStyles}>
|
|
148
|
+
<Artwork srcImage={artwork} config={config} />
|
|
149
|
+
<View style={textContainerStyles}>{children}</View>
|
|
150
|
+
</View>
|
|
151
|
+
</ImageBackground>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return (
|
|
160
156
|
<View style={mainContainerStyles}>
|
|
161
|
-
|
|
157
|
+
<Artwork srcImage={artwork} config={config} />
|
|
162
158
|
<View style={textContainerStyles}>{children}</View>
|
|
163
159
|
</View>
|
|
164
160
|
);
|
|
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;
|
|
202
161
|
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<AudioPlayerTV /> renders correctly 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
accessibilityIgnoresInvertColors={true}
|
|
6
|
+
>
|
|
7
|
+
<Image
|
|
8
|
+
resizeMode="cover"
|
|
9
|
+
source={
|
|
10
|
+
{
|
|
11
|
+
"uri": "https://example.com",
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
style={
|
|
15
|
+
[
|
|
16
|
+
{
|
|
17
|
+
"bottom": 0,
|
|
18
|
+
"left": 0,
|
|
19
|
+
"position": "absolute",
|
|
20
|
+
"right": 0,
|
|
21
|
+
"top": 0,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"height": undefined,
|
|
25
|
+
"width": undefined,
|
|
26
|
+
},
|
|
27
|
+
undefined,
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
/>
|
|
31
|
+
<View
|
|
32
|
+
style={
|
|
33
|
+
{
|
|
34
|
+
"backgroundColor": "transparent",
|
|
35
|
+
"overflow": "hidden",
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
<View
|
|
40
|
+
style={
|
|
41
|
+
{
|
|
42
|
+
"marginHorizontal": 24,
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
>
|
|
46
|
+
<Image
|
|
47
|
+
fadeDuration={0}
|
|
48
|
+
resizeMode="cover"
|
|
49
|
+
source={
|
|
50
|
+
{
|
|
51
|
+
"uri": "artwork_url",
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
style={
|
|
55
|
+
[
|
|
56
|
+
{
|
|
57
|
+
"height": 400,
|
|
58
|
+
"width": 400,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"borderRadius": 0,
|
|
62
|
+
},
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
/>
|
|
66
|
+
</View>
|
|
67
|
+
<View>
|
|
68
|
+
<View
|
|
69
|
+
style={
|
|
70
|
+
{
|
|
71
|
+
"height": 72,
|
|
72
|
+
"marginBottom": 30,
|
|
73
|
+
"width": 128,
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
>
|
|
77
|
+
<Image
|
|
78
|
+
fadeDuration={0}
|
|
79
|
+
source={
|
|
80
|
+
{
|
|
81
|
+
"uri": "https://example.com",
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
style={
|
|
85
|
+
{
|
|
86
|
+
"height": 72,
|
|
87
|
+
"width": 128,
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/>
|
|
91
|
+
</View>
|
|
92
|
+
<View
|
|
93
|
+
style={
|
|
94
|
+
{
|
|
95
|
+
"height": 100,
|
|
96
|
+
"marginBottom": 12,
|
|
97
|
+
"width": 600,
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
>
|
|
101
|
+
<Text
|
|
102
|
+
numberOfLines={2}
|
|
103
|
+
style={
|
|
104
|
+
{
|
|
105
|
+
"color": "white",
|
|
106
|
+
"fontFamily": null,
|
|
107
|
+
"fontSize": 38,
|
|
108
|
+
"fontWeight": "600",
|
|
109
|
+
"textAlign": "right",
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
>
|
|
113
|
+
tittle
|
|
114
|
+
</Text>
|
|
115
|
+
</View>
|
|
116
|
+
<View
|
|
117
|
+
style={
|
|
118
|
+
{
|
|
119
|
+
"height": 80,
|
|
120
|
+
"marginBottom": 30,
|
|
121
|
+
"width": 600,
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
>
|
|
125
|
+
<Text
|
|
126
|
+
numberOfLines={2}
|
|
127
|
+
style={
|
|
128
|
+
{
|
|
129
|
+
"color": "white",
|
|
130
|
+
"fontFamily": null,
|
|
131
|
+
"fontSize": 20,
|
|
132
|
+
"fontWeight": "600",
|
|
133
|
+
"opacity": 0.8,
|
|
134
|
+
"textAlign": "right",
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
>
|
|
138
|
+
Summary
|
|
139
|
+
</Text>
|
|
140
|
+
</View>
|
|
141
|
+
<View
|
|
142
|
+
style={
|
|
143
|
+
{
|
|
144
|
+
"height": 40,
|
|
145
|
+
"justifyContent": "flex-end",
|
|
146
|
+
"width": 600,
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
>
|
|
150
|
+
<Text
|
|
151
|
+
style={
|
|
152
|
+
{
|
|
153
|
+
"alignItems": "flex-start",
|
|
154
|
+
"color": "white",
|
|
155
|
+
"flexDirection": "row-reverse",
|
|
156
|
+
"fontFamily": null,
|
|
157
|
+
"fontSize": 20,
|
|
158
|
+
"justifyContent": "flex-end",
|
|
159
|
+
"opacity": 0.8,
|
|
160
|
+
"textAlign": "right",
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
>
|
|
164
|
+
10:10 - 11:11
|
|
165
|
+
</Text>
|
|
166
|
+
</View>
|
|
167
|
+
</View>
|
|
168
|
+
</View>
|
|
169
|
+
</View>
|
|
170
|
+
`;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render } from "@testing-library/react-native";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { AudioPlayerTV } from "..";
|
|
5
|
+
|
|
6
|
+
jest.mock("@applicaster/zapp-react-native-utils/audioPlayerUtils", () => ({
|
|
7
|
+
useArtworkImage: jest.fn(() => "artwork_url"),
|
|
8
|
+
}));
|
|
5
9
|
|
|
6
10
|
const audioPlayerProps = {
|
|
7
11
|
audio_item: {
|
|
@@ -45,9 +49,9 @@ const audioPlayerProps = {
|
|
|
45
49
|
styles: {},
|
|
46
50
|
};
|
|
47
51
|
|
|
48
|
-
describe("<
|
|
52
|
+
describe("<AudioPlayerTV />", () => {
|
|
49
53
|
it("renders correctly", () => {
|
|
50
|
-
const { toJSON } = render(<
|
|
54
|
+
const { toJSON } = render(<AudioPlayerTV {...audioPlayerProps} />);
|
|
51
55
|
expect(toJSON()).toMatchSnapshot();
|
|
52
56
|
});
|
|
53
57
|
});
|
|
@@ -2,9 +2,8 @@ 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_background_image: undefined,
|
|
6
6
|
audio_player_rtl: false,
|
|
7
|
-
audio_player_background_image_default_color: "",
|
|
8
7
|
};
|
|
9
8
|
|
|
10
9
|
export function getPropertyFromEntryOrConfig({ entry, plugin_configuration }) {
|
|
@@ -1,60 +1,24 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from "react";
|
|
2
2
|
|
|
3
3
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
4
|
+
import { useArtworkImage } from "@applicaster/zapp-react-native-utils/audioPlayerUtils";
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
+
import { AudioPlayerTVLayout } from "./Layout";
|
|
6
7
|
|
|
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
|
-
|
|
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;
|
|
13
|
+
|
|
14
|
+
import { Props } from "../types";
|
|
15
|
+
|
|
16
|
+
export function AudioPlayerTV(props: Props) {
|
|
17
|
+
const { audio_item, plugin_configuration, style = {} } = props;
|
|
56
18
|
const { extensions, title, summary } = audio_item;
|
|
57
19
|
|
|
20
|
+
const artwork = useArtworkImage(audio_item);
|
|
21
|
+
|
|
58
22
|
const getProp = useCallback(
|
|
59
23
|
getPropertyFromEntryOrConfig({
|
|
60
24
|
entry: audio_item,
|
|
@@ -64,20 +28,15 @@ export function AudioPlayer(props: Props) {
|
|
|
64
28
|
);
|
|
65
29
|
|
|
66
30
|
const config = useMemo(() => {
|
|
67
|
-
// Checking if we are
|
|
31
|
+
// Checking if we are receiving items from the DSP
|
|
68
32
|
const titleColor = getProp("audio_player_title_color");
|
|
69
33
|
const summaryColor = getProp("audio_player_summary_color");
|
|
70
34
|
const backgroundColor = getProp("audio_player_background_color");
|
|
71
35
|
const backgroundImage = getProp("audio_player_background_image");
|
|
72
|
-
const artworkAspectRatio = getProp("audio_player_artwork_aspect_ratio");
|
|
73
36
|
const channelIcon = getProp("audio_player_channel_icon");
|
|
74
37
|
const rtlFlag = getProp("audio_player_rtl");
|
|
75
38
|
const artworkBorderRadius = getProp("audio_player_artwork_border_radius");
|
|
76
39
|
|
|
77
|
-
const audioPlayerBackgroundImageDefaultColor = getProp(
|
|
78
|
-
"audio_player_background_image_default_color"
|
|
79
|
-
);
|
|
80
|
-
|
|
81
40
|
const isRTL = rtlFlag === "1" || rtlFlag === "true" || rtlFlag === true;
|
|
82
41
|
|
|
83
42
|
const titleFontFamily = getProp(
|
|
@@ -152,23 +111,17 @@ export function AudioPlayer(props: Props) {
|
|
|
152
111
|
summaryFontSize,
|
|
153
112
|
runTimeFontFamily,
|
|
154
113
|
runTimeFontSize,
|
|
155
|
-
artworkAspectRatio,
|
|
156
114
|
channelIcon,
|
|
157
|
-
audioPlayerBackgroundImageDefaultColor,
|
|
158
115
|
artworkBorderRadius,
|
|
159
116
|
};
|
|
160
117
|
}, [getProp]);
|
|
161
118
|
|
|
162
|
-
const artwork = imageSrcFromMediaItem(audio_item, [
|
|
163
|
-
config?.artworkAspectRatio,
|
|
164
|
-
]);
|
|
165
|
-
|
|
166
119
|
return (
|
|
167
|
-
<
|
|
120
|
+
<AudioPlayerTVLayout artwork={artwork} config={config} style={style}>
|
|
168
121
|
<Channel srcImage={config?.channelIcon} config={config} />
|
|
169
122
|
<Title title={title} config={config} />
|
|
170
123
|
<Summary summary={summary} config={config} />
|
|
171
124
|
<Runtime {...extensions} config={config} />
|
|
172
|
-
</
|
|
125
|
+
</AudioPlayerTVLayout>
|
|
173
126
|
);
|
|
174
127
|
}
|