@applicaster/zapp-react-native-ui-components 14.0.0-alpha.3140225604 → 14.0.0-alpha.3216572828
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/mobile/Layout.tsx +1 -1
- package/Components/AudioPlayer/tv/helpers.tsx +10 -3
- package/Components/BaseFocusable/index.tsx +23 -12
- package/Components/Cell/Cell.tsx +3 -8
- package/Components/Cell/index.js +1 -1
- package/Components/ComponentResolver/index.ts +1 -1
- package/Components/FeedLoader/index.js +1 -1
- package/Components/Focusable/FocusableTvOS.tsx +3 -3
- package/Components/Focusable/FocusableiOS.tsx +2 -2
- package/Components/Focusable/index.tsx +1 -1
- package/Components/FocusableList/index.tsx +4 -0
- package/Components/FreezeWithCallback/__tests__/index.test.tsx +67 -43
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +42 -59
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +12 -8
- package/Components/HandlePlayable/HandlePlayable.tsx +14 -8
- package/Components/Layout/TV/LayoutBackground.tsx +1 -1
- package/Components/Layout/TV/__tests__/index.test.tsx +0 -1
- package/Components/MasterCell/DefaultComponents/Button.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/Image/hoc/withDimensions.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +10 -10
- package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +18 -18
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/index.test.tsx +10 -10
- 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/OfflineHandler/__tests__/index.test.tsx +26 -35
- package/Components/PlayerContainer/ErrorDisplay/index.ts +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +26 -22
- package/Components/PlayerContainer/ProgramInfo/index.tsx +1 -1
- package/Components/PlayerContainer/index.ts +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +0 -1
- package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +378 -0
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +2 -2
- package/Components/River/RefreshControl.tsx +6 -4
- package/Components/River/TV/River.tsx +2 -17
- package/Components/River/TV/index.tsx +3 -1
- package/Components/River/TV/withPipesV1DataLoader.tsx +43 -0
- package/Components/River/TV/withRiverDataLoader.tsx +17 -0
- package/Components/River/TV/withTVEventHandler.tsx +1 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
- package/Components/River/index.tsx +1 -1
- package/Components/Screen/__tests__/Screen.test.tsx +28 -29
- package/Components/ScreenRevealManager/ScreenRevealManager.ts +76 -0
- package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +107 -0
- package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +96 -0
- package/Components/ScreenRevealManager/index.ts +1 -0
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +79 -0
- package/Components/Tabs/TV/Tabs.android.tsx +0 -2
- package/Components/Tabs/Tabs.tsx +2 -3
- package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +0 -13
- package/Components/TextInputTv/index.tsx +0 -11
- package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +34 -0
- package/Components/Touchable/__tests__/touchable.test.tsx +12 -17
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +15 -9
- package/Components/VideoLive/animationUtils.ts +3 -3
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +3 -9
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +24 -8
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -5
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -16
- package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +84 -24
- package/Contexts/ConfigutaionContext/__tests__/ConfigurationProvider.test.tsx +3 -3
- package/Decorators/ConfigurationWrapper/__tests__/withConfigurationProvider.test.tsx +3 -3
- package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +3 -6
- package/Decorators/ZappPipesDataConnector/ResolverSelector.tsx +25 -0
- package/Decorators/ZappPipesDataConnector/__tests__/NullFeedResolver.test.tsx +78 -0
- package/Decorators/ZappPipesDataConnector/__tests__/ResolverSelector.test.tsx +205 -0
- package/Decorators/ZappPipesDataConnector/__tests__/StaticFeedResolver.test.tsx +251 -0
- package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +368 -0
- package/Decorators/ZappPipesDataConnector/__tests__/utils.test.ts +39 -0
- package/Decorators/ZappPipesDataConnector/index.tsx +26 -293
- package/Decorators/ZappPipesDataConnector/resolvers/NullFeedResolver.tsx +25 -0
- package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +87 -0
- package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +241 -0
- package/Decorators/ZappPipesDataConnector/types.ts +29 -0
- package/events/index.ts +1 -0
- package/package.json +5 -7
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { all, equals, path, prop, isEmpty, pluck, values } from "ramda";
|
|
2
2
|
|
|
3
3
|
import { useEffect, useMemo } from "react";
|
|
4
|
-
import { useDispatch } from "react-redux";
|
|
5
4
|
|
|
6
5
|
import {
|
|
6
|
+
ZappPipes,
|
|
7
|
+
useAppDispatch,
|
|
7
8
|
useLayoutPresets,
|
|
8
|
-
|
|
9
|
-
} from "@applicaster/zapp-react-native-redux
|
|
10
|
-
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
9
|
+
useZappPipesFeed,
|
|
10
|
+
} from "@applicaster/zapp-react-native-redux";
|
|
11
11
|
import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
12
12
|
import { Categories } from "./logger";
|
|
13
13
|
import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
14
14
|
import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute";
|
|
15
|
+
|
|
15
16
|
import {
|
|
16
17
|
ZappPipesEntryContext,
|
|
17
18
|
ZappPipesScreenContext,
|
|
@@ -26,7 +27,10 @@ import {
|
|
|
26
27
|
import { produce } from "immer";
|
|
27
28
|
// types reference
|
|
28
29
|
|
|
29
|
-
declare
|
|
30
|
+
declare interface CurationEntry {
|
|
31
|
+
preset_name: string;
|
|
32
|
+
feed_url: string;
|
|
33
|
+
}
|
|
30
34
|
|
|
31
35
|
type Feeds = Record<string, ZappPipesData>;
|
|
32
36
|
|
|
@@ -122,7 +126,7 @@ export const getFinalComponents = (
|
|
|
122
126
|
export const useCurationAPI = (
|
|
123
127
|
components: Array<ZappUIComponent>
|
|
124
128
|
): ZappUIComponent[] => {
|
|
125
|
-
const dispatch =
|
|
129
|
+
const dispatch = useAppDispatch();
|
|
126
130
|
|
|
127
131
|
const smartComponents = useMemo(
|
|
128
132
|
() => components?.filter?.(isSmartComponent) ?? [],
|
|
@@ -162,7 +166,7 @@ export const useCurationAPI = (
|
|
|
162
166
|
useEffect(() => {
|
|
163
167
|
urls.forEach((url, index) => {
|
|
164
168
|
if (url) {
|
|
165
|
-
dispatch(loadPipesData(url, { clearCache: false }));
|
|
169
|
+
dispatch(ZappPipes.loadPipesData(url, { clearCache: false }));
|
|
166
170
|
} else {
|
|
167
171
|
logger.log_error("Curation url is empty", {
|
|
168
172
|
componentId: smartComponents?.[index]?.id,
|
|
@@ -171,7 +175,7 @@ export const useCurationAPI = (
|
|
|
171
175
|
});
|
|
172
176
|
}, [urls]);
|
|
173
177
|
|
|
174
|
-
const feeds =
|
|
178
|
+
const feeds = useZappPipesFeed(urls);
|
|
175
179
|
const layoutPresets = useLayoutPresets();
|
|
176
180
|
|
|
177
181
|
const enrichedComponents = useMemo(() => {
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
|
|
15
15
|
import { PlayerContainer } from "../PlayerContainer";
|
|
16
16
|
import { useModalSize } from "../VideoModal/hooks";
|
|
17
|
+
import { ViewStyle } from "react-native";
|
|
17
18
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
18
19
|
|
|
19
20
|
type Props = {
|
|
@@ -150,14 +151,19 @@ export function HandlePlayable({
|
|
|
150
151
|
const modalSize = useModalSize();
|
|
151
152
|
|
|
152
153
|
const style = React.useMemo(
|
|
153
|
-
() =>
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
154
|
+
() =>
|
|
155
|
+
({
|
|
156
|
+
width: isModal
|
|
157
|
+
? modalSize.width
|
|
158
|
+
: mode === "PIP"
|
|
159
|
+
? "100%"
|
|
160
|
+
: screenWidth,
|
|
161
|
+
height: isModal
|
|
162
|
+
? modalSize.height
|
|
163
|
+
: mode === "PIP"
|
|
164
|
+
? "100%"
|
|
165
|
+
: screenHeight,
|
|
166
|
+
}) as ViewStyle,
|
|
161
167
|
[screenWidth, screenHeight, modalSize, isModal, mode]
|
|
162
168
|
);
|
|
163
169
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks
|
|
2
|
+
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
3
3
|
import { getBackgroundImageUrl } from "../utils";
|
|
4
4
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
5
5
|
|
|
@@ -7,7 +7,6 @@ import { NavigationContext } from "@applicaster/zapp-react-native-ui-components/
|
|
|
7
7
|
import configureStore from "redux-mock-store";
|
|
8
8
|
import Layout from "../index.web";
|
|
9
9
|
|
|
10
|
-
// mock useTheme to provide app_background_color
|
|
11
10
|
jest.mock("@applicaster/zapp-react-native-utils/theme", () => ({
|
|
12
11
|
useTheme: () => ({
|
|
13
12
|
app_background_color: "#000000",
|
|
@@ -4,7 +4,7 @@ import * as R from "ramda";
|
|
|
4
4
|
import { TouchableOpacity } from "react-native";
|
|
5
5
|
// import { SvgUri } from "react-native-svg";
|
|
6
6
|
|
|
7
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
7
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
|
|
8
8
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
9
9
|
|
|
10
10
|
import Image from "./Image";
|
|
@@ -20,7 +20,7 @@ const withAppliedDimensions = (style: Style) => (source: Source) => ({
|
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
export const withDimensionsHOC = (Component) => {
|
|
23
|
-
return function WithDimensions(props:
|
|
23
|
+
return function WithDimensions(props: Record<string, unknown>) {
|
|
24
24
|
const theme = useTheme<BaseThemePropertiesMobile>();
|
|
25
25
|
|
|
26
26
|
const useDownScalingImages = toBooleanWithDefaultFalse(
|
|
@@ -13,7 +13,7 @@ export const ImageContainer = (props: Props) => {
|
|
|
13
13
|
const isActive = useIsScreenActive();
|
|
14
14
|
|
|
15
15
|
const Component =
|
|
16
|
-
isVideoPreviewEnabled(props) && isActive ? LiveImage : PureImage;
|
|
16
|
+
isVideoPreviewEnabled(props as Props) && isActive ? LiveImage : PureImage;
|
|
17
17
|
|
|
18
18
|
return <Component {...props} />;
|
|
19
19
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
3
|
import { Image } from "react-native";
|
|
4
4
|
|
|
5
5
|
jest.mock("@applicaster/zapp-react-native-utils/theme", () => ({
|
|
@@ -10,35 +10,35 @@ const CustomImage = require("../Image").default;
|
|
|
10
10
|
|
|
11
11
|
describe("image with no source", () => {
|
|
12
12
|
it("Uses provided placeholder image string", () => {
|
|
13
|
-
const
|
|
13
|
+
const { UNSAFE_getByType } = render(
|
|
14
14
|
<CustomImage placeholderImage={"foo"} />
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const imageComponent = UNSAFE_getByType(Image);
|
|
18
18
|
|
|
19
|
-
expect(
|
|
19
|
+
expect(imageComponent.props.source).toEqual({
|
|
20
20
|
uri: "foo",
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
it("Uses provided placeholder image object", () => {
|
|
25
|
-
const
|
|
25
|
+
const { UNSAFE_getByType } = render(
|
|
26
26
|
<CustomImage placeholderImage={"foo"} />
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const imageComponent = UNSAFE_getByType(Image);
|
|
30
30
|
|
|
31
|
-
expect(
|
|
31
|
+
expect(imageComponent.props.source).toEqual({
|
|
32
32
|
uri: "foo",
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
it("Returns empty string if no image or placeholder defined", () => {
|
|
37
|
-
const
|
|
37
|
+
const { UNSAFE_getByType } = render(
|
|
38
38
|
<CustomImage placeholderImage={null} />
|
|
39
39
|
);
|
|
40
40
|
|
|
41
|
-
const
|
|
42
|
-
expect(
|
|
41
|
+
const imageComponent = UNSAFE_getByType(Image);
|
|
42
|
+
expect(imageComponent.props.source).toBeUndefined();
|
|
43
43
|
});
|
|
44
44
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import RN from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
import TestRenderer from "react-test-renderer";
|
|
5
|
-
import configureStoreFn from "redux-mock-store";
|
|
3
|
+
import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
|
|
6
4
|
|
|
7
5
|
const mockUseIsRTL = jest.fn(() => true);
|
|
8
6
|
const mockGetIsRTL = jest.fn(() => true);
|
|
@@ -17,7 +15,6 @@ jest.mock("@applicaster/zapp-react-native-utils/localizationUtils", () => ({
|
|
|
17
15
|
}));
|
|
18
16
|
|
|
19
17
|
const CustomText = require("../Text").default;
|
|
20
|
-
const mockStore = configureStoreFn();
|
|
21
18
|
|
|
22
19
|
const defaultProps = {
|
|
23
20
|
entry: {},
|
|
@@ -25,16 +22,15 @@ const defaultProps = {
|
|
|
25
22
|
transformText: "default",
|
|
26
23
|
};
|
|
27
24
|
|
|
28
|
-
const getRenderedText = (label: string,
|
|
25
|
+
const getRenderedText = (label: string, storeConfig: any) => {
|
|
29
26
|
const props = { ...{ ...defaultProps, label } };
|
|
30
27
|
|
|
31
|
-
const
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
</Provider>
|
|
28
|
+
const { UNSAFE_getByType } = renderWithProviders(
|
|
29
|
+
<CustomText {...props} />,
|
|
30
|
+
storeConfig
|
|
35
31
|
);
|
|
36
32
|
|
|
37
|
-
return
|
|
33
|
+
return UNSAFE_getByType(RN.Text).props.children;
|
|
38
34
|
};
|
|
39
35
|
|
|
40
36
|
describe("RTL app: Hebrew text contains english word", () => {
|
|
@@ -42,28 +38,32 @@ describe("RTL app: Hebrew text contains english word", () => {
|
|
|
42
38
|
const textWithNotFirstEnglishWord = "השיר של נועה נועה קירל באירוויזיון Word";
|
|
43
39
|
const textWithoutEnglishWord = "השיר של נועה נועה קירל באירוויזיון";
|
|
44
40
|
|
|
45
|
-
const
|
|
41
|
+
const storeConfig = {
|
|
46
42
|
remoteConfigurations: { localizations: { he: {} } },
|
|
47
43
|
appData: {
|
|
48
44
|
languageCode: "he",
|
|
49
45
|
countryCode: "IL",
|
|
50
46
|
},
|
|
51
|
-
}
|
|
47
|
+
};
|
|
52
48
|
|
|
53
49
|
it("Hebrew text contains first english word", () => {
|
|
54
|
-
const renderedText = getRenderedText(textWithFirstEnglishWord,
|
|
50
|
+
const renderedText = getRenderedText(textWithFirstEnglishWord, storeConfig);
|
|
55
51
|
const desiredText = "\u200fWord\u202c השיר של נועה נועה קירל באירוויזיון";
|
|
56
52
|
|
|
57
53
|
expect(renderedText).toEqual(desiredText);
|
|
58
54
|
});
|
|
59
55
|
|
|
60
56
|
it("Hebrew text contains not first english word", () => {
|
|
61
|
-
const renderedText = getRenderedText(
|
|
57
|
+
const renderedText = getRenderedText(
|
|
58
|
+
textWithNotFirstEnglishWord,
|
|
59
|
+
storeConfig
|
|
60
|
+
);
|
|
61
|
+
|
|
62
62
|
expect(renderedText).toEqual(textWithNotFirstEnglishWord);
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it("Hebrew text doesn't contain english word", () => {
|
|
66
|
-
const renderedText = getRenderedText(textWithoutEnglishWord,
|
|
66
|
+
const renderedText = getRenderedText(textWithoutEnglishWord, storeConfig);
|
|
67
67
|
expect(renderedText).toEqual(textWithoutEnglishWord);
|
|
68
68
|
});
|
|
69
69
|
});
|
|
@@ -77,16 +77,16 @@ describe("LTR app: English text", () => {
|
|
|
77
77
|
|
|
78
78
|
const englishText = "Test sentence";
|
|
79
79
|
|
|
80
|
-
const
|
|
80
|
+
const storeConfig = {
|
|
81
81
|
remoteConfigurations: { localizations: { en: {} } },
|
|
82
82
|
appData: {
|
|
83
83
|
languageCode: "en",
|
|
84
84
|
countryCode: "US",
|
|
85
85
|
},
|
|
86
|
-
}
|
|
86
|
+
};
|
|
87
87
|
|
|
88
88
|
it("English text", () => {
|
|
89
|
-
const renderedText = getRenderedText(englishText,
|
|
89
|
+
const renderedText = getRenderedText(englishText, storeConfig);
|
|
90
90
|
expect(renderedText).toEqual(englishText);
|
|
91
91
|
});
|
|
92
92
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import
|
|
3
|
+
import { render } from "@testing-library/react-native";
|
|
4
4
|
|
|
5
5
|
import { CollapsibleTextContainer } from "../CollapsibleTextContainer";
|
|
6
6
|
|
|
7
7
|
describe("CollapsibleTextContainer", () => {
|
|
8
8
|
it("render container+children when label is presented", () => {
|
|
9
|
-
const
|
|
9
|
+
const { toJSON } = render(
|
|
10
10
|
<CollapsibleTextContainer
|
|
11
11
|
backgroundColor="#000000"
|
|
12
12
|
label={"label"}
|
|
@@ -16,36 +16,36 @@ describe("CollapsibleTextContainer", () => {
|
|
|
16
16
|
</CollapsibleTextContainer>
|
|
17
17
|
);
|
|
18
18
|
|
|
19
|
-
const result =
|
|
19
|
+
const result = toJSON();
|
|
20
20
|
|
|
21
21
|
expect(result).not.toBeNull();
|
|
22
|
-
expect(
|
|
22
|
+
expect(toJSON()).toMatchSnapshot();
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("render nothing when label is empty", () => {
|
|
26
|
-
const
|
|
26
|
+
const { toJSON } = render(
|
|
27
27
|
<CollapsibleTextContainer backgroundColor="#000000" label={""} style={{}}>
|
|
28
28
|
<View />
|
|
29
29
|
</CollapsibleTextContainer>
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
const result =
|
|
32
|
+
const result = toJSON();
|
|
33
33
|
expect(result).toBeNull();
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
it("render nothing when label is not passed", () => {
|
|
37
|
-
const
|
|
37
|
+
const { toJSON } = render(
|
|
38
38
|
<CollapsibleTextContainer backgroundColor="#000000" label={""} style={{}}>
|
|
39
39
|
<View />
|
|
40
40
|
</CollapsibleTextContainer>
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
-
const result =
|
|
43
|
+
const result = toJSON();
|
|
44
44
|
expect(result).toBeNull();
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
it("render nothing when label is undefined", () => {
|
|
48
|
-
const
|
|
48
|
+
const { toJSON } = render(
|
|
49
49
|
<CollapsibleTextContainer
|
|
50
50
|
backgroundColor="#000000"
|
|
51
51
|
label={undefined}
|
|
@@ -55,7 +55,7 @@ describe("CollapsibleTextContainer", () => {
|
|
|
55
55
|
</CollapsibleTextContainer>
|
|
56
56
|
);
|
|
57
57
|
|
|
58
|
-
const result =
|
|
58
|
+
const result = toJSON();
|
|
59
59
|
expect(result).toBeNull();
|
|
60
60
|
});
|
|
61
61
|
});
|
|
@@ -73,7 +73,6 @@ export function elementMapper(
|
|
|
73
73
|
: {};
|
|
74
74
|
|
|
75
75
|
const componentProps = {
|
|
76
|
-
key,
|
|
77
76
|
style,
|
|
78
77
|
skipButtons: otherProps?.skipButtons,
|
|
79
78
|
emitAsyncElementRegistrate: otherProps?.emitAsyncElementRegistrate,
|
|
@@ -91,7 +90,7 @@ export function elementMapper(
|
|
|
91
90
|
const fn = mapElementWithKey(elementMapper(components, otherProps));
|
|
92
91
|
|
|
93
92
|
return (
|
|
94
|
-
<Component {...componentProps}>
|
|
93
|
+
<Component key={key} {...componentProps}>
|
|
95
94
|
{focusableTypes.has(type) && elements.length > 0
|
|
96
95
|
? elements.map(fn)
|
|
97
96
|
: null}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Text, Animated } from "react-native";
|
|
3
|
+
import { render } from "@testing-library/react-native";
|
|
3
4
|
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
NotificationView,
|
|
7
|
+
onlinePhrase,
|
|
8
|
+
offlinePhrase,
|
|
9
|
+
} from "../NotificationView";
|
|
7
10
|
|
|
8
11
|
jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
|
|
9
12
|
usePickFromState: () => ({
|
|
@@ -32,39 +35,31 @@ jest.mock("react-native-safe-area-context", () => ({
|
|
|
32
35
|
|
|
33
36
|
const dismiss = jest.fn();
|
|
34
37
|
|
|
35
|
-
const {
|
|
36
|
-
NotificationView,
|
|
37
|
-
onlinePhrase,
|
|
38
|
-
offlinePhrase,
|
|
39
|
-
} = require("../NotificationView");
|
|
40
|
-
|
|
41
38
|
describe("NotificationView", () => {
|
|
42
39
|
it("Show online message when Online", () => {
|
|
43
|
-
const component =
|
|
44
|
-
<NotificationView online dismiss={dismiss} />
|
|
45
|
-
);
|
|
40
|
+
const component = render(<NotificationView online dismiss={dismiss} />);
|
|
46
41
|
|
|
47
|
-
expect(component.
|
|
42
|
+
expect(component.UNSAFE_getByType(Text).props.children).toBe(onlinePhrase);
|
|
48
43
|
});
|
|
49
44
|
|
|
50
45
|
it("Show offline message when Online", () => {
|
|
51
|
-
const component =
|
|
46
|
+
const component = render(
|
|
52
47
|
<NotificationView online={false} dismiss={dismiss} />
|
|
53
48
|
);
|
|
54
49
|
|
|
55
|
-
expect(component.
|
|
50
|
+
expect(component.UNSAFE_getByType(Text).props.children).toBe(offlinePhrase);
|
|
56
51
|
});
|
|
57
52
|
|
|
58
53
|
it("When hidden is false to true notification is visible", () => {
|
|
59
|
-
const component =
|
|
54
|
+
const component = render(
|
|
60
55
|
<NotificationView online={false} hidden={false} dismiss={dismiss} />
|
|
61
56
|
);
|
|
62
57
|
|
|
63
|
-
component.
|
|
58
|
+
component.rerender(
|
|
64
59
|
<NotificationView online={false} hidden={true} dismiss={dismiss} />
|
|
65
60
|
);
|
|
66
61
|
|
|
67
|
-
const animatedView = component.
|
|
62
|
+
const animatedView = component.UNSAFE_getByType(Animated.View);
|
|
68
63
|
const animatedViewStyles = animatedView.props.style;
|
|
69
64
|
|
|
70
65
|
expect(animatedViewStyles.opacity).toBe(1);
|
|
@@ -21,6 +21,15 @@ exports[`OfflineHandler renders 1`] = `
|
|
|
21
21
|
}
|
|
22
22
|
>
|
|
23
23
|
<View
|
|
24
|
+
accessibilityState={
|
|
25
|
+
{
|
|
26
|
+
"busy": undefined,
|
|
27
|
+
"checked": undefined,
|
|
28
|
+
"disabled": undefined,
|
|
29
|
+
"expanded": undefined,
|
|
30
|
+
"selected": undefined,
|
|
31
|
+
}
|
|
32
|
+
}
|
|
24
33
|
accessible={true}
|
|
25
34
|
collapsable={false}
|
|
26
35
|
focusable={true}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
import renderer, { act } from "react-test-renderer";
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
4
3
|
|
|
5
4
|
jest.useFakeTimers({ legacyFakeTimers: true });
|
|
6
5
|
|
|
@@ -19,29 +18,27 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/utils", () => {
|
|
|
19
18
|
};
|
|
20
19
|
});
|
|
21
20
|
|
|
22
|
-
jest.mock(
|
|
23
|
-
"@applicaster/zapp-react-native-redux/hooks
|
|
24
|
-
() => ({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}),
|
|
39
|
-
},
|
|
21
|
+
jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
|
|
22
|
+
...jest.requireActual("@applicaster/zapp-react-native-redux/hooks"),
|
|
23
|
+
usePickFromState: () => ({
|
|
24
|
+
plugins: [
|
|
25
|
+
{
|
|
26
|
+
name: "offline experience",
|
|
27
|
+
identifier: "offline-experience",
|
|
28
|
+
type: "general",
|
|
29
|
+
module: {
|
|
30
|
+
useOfflineExperienceConfiguration: () => ({
|
|
31
|
+
configurationFields: {},
|
|
32
|
+
localizations: {
|
|
33
|
+
offline_toast_message: "No internet connection",
|
|
34
|
+
online_toast_message: "You are back online",
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
40
37
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})
|
|
44
|
-
);
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
}),
|
|
41
|
+
}));
|
|
45
42
|
|
|
46
43
|
jest.mock("react-native-safe-area-context", () => ({
|
|
47
44
|
useSafeAreaInsets: () => ({ top: 44 }),
|
|
@@ -51,24 +48,18 @@ describe("OfflineHandler", () => {
|
|
|
51
48
|
const { OfflineHandler, NotificationView } = require("../");
|
|
52
49
|
|
|
53
50
|
it("renders", () => {
|
|
54
|
-
const
|
|
55
|
-
expect(
|
|
51
|
+
const { toJSON } = render(<OfflineHandler />);
|
|
52
|
+
expect(toJSON()).toMatchSnapshot();
|
|
56
53
|
});
|
|
57
54
|
|
|
58
55
|
it("renders Notification mode if component was rendered while online", () => {
|
|
59
56
|
mockConnectionStatus = true;
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
act(() => {
|
|
64
|
-
instance = renderer.create(<OfflineHandler />);
|
|
65
|
-
});
|
|
58
|
+
const { rerender, UNSAFE_getByType } = render(<OfflineHandler />);
|
|
66
59
|
|
|
67
|
-
|
|
68
|
-
instance.update(<OfflineHandler />);
|
|
69
|
-
});
|
|
60
|
+
rerender(<OfflineHandler />);
|
|
70
61
|
|
|
71
|
-
const notificationsView =
|
|
62
|
+
const notificationsView = UNSAFE_getByType(NotificationView);
|
|
72
63
|
expect(notificationsView).toBeDefined();
|
|
73
64
|
});
|
|
74
65
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useEffect, useReducer } from "react";
|
|
3
|
-
|
|
4
|
-
import { TVMenuControl, View, ViewStyle } from "react-native";
|
|
3
|
+
import { View, ViewStyle } from "react-native";
|
|
5
4
|
import * as R from "ramda";
|
|
6
5
|
import uuid from "uuid/v4";
|
|
7
6
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
|
|
@@ -62,6 +61,11 @@ import {
|
|
|
62
61
|
useModalAnimationContext,
|
|
63
62
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
64
63
|
|
|
64
|
+
import {
|
|
65
|
+
PlayerNativeCommandTypes,
|
|
66
|
+
PlayerNativeSendCommand,
|
|
67
|
+
} from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerNativeCommand";
|
|
68
|
+
|
|
65
69
|
type Props = {
|
|
66
70
|
Player: React.ComponentType<any>;
|
|
67
71
|
PlayerLoadingView?: React.ComponentType<any>; // 👀 we are not receiving this prop
|
|
@@ -259,9 +263,15 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
259
263
|
return;
|
|
260
264
|
}
|
|
261
265
|
|
|
266
|
+
// send command to clear and stop player
|
|
267
|
+
PlayerNativeSendCommand(
|
|
268
|
+
PlayerNativeCommandTypes.clearPlayerData,
|
|
269
|
+
state.playerId
|
|
270
|
+
);
|
|
271
|
+
|
|
262
272
|
showNavBar(true);
|
|
263
273
|
navigator.goBack();
|
|
264
|
-
}, [isModal, navigator.goBack, showNavBar]);
|
|
274
|
+
}, [isModal, navigator.goBack, state.playerId, showNavBar]);
|
|
265
275
|
|
|
266
276
|
const playEntry = (entry) => navigator.replaceTop(entry, { mode });
|
|
267
277
|
|
|
@@ -389,13 +399,17 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
389
399
|
}
|
|
390
400
|
};
|
|
391
401
|
|
|
392
|
-
const playerRemoteHandler = (
|
|
393
|
-
|
|
402
|
+
const playerRemoteHandler = React.useCallback(
|
|
403
|
+
(isLanguageOverlayVisible = false) =>
|
|
404
|
+
(event) => {
|
|
405
|
+
const { eventType } = event;
|
|
394
406
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
407
|
+
if (!isLanguageOverlayVisible && eventType === "menu") {
|
|
408
|
+
close();
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
[close]
|
|
412
|
+
);
|
|
399
413
|
|
|
400
414
|
// Effects
|
|
401
415
|
useEffect(() => {
|
|
@@ -508,16 +522,6 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
508
522
|
}
|
|
509
523
|
}, [isAudioContent]);
|
|
510
524
|
|
|
511
|
-
// Needs to handle back button on Apple TV
|
|
512
|
-
// https://github.com/facebook/react-native/issues/18930
|
|
513
|
-
useEffect(() => {
|
|
514
|
-
TVMenuControl?.enableTVMenuKey();
|
|
515
|
-
|
|
516
|
-
return () => {
|
|
517
|
-
TVMenuControl?.disableTVMenuKey();
|
|
518
|
-
};
|
|
519
|
-
}, []);
|
|
520
|
-
|
|
521
525
|
useEffect(() => {
|
|
522
526
|
playerEvent("source_changed", { item });
|
|
523
527
|
|
|
@@ -633,9 +637,9 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
633
637
|
<PlayerContainerContext.Consumer>
|
|
634
638
|
{(context) => (
|
|
635
639
|
<TVEventHandlerComponent
|
|
636
|
-
tvEventHandler={(
|
|
637
|
-
|
|
638
|
-
}
|
|
640
|
+
tvEventHandler={playerRemoteHandler(
|
|
641
|
+
context.isLanguageOverlayVisible
|
|
642
|
+
)}
|
|
639
643
|
>
|
|
640
644
|
<FocusableGroup
|
|
641
645
|
id={FocusableGroupMainContainerId}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
1
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
|
|
2
2
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
3
3
|
import { styleKeys } from "@applicaster/zapp-react-native-utils/styleKeysUtils";
|
|
4
4
|
import { transformColorCode as fixColorHexCode } from "@applicaster/zapp-react-native-utils/transform";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
|
|
3
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
3
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
|
|
4
4
|
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
5
5
|
|
|
6
6
|
import { PlayerContainer as PlayerContainerComponent } from "./PlayerContainer";
|