@applicaster/zapp-react-native-ui-components 16.0.0-alpha.5063542327 → 16.0.0-alpha.5652127751
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/BackgroundImage/BackgroundImage.tsx +42 -0
- package/Components/BackgroundImage/BackgroundImage.tv.android.tsx +28 -0
- package/Components/BackgroundImage/BackgroundImage.tv.ios.tsx +24 -0
- package/Components/BackgroundImage/index.ts +1 -0
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +0 -1
- package/Components/Layout/TV/index.tsx +3 -4
- package/Components/Layout/TV/index.web.tsx +2 -3
- package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.tsx +1 -1
- package/Components/ScreenRevealManager/Overlay.tsx +34 -0
- package/Components/ScreenRevealManager/__tests__/Overlay.test.tsx +88 -0
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +8 -19
- package/Components/VideoLive/LiveImageManager.ts +56 -45
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +3 -1
- package/Helpers/index.js +7 -1
- package/package.json +5 -5
- package/Components/Layout/TV/LayoutBackground.tsx +0 -31
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, ViewStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
5
|
+
import {
|
|
6
|
+
selectRemoteConfigurations,
|
|
7
|
+
useAppSelector,
|
|
8
|
+
} from "@applicaster/zapp-react-native-redux";
|
|
9
|
+
|
|
10
|
+
import { getBackgroundImageUrl } from "../Layout/utils";
|
|
11
|
+
|
|
12
|
+
const baseBackgroundStyles = (imageUrl, backgroundColor) =>
|
|
13
|
+
({
|
|
14
|
+
position: "absolute",
|
|
15
|
+
left: 0,
|
|
16
|
+
top: 0,
|
|
17
|
+
right: 0,
|
|
18
|
+
bottom: 0,
|
|
19
|
+
zIndex: -1,
|
|
20
|
+
backgroundSize: "cover",
|
|
21
|
+
background: imageUrl
|
|
22
|
+
? `url(${imageUrl}) no-repeat top center ${backgroundColor}`
|
|
23
|
+
: backgroundColor,
|
|
24
|
+
}) as ViewStyle;
|
|
25
|
+
|
|
26
|
+
export const BackgroundImage = ({ children }: React.PropsWithChildren) => {
|
|
27
|
+
const theme = useTheme();
|
|
28
|
+
|
|
29
|
+
const remoteConfigurations = useAppSelector(selectRemoteConfigurations);
|
|
30
|
+
|
|
31
|
+
const backgroundColor = theme.app_background_color;
|
|
32
|
+
const backgroundImageUrl = getBackgroundImageUrl(remoteConfigurations);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View
|
|
36
|
+
id="background"
|
|
37
|
+
style={baseBackgroundStyles(backgroundImageUrl, backgroundColor)}
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
</View>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
ImageURISource,
|
|
6
|
+
ImageBackground,
|
|
7
|
+
} from "react-native";
|
|
8
|
+
|
|
9
|
+
import { ASSETS } from "@applicaster/zapp-react-native-ui-components/Helpers";
|
|
10
|
+
|
|
11
|
+
const imageSource: ImageURISource = {
|
|
12
|
+
uri: ASSETS.APP_BACKGROUND_IMAGE,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const styles = StyleSheet.create({
|
|
16
|
+
container: { flex: 1 },
|
|
17
|
+
backgroundImage: { width: "100%", height: "100%" },
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export function BackgroundImage({ children }: React.PropsWithChildren) {
|
|
21
|
+
return (
|
|
22
|
+
<View style={styles.container}>
|
|
23
|
+
<ImageBackground style={styles.backgroundImage} source={imageSource}>
|
|
24
|
+
{children}
|
|
25
|
+
</ImageBackground>
|
|
26
|
+
</View>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, StyleSheet, ImageURISource } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { QBImage as Image } from "@applicaster/zapp-react-native-ui-components/Components/Image";
|
|
5
|
+
import { ASSETS } from "@applicaster/zapp-react-native-ui-components/Helpers";
|
|
6
|
+
|
|
7
|
+
const imageSource: ImageURISource = {
|
|
8
|
+
uri: ASSETS.APP_BACKGROUND_IMAGE,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
container: { flex: 1 },
|
|
13
|
+
backgroundImage: { width: "100%", height: "100%" },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export function BackgroundImage({ children }: React.PropsWithChildren) {
|
|
17
|
+
return (
|
|
18
|
+
<View style={styles.container}>
|
|
19
|
+
<Image style={styles.backgroundImage} source={imageSource}>
|
|
20
|
+
{children}
|
|
21
|
+
</Image>
|
|
22
|
+
</View>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BackgroundImage } from "./BackgroundImage";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useAppSelector } from "@applicaster/zapp-react-native-redux/hooks";
|
|
3
3
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
4
|
+
import { selectAppReady } from "@applicaster/zapp-react-native-redux";
|
|
4
5
|
|
|
5
6
|
import { LayoutContainer } from "./LayoutContainer";
|
|
6
7
|
import { ScreenContainer } from "./ScreenContainer";
|
|
@@ -9,8 +10,6 @@ import { ScreenLayoutContextProvider } from "./ScreenLayoutContextProvider";
|
|
|
9
10
|
import { PathnameContext } from "../../../Contexts/PathnameContext";
|
|
10
11
|
import { ScreenDataContext } from "../../../Contexts/ScreenDataContext";
|
|
11
12
|
import { ScreenContextProvider } from "../../../Contexts/ScreenContext";
|
|
12
|
-
import { LayoutBackground } from "./LayoutBackground";
|
|
13
|
-
import { selectAppReady } from "@applicaster/zapp-react-native-redux";
|
|
14
13
|
|
|
15
14
|
type Components = {
|
|
16
15
|
NavBar: React.ComponentType<any>;
|
|
@@ -39,7 +38,7 @@ const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
|
|
|
39
38
|
return (
|
|
40
39
|
<LayoutContainer>
|
|
41
40
|
<ScreenLayoutContextProvider>
|
|
42
|
-
<
|
|
41
|
+
<Components.Background>
|
|
43
42
|
<ScreenDataContext.Provider value={navigator.data}>
|
|
44
43
|
<PathnameContext.Provider value={navigator.currentRoute}>
|
|
45
44
|
<ScreenContextProvider pathname={navigator.currentRoute}>
|
|
@@ -52,7 +51,7 @@ const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
|
|
|
52
51
|
</ScreenContextProvider>
|
|
53
52
|
</PathnameContext.Provider>
|
|
54
53
|
</ScreenDataContext.Provider>
|
|
55
|
-
</
|
|
54
|
+
</Components.Background>
|
|
56
55
|
</ScreenLayoutContextProvider>
|
|
57
56
|
</LayoutContainer>
|
|
58
57
|
);
|
|
@@ -4,7 +4,6 @@ import { useAppSelector } from "@applicaster/zapp-react-native-redux/hooks";
|
|
|
4
4
|
|
|
5
5
|
import { ScreenLayoutContextProvider } from "./ScreenLayoutContextProvider";
|
|
6
6
|
import { StackNavigator } from "../../Navigator";
|
|
7
|
-
import { LayoutBackground } from "./LayoutBackground";
|
|
8
7
|
import { selectAppReady } from "@applicaster/zapp-react-native-redux";
|
|
9
8
|
|
|
10
9
|
type Components = {
|
|
@@ -25,9 +24,9 @@ const Layout = ({ Components }: Props) => {
|
|
|
25
24
|
|
|
26
25
|
return (
|
|
27
26
|
<ScreenLayoutContextProvider>
|
|
28
|
-
<
|
|
27
|
+
<Components.Background>
|
|
29
28
|
<StackNavigator Components={Components} />
|
|
30
|
-
</
|
|
29
|
+
</Components.Background>
|
|
31
30
|
</ScreenLayoutContextProvider>
|
|
32
31
|
);
|
|
33
32
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Animated, StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { BackgroundImage } from "@applicaster/zapp-react-native-ui-components/Components/BackgroundImage";
|
|
5
|
+
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
container: {
|
|
8
|
+
...StyleSheet.absoluteFillObject,
|
|
9
|
+
position: "absolute",
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const Overlay = ({
|
|
14
|
+
opacity,
|
|
15
|
+
backgroundColor,
|
|
16
|
+
}: {
|
|
17
|
+
opacity: Animated.Value;
|
|
18
|
+
backgroundColor: string;
|
|
19
|
+
}) => {
|
|
20
|
+
return (
|
|
21
|
+
<Animated.View
|
|
22
|
+
style={[
|
|
23
|
+
styles.container,
|
|
24
|
+
{
|
|
25
|
+
opacity,
|
|
26
|
+
backgroundColor,
|
|
27
|
+
},
|
|
28
|
+
]}
|
|
29
|
+
testID="animated-component"
|
|
30
|
+
>
|
|
31
|
+
<BackgroundImage />
|
|
32
|
+
</Animated.View>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Animated } from "react-native";
|
|
3
|
+
import { render } from "@testing-library/react-native";
|
|
4
|
+
|
|
5
|
+
jest.mock(
|
|
6
|
+
"@applicaster/zapp-react-native-ui-components/Components/BackgroundImage",
|
|
7
|
+
() => {
|
|
8
|
+
const { Text } = require("react-native");
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
BackgroundImage: () => (
|
|
12
|
+
<Text testID="background-image">BackgroundImage</Text>
|
|
13
|
+
),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
import { Overlay } from "../Overlay";
|
|
19
|
+
|
|
20
|
+
const flattenStyle = (style: unknown): Record<string, unknown> => {
|
|
21
|
+
if (!style) {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (Array.isArray(style)) {
|
|
26
|
+
return style.reduce<Record<string, unknown>>(
|
|
27
|
+
(acc, item) => ({ ...acc, ...flattenStyle(item) }),
|
|
28
|
+
{}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (typeof style === "object") {
|
|
33
|
+
return style as Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
describe("Overlay", () => {
|
|
40
|
+
it("renders the animated overlay container", () => {
|
|
41
|
+
const opacity = new Animated.Value(1);
|
|
42
|
+
|
|
43
|
+
const { getByTestId } = render(
|
|
44
|
+
<Overlay opacity={opacity} backgroundColor="#000000" />
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
expect(getByTestId("animated-component")).toBeTruthy();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("applies opacity and backgroundColor to the overlay", () => {
|
|
51
|
+
const opacity = new Animated.Value(0.5);
|
|
52
|
+
|
|
53
|
+
const { getByTestId } = render(
|
|
54
|
+
<Overlay opacity={opacity} backgroundColor="#ff0000" />
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const style = flattenStyle(getByTestId("animated-component").props.style);
|
|
58
|
+
|
|
59
|
+
expect(style.backgroundColor).toBe("#ff0000");
|
|
60
|
+
expect(style.opacity).toBe(0.5);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("positions the overlay with absolute fill layout", () => {
|
|
64
|
+
const opacity = new Animated.Value(1);
|
|
65
|
+
|
|
66
|
+
const { getByTestId } = render(
|
|
67
|
+
<Overlay opacity={opacity} backgroundColor="#000000" />
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const style = flattenStyle(getByTestId("animated-component").props.style);
|
|
71
|
+
|
|
72
|
+
expect(style.position).toBe("absolute");
|
|
73
|
+
expect(style.top).toBe(0);
|
|
74
|
+
expect(style.left).toBe(0);
|
|
75
|
+
expect(style.right).toBe(0);
|
|
76
|
+
expect(style.bottom).toBe(0);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("renders BackgroundImage inside the overlay", () => {
|
|
80
|
+
const opacity = new Animated.Value(1);
|
|
81
|
+
|
|
82
|
+
const { getByTestId } = render(
|
|
83
|
+
<Overlay opacity={opacity} backgroundColor="#000000" />
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
expect(getByTestId("background-image")).toBeTruthy();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { Animated
|
|
2
|
+
import { Animated } from "react-native";
|
|
3
|
+
|
|
3
4
|
import { isFirstComponentScreenPicker } from "@applicaster/zapp-react-native-utils/componentsUtils";
|
|
4
5
|
import { useRefWithInitialValue } from "@applicaster/zapp-react-native-utils/reactHooks/state/useRefWithInitialValue";
|
|
5
6
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
7
|
+
import { Overlay } from "./Overlay";
|
|
6
8
|
|
|
7
9
|
import { ScreenRevealManager } from "./ScreenRevealManager";
|
|
8
10
|
import {
|
|
@@ -10,13 +12,6 @@ import {
|
|
|
10
12
|
emitScreenRevealManagerIsNotReadyToShow,
|
|
11
13
|
} from "./utils";
|
|
12
14
|
|
|
13
|
-
const styles = StyleSheet.create({
|
|
14
|
-
container: {
|
|
15
|
-
...StyleSheet.absoluteFillObject,
|
|
16
|
-
position: "absolute",
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
15
|
export const TIMEOUT = 300; // 300 ms
|
|
21
16
|
|
|
22
17
|
const HIDDEN = 0; // opacity = 0
|
|
@@ -93,17 +88,11 @@ export const withScreenRevealManager = (Component) => {
|
|
|
93
88
|
onLoadFailedFromScreenRevealManager={managerRef.current.onLoadFailed}
|
|
94
89
|
/>
|
|
95
90
|
{isShowOverlay ? (
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// TODO: we should support background image as well, but for now we will use background color from theme
|
|
102
|
-
backgroundColor:
|
|
103
|
-
props.backgroundColor ?? theme.app_background_color,
|
|
104
|
-
},
|
|
105
|
-
]}
|
|
106
|
-
testID="animated-component"
|
|
91
|
+
<Overlay
|
|
92
|
+
opacity={opacityRef.current}
|
|
93
|
+
backgroundColor={
|
|
94
|
+
props.backgroundColor ?? theme.app_background_color
|
|
95
|
+
}
|
|
107
96
|
/>
|
|
108
97
|
) : null}
|
|
109
98
|
</>
|
|
@@ -48,7 +48,6 @@ type Position = {
|
|
|
48
48
|
type PlayerFactoryConfig = {
|
|
49
49
|
player: any; // React ref for native view
|
|
50
50
|
playerId: string;
|
|
51
|
-
muted: boolean;
|
|
52
51
|
playerPluginId: string;
|
|
53
52
|
screenConfig: Record<string, any>;
|
|
54
53
|
entry: ZappEntry; // original entry, used as fallback if no hooks
|
|
@@ -296,7 +295,7 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
296
295
|
|
|
297
296
|
setUserCellPlayerMutedPreference(true);
|
|
298
297
|
|
|
299
|
-
this.items.forEach((liveImage) => liveImage.
|
|
298
|
+
this.items.forEach((liveImage) => liveImage.mute());
|
|
300
299
|
};
|
|
301
300
|
|
|
302
301
|
public unmuteAll = () => {
|
|
@@ -304,7 +303,7 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
304
303
|
|
|
305
304
|
setUserCellPlayerMutedPreference(false);
|
|
306
305
|
|
|
307
|
-
this.items.forEach((liveImage) => liveImage.
|
|
306
|
+
this.items.forEach((liveImage) => liveImage.unmute());
|
|
308
307
|
};
|
|
309
308
|
|
|
310
309
|
public onViewPositionChanged = (item: LiveImage) => {
|
|
@@ -574,6 +573,20 @@ export class LiveImage implements QuickBrickPlayer.SharedPlayerCallBacks {
|
|
|
574
573
|
left: 0,
|
|
575
574
|
};
|
|
576
575
|
|
|
576
|
+
// Keeps muted state in sync: updates the initial value for deferred
|
|
577
|
+
// player creation and forwards to the player if it already exists.
|
|
578
|
+
public initiallyMuted: boolean = true;
|
|
579
|
+
|
|
580
|
+
mute = () => {
|
|
581
|
+
this.initiallyMuted = true;
|
|
582
|
+
this.player?.mute();
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
unmute = () => {
|
|
586
|
+
this.initiallyMuted = false;
|
|
587
|
+
this.player?.unmute();
|
|
588
|
+
};
|
|
589
|
+
|
|
577
590
|
positionToString() {
|
|
578
591
|
if (!this.position) {
|
|
579
592
|
return "position not set";
|
|
@@ -611,48 +624,7 @@ export class LiveImage implements QuickBrickPlayer.SharedPlayerCallBacks {
|
|
|
611
624
|
return this._preparePromise;
|
|
612
625
|
}
|
|
613
626
|
|
|
614
|
-
this._preparePromise = (
|
|
615
|
-
// 1. Run hooks if configured
|
|
616
|
-
let entry = this.factoryConfig.entry;
|
|
617
|
-
|
|
618
|
-
if (this.preloadHooks?.length) {
|
|
619
|
-
const result = await executePreloadHooks({
|
|
620
|
-
preloadHooks: this.preloadHooks,
|
|
621
|
-
entry,
|
|
622
|
-
});
|
|
623
|
-
|
|
624
|
-
if (result) {
|
|
625
|
-
this.processedEntry = result;
|
|
626
|
-
entry = result;
|
|
627
|
-
} else {
|
|
628
|
-
return false;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
// 2. Create the player with the correct entry
|
|
633
|
-
const factoryItem = playerFactory({
|
|
634
|
-
player: this.factoryConfig.player,
|
|
635
|
-
playerId: this.factoryConfig.playerId,
|
|
636
|
-
autoplay: false,
|
|
637
|
-
entry,
|
|
638
|
-
muted: this.factoryConfig.muted,
|
|
639
|
-
playerPluginId: this.factoryConfig.playerPluginId,
|
|
640
|
-
screenConfig: this.factoryConfig.screenConfig,
|
|
641
|
-
playerRole: PlayerRole.Cell,
|
|
642
|
-
});
|
|
643
|
-
|
|
644
|
-
if (!factoryItem) {
|
|
645
|
-
throw new Error("Player factory returned null");
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
this.player = factoryItem.controller;
|
|
649
|
-
this.component = factoryItem.Component;
|
|
650
|
-
|
|
651
|
-
// 3. Register callbacks — player now exists
|
|
652
|
-
this.player.addListener({ id: "live-image", listener: this });
|
|
653
|
-
|
|
654
|
-
return true;
|
|
655
|
-
})()
|
|
627
|
+
this._preparePromise = this.createPreparedPlayer()
|
|
656
628
|
.then((result) => {
|
|
657
629
|
this._preparePromise = null;
|
|
658
630
|
|
|
@@ -672,6 +644,45 @@ export class LiveImage implements QuickBrickPlayer.SharedPlayerCallBacks {
|
|
|
672
644
|
return this._preparePromise;
|
|
673
645
|
}
|
|
674
646
|
|
|
647
|
+
private async createPreparedPlayer(): Promise<boolean> {
|
|
648
|
+
let entry = this.factoryConfig.entry;
|
|
649
|
+
|
|
650
|
+
if (this.preloadHooks?.length) {
|
|
651
|
+
const result = await executePreloadHooks({
|
|
652
|
+
preloadHooks: this.preloadHooks,
|
|
653
|
+
entry,
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
if (!result) return false;
|
|
657
|
+
|
|
658
|
+
this.processedEntry = result;
|
|
659
|
+
entry = result;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
const factoryItem = await playerFactory({
|
|
663
|
+
player: this.factoryConfig.player,
|
|
664
|
+
playerId: this.factoryConfig.playerId,
|
|
665
|
+
autoplay: false,
|
|
666
|
+
entry,
|
|
667
|
+
muted: this.initiallyMuted,
|
|
668
|
+
playerPluginId: this.factoryConfig.playerPluginId,
|
|
669
|
+
screenConfig: this.factoryConfig.screenConfig,
|
|
670
|
+
playerRole: PlayerRole.Cell,
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
if (!factoryItem) {
|
|
674
|
+
throw new Error(
|
|
675
|
+
`Player factory returned null (playerId: ${this.factoryConfig.playerId}, playerPluginId: ${this.factoryConfig.playerPluginId})`
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
this.player = factoryItem.controller;
|
|
680
|
+
this.component = factoryItem.Component;
|
|
681
|
+
this.player.addListener({ id: "live-image", listener: this });
|
|
682
|
+
|
|
683
|
+
return true;
|
|
684
|
+
}
|
|
685
|
+
|
|
675
686
|
public getPlayer = (): Player | null => {
|
|
676
687
|
return this.player;
|
|
677
688
|
};
|
|
@@ -126,7 +126,6 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
126
126
|
factoryConfig: {
|
|
127
127
|
player: ref,
|
|
128
128
|
playerId,
|
|
129
|
-
muted, // omitted from hook parameters as it can be changed by user and should not trigger factory again
|
|
130
129
|
playerPluginId: playerPluginId,
|
|
131
130
|
screenConfig: screenConfig,
|
|
132
131
|
entry: item,
|
|
@@ -135,6 +134,9 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
135
134
|
});
|
|
136
135
|
}, [playerId, preloadHooks, playerPluginId, screenConfig, item]);
|
|
137
136
|
|
|
137
|
+
// Keep the muted state in sync with user preference and player state
|
|
138
|
+
liveImageItem.initiallyMuted = muted;
|
|
139
|
+
|
|
138
140
|
React.useEffect(() => {
|
|
139
141
|
liveImageItem.setMode = setModeDebounced;
|
|
140
142
|
}, [setModeDebounced, liveImageItem]);
|
package/Helpers/index.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
2
|
+
|
|
1
3
|
export const ASSETS = {
|
|
2
|
-
APP_BACKGROUND_IMAGE:
|
|
4
|
+
APP_BACKGROUND_IMAGE: platformSelect({
|
|
5
|
+
tvos: "app_background_image",
|
|
6
|
+
android_tv: "tv_app_background",
|
|
7
|
+
amazon: "tv_app_background",
|
|
8
|
+
}),
|
|
3
9
|
};
|
|
4
10
|
|
|
5
11
|
export const ANALYTICS_CORE_EVENTS = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "16.0.0-alpha.
|
|
3
|
+
"version": "16.0.0-alpha.5652127751",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "16.0.0-alpha.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "16.0.0-alpha.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "16.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "16.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "16.0.0-alpha.5652127751",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "16.0.0-alpha.5652127751",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "16.0.0-alpha.5652127751",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "16.0.0-alpha.5652127751",
|
|
35
35
|
"fast-json-stable-stringify": "^2.1.0",
|
|
36
36
|
"promise": "^8.3.0",
|
|
37
37
|
"url": "^0.11.0",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { getBackgroundImageUrl } from "../utils";
|
|
3
|
-
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
4
|
-
import {
|
|
5
|
-
selectRemoteConfigurations,
|
|
6
|
-
useAppSelector,
|
|
7
|
-
} from "@applicaster/zapp-react-native-redux";
|
|
8
|
-
|
|
9
|
-
export const LayoutBackground = ({
|
|
10
|
-
Background,
|
|
11
|
-
children,
|
|
12
|
-
}: {
|
|
13
|
-
Background: React.ComponentType<any>;
|
|
14
|
-
children: React.ReactNode;
|
|
15
|
-
}) => {
|
|
16
|
-
const theme = useTheme();
|
|
17
|
-
|
|
18
|
-
const remoteConfigurations = useAppSelector(selectRemoteConfigurations);
|
|
19
|
-
|
|
20
|
-
const backgroundColor = theme.app_background_color;
|
|
21
|
-
const backgroundImageUrl = getBackgroundImageUrl(remoteConfigurations);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Background
|
|
25
|
-
backgroundColor={backgroundColor}
|
|
26
|
-
backgroundImageUrl={backgroundImageUrl}
|
|
27
|
-
>
|
|
28
|
-
{children}
|
|
29
|
-
</Background>
|
|
30
|
-
);
|
|
31
|
-
};
|