@applicaster/zapp-react-native-ui-components 15.0.0-rc.11 → 15.0.0-rc.110
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 +69 -26
- package/Components/BaseFocusable/index.ios.ts +12 -2
- package/Components/Cell/Cell.tsx +14 -3
- package/Components/Cell/CellWithFocusable.tsx +9 -0
- package/Components/Cell/FocusableWrapper.tsx +47 -0
- package/Components/Cell/TvOSCellComponent.tsx +106 -19
- package/Components/Focusable/Focusable.tsx +4 -2
- package/Components/Focusable/FocusableTvOS.tsx +18 -1
- package/Components/Focusable/__tests__/__snapshots__/FocusableTvOS.test.tsx.snap +1 -0
- package/Components/FocusableGroup/FocusableTvOS.tsx +32 -1
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +1 -1
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +22 -6
- package/Components/HandlePlayable/HandlePlayable.tsx +33 -94
- package/Components/HandlePlayable/const.ts +3 -0
- package/Components/HandlePlayable/utils.ts +105 -0
- package/Components/Layout/TV/LayoutBackground.tsx +5 -2
- package/Components/Layout/TV/ScreenContainer.tsx +2 -6
- package/Components/Layout/TV/index.tsx +3 -4
- package/Components/Layout/TV/index.web.tsx +3 -4
- package/Components/LinkHandler/LinkHandler.tsx +2 -2
- package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +16 -1
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +30 -2
- package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +11 -3
- package/Components/MasterCell/DefaultComponents/Image/Image.web.tsx +9 -1
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +15 -14
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +10 -6
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +40 -39
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +95 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +86 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/index.test.ts +141 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/hooks/__tests__/useGetImageDimensions.test.ts +7 -6
- package/Components/MasterCell/DefaultComponents/SecondaryImage/index.ts +1 -1
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +8 -8
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -2
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/getPluginIdentifier.test.ts +233 -11
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/index.ts +19 -15
- package/Components/MasterCell/hoc/__tests__/withAsyncRender.test.tsx +219 -0
- package/Components/MasterCell/hoc/withAsyncRender.tsx +9 -7
- package/Components/MasterCell/index.tsx +2 -0
- package/Components/MasterCell/utils/__tests__/resolveColor.test.js +82 -3
- package/Components/MasterCell/utils/index.ts +61 -31
- package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +102 -87
- package/Components/MeasurmentsPortal/__tests__/MeasurementsPortal.test.tsx +355 -0
- package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +17 -9
- package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +16 -8
- package/Components/OfflineHandler/NotificationView/NotificationView.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +17 -18
- package/Components/OfflineHandler/NotificationView/utils.ts +34 -0
- package/Components/OfflineHandler/__tests__/index.test.tsx +27 -18
- package/Components/PlayerContainer/PlayerContainer.tsx +43 -55
- package/Components/PlayerImageBackground/index.tsx +3 -22
- package/Components/River/ComponentsMap/ComponentsMap.tsx +16 -0
- package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +1 -1
- package/Components/River/TV/River.tsx +31 -14
- package/Components/River/TV/index.tsx +8 -4
- package/Components/River/TV/utils/__tests__/toStringOrEmpty.test.ts +30 -0
- package/Components/River/TV/utils/index.ts +4 -0
- package/Components/River/TV/withFocusableGroupForContent.tsx +71 -0
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
- package/Components/River/__tests__/componentsMap.test.js +38 -0
- package/Components/Screen/TV/index.web.tsx +4 -2
- package/Components/Screen/__tests__/Screen.test.tsx +66 -42
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +68 -44
- package/Components/Screen/hooks.ts +75 -6
- package/Components/Screen/index.tsx +9 -4
- package/Components/Screen/navigationHandler.ts +49 -24
- package/Components/Screen/orientationHandler.ts +10 -13
- package/Components/ScreenResolver/index.tsx +26 -16
- package/Components/ScreenRevealManager/ScreenRevealManager.ts +40 -8
- package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +86 -69
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +44 -26
- package/Components/Tabs/TV/Tabs.tsx +20 -3
- package/Components/Tabs/TabContent.tsx +7 -4
- package/Components/Transitioner/Scene.tsx +10 -3
- package/Components/Transitioner/index.js +3 -3
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +118 -171
- package/Components/VideoModal/ModalAnimation/index.ts +2 -13
- package/Components/VideoModal/ModalAnimation/utils.ts +1 -327
- package/Components/VideoModal/PlayerWrapper.tsx +14 -88
- package/Components/VideoModal/VideoModal.tsx +1 -5
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -0
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +15 -7
- package/Components/VideoModal/hooks/useModalSize.ts +10 -5
- package/Components/VideoModal/playerWrapperStyle.ts +70 -0
- package/Components/VideoModal/playerWrapperUtils.ts +91 -0
- package/Components/VideoModal/utils.ts +19 -9
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +0 -2
- package/Components/Viewport/ViewportAware/index.tsx +16 -7
- package/Components/Viewport/ViewportEvents/__tests__/viewportEvents.test.js +1 -1
- package/Contexts/ScreenContext/index.tsx +54 -19
- package/Contexts/ScreenTrackedViewPositionsContext/__tests__/index.test.tsx +1 -1
- package/Contexts/ZappHookModalContext/index.tsx +37 -61
- package/Contexts/ZappPipesContext/ZappPipesContextFactory.tsx +18 -7
- package/Contexts/index.ts +0 -2
- package/Decorators/Analytics/index.tsx +6 -5
- package/Decorators/ConfigurationWrapper/__tests__/__snapshots__/withConfigurationProvider.test.tsx.snap +1 -0
- package/Decorators/ConfigurationWrapper/const.ts +1 -0
- package/Decorators/ZappPipesDataConnector/ResolverSelector.tsx +25 -7
- package/Decorators/ZappPipesDataConnector/__tests__/ResolverSelector.test.tsx +212 -5
- package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +39 -21
- package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +1 -1
- package/Decorators/ZappPipesDataConnector/index.tsx +2 -2
- package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +1 -1
- package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +18 -7
- package/Helpers/DataSourceHelper/__tests__/itemLimitForData.test.ts +80 -0
- package/Helpers/DataSourceHelper/index.ts +19 -0
- package/events/index.ts +3 -0
- package/events/scrollEndReached.ts +15 -0
- package/index.d.ts +7 -0
- package/package.json +6 -5
- package/Components/River/TV/withTVEventHandler.tsx +0 -27
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +0 -60
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +0 -417
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.web.tsx +0 -294
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +0 -176
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.web.tsx +0 -93
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +0 -500
- package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +0 -108
- package/Helpers/DataSourceHelper/index.js +0 -19
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { all, equals,
|
|
1
|
+
import { all, equals, isEmpty, path, pluck, prop, values } from "ramda";
|
|
2
2
|
|
|
3
3
|
import { useEffect, useMemo } from "react";
|
|
4
4
|
|
|
@@ -9,10 +9,9 @@ import {
|
|
|
9
9
|
import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
10
10
|
import { Categories } from "./logger";
|
|
11
11
|
import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
12
|
-
import {
|
|
12
|
+
import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
|
-
ZappPipesEntryContext,
|
|
16
15
|
ZappPipesScreenContext,
|
|
17
16
|
ZappPipesSearchContext,
|
|
18
17
|
} from "@applicaster/zapp-react-native-ui-components/Contexts";
|
|
@@ -24,6 +23,7 @@ import {
|
|
|
24
23
|
|
|
25
24
|
import { produce } from "immer";
|
|
26
25
|
import { useLoadPipesDataDispatch } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
26
|
+
|
|
27
27
|
// types reference
|
|
28
28
|
|
|
29
29
|
declare interface CurationEntry {
|
|
@@ -35,6 +35,8 @@ type Feeds = Record<string, ZappPipesData>;
|
|
|
35
35
|
|
|
36
36
|
type LayoutPresets = PresetsMapping["presets_mappings"];
|
|
37
37
|
|
|
38
|
+
const TABS_SCREEN_TYPE = "tabs_screen";
|
|
39
|
+
const QB_TABS_SCREEN_TYPE = "quick-brick-tabs";
|
|
38
40
|
const SMART_COMPONENT_TYPE = "quick-brick-smart-component";
|
|
39
41
|
const SOURCE_PATH = ["data", "source"];
|
|
40
42
|
const MAPPING_PATH = ["data", "mapping"];
|
|
@@ -53,7 +55,10 @@ export const getTransformedPreset = (
|
|
|
53
55
|
const presetComponent = layoutPresets?.[preset?.preset_name];
|
|
54
56
|
|
|
55
57
|
if (!presetComponent) {
|
|
56
|
-
logger.log_error(
|
|
58
|
+
logger.log_error(
|
|
59
|
+
`Preset "${preset?.preset_name}" missing or wrong data format`,
|
|
60
|
+
{ entry: preset }
|
|
61
|
+
);
|
|
57
62
|
|
|
58
63
|
return;
|
|
59
64
|
}
|
|
@@ -130,11 +135,22 @@ export const useCurationAPI = (
|
|
|
130
135
|
[components]
|
|
131
136
|
);
|
|
132
137
|
|
|
133
|
-
const { pathname } = useRoute();
|
|
134
|
-
const [entryContext] = ZappPipesEntryContext.useZappPipesContext(pathname);
|
|
135
138
|
const [searchContext] = ZappPipesSearchContext.useZappPipesContext();
|
|
136
139
|
const [screenContext] = ZappPipesScreenContext.useZappPipesContext();
|
|
137
140
|
|
|
141
|
+
const screenContextType = screenContext?.type;
|
|
142
|
+
|
|
143
|
+
const isNestedScreen =
|
|
144
|
+
screenContextType === TABS_SCREEN_TYPE ||
|
|
145
|
+
screenContextType === QB_TABS_SCREEN_TYPE;
|
|
146
|
+
|
|
147
|
+
const screenContextData = useScreenContext();
|
|
148
|
+
|
|
149
|
+
const entryContext = ((isNestedScreen && screenContextData?.nested?.entry
|
|
150
|
+
? screenContextData?.nested?.entry
|
|
151
|
+
: (screenContextData?.entry?.payload ?? screenContextData?.entry)) ||
|
|
152
|
+
{}) as ZappEntry;
|
|
153
|
+
|
|
138
154
|
const urlsMap = useMemo<{ [key: string]: string }>(() => {
|
|
139
155
|
const map = {};
|
|
140
156
|
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import * as R from "ramda";
|
|
3
2
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
useAppData,
|
|
4
|
+
useContentTypes,
|
|
5
|
+
usePlugins,
|
|
6
|
+
} from "@applicaster/zapp-react-native-redux/hooks";
|
|
8
7
|
import {
|
|
9
|
-
useDimensions,
|
|
10
|
-
useIsTablet as isTablet,
|
|
11
8
|
useNavigation,
|
|
9
|
+
useRivers,
|
|
12
10
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
13
11
|
|
|
14
12
|
import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
|
|
15
13
|
import { PlayerContainer } from "../PlayerContainer";
|
|
16
14
|
import { useModalSize } from "../VideoModal/hooks";
|
|
17
15
|
import { ViewStyle } from "react-native";
|
|
18
|
-
import {
|
|
16
|
+
import { findCastPlugin, getPlayer } from "./utils";
|
|
17
|
+
import { useWaitForValidOrientation } from "../Screen/hooks";
|
|
19
18
|
|
|
20
19
|
type Props = {
|
|
21
20
|
item: ZappEntry;
|
|
@@ -26,87 +25,31 @@ type Props = {
|
|
|
26
25
|
groupId?: string;
|
|
27
26
|
};
|
|
28
27
|
|
|
29
|
-
const YOUTUBE_PLUGIN_ID = "youtube-player-qb";
|
|
30
|
-
const CHROMECAST_PLUGIN_ID = "chromecast_qb";
|
|
31
|
-
|
|
32
|
-
const getPlayerWithModuleProperties = (
|
|
33
|
-
PlayerModule: ZappPlugin
|
|
34
|
-
): [ZappPlugin, PlayerModuleProperties] => {
|
|
35
|
-
const getPlayerModuleProperties = R.ifElse(
|
|
36
|
-
R.is(Object) && R.has("Component"),
|
|
37
|
-
R.omit(["Component"]),
|
|
38
|
-
() => ({})
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
return [
|
|
42
|
-
PlayerModule?.Component || PlayerModule,
|
|
43
|
-
getPlayerModuleProperties(PlayerModule),
|
|
44
|
-
];
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const getPlayer = (
|
|
48
|
-
item: ZappEntry,
|
|
49
|
-
state
|
|
50
|
-
): [ZappPlugin, PlayerModuleProperties] => {
|
|
51
|
-
const {
|
|
52
|
-
plugins,
|
|
53
|
-
contentTypes,
|
|
54
|
-
rivers,
|
|
55
|
-
appData: { layoutVersion },
|
|
56
|
-
} = state;
|
|
57
|
-
|
|
58
|
-
let PlayerModule;
|
|
59
|
-
|
|
60
|
-
if (layoutVersion === "v2") {
|
|
61
|
-
const { screen_id } = contentTypes?.[item?.type?.value] || {};
|
|
62
|
-
const { type } = rivers?.[screen_id] || {};
|
|
63
|
-
|
|
64
|
-
if (type) {
|
|
65
|
-
PlayerModule = findPluginByIdentifier(type, plugins)?.module;
|
|
66
|
-
|
|
67
|
-
return getPlayerWithModuleProperties(PlayerModule);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (item?.content?.type === "youtube-id") {
|
|
72
|
-
PlayerModule = findPluginByIdentifier(YOUTUBE_PLUGIN_ID, plugins)?.module;
|
|
73
|
-
|
|
74
|
-
return getPlayerWithModuleProperties(PlayerModule);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
PlayerModule = findPluginByType(
|
|
78
|
-
"playable",
|
|
79
|
-
plugins.filter(({ identifier }) => identifier !== YOUTUBE_PLUGIN_ID)
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
return getPlayerWithModuleProperties(PlayerModule);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
28
|
type PlayableComponent = {
|
|
86
29
|
Component: React.ComponentType<any>;
|
|
87
30
|
};
|
|
88
31
|
|
|
89
|
-
const dimensionsContext: "window" | "screen" = platformSelect({
|
|
90
|
-
android_tv: "window",
|
|
91
|
-
amazon: "window",
|
|
92
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
93
|
-
default: isTablet() ? "window" : "screen", // on tablet, window represents correct values, on phone it's not as the screen could be rotated
|
|
94
|
-
});
|
|
95
|
-
|
|
96
32
|
export function HandlePlayable({
|
|
97
33
|
item,
|
|
98
34
|
isModal,
|
|
99
35
|
mode,
|
|
100
36
|
groupId,
|
|
101
37
|
}: Props): React.ReactElement | null {
|
|
102
|
-
const
|
|
38
|
+
const plugins = usePlugins();
|
|
39
|
+
const contentTypes = useContentTypes();
|
|
40
|
+
const rivers = useRivers();
|
|
41
|
+
const appData = useAppData();
|
|
103
42
|
|
|
104
43
|
const { closeVideoModal } = useNavigation();
|
|
105
44
|
|
|
106
|
-
const [Player, playerModuleProperties] = getPlayer(item,
|
|
45
|
+
const [Player, playerModuleProperties] = getPlayer(item, {
|
|
46
|
+
plugins,
|
|
47
|
+
contentTypes,
|
|
48
|
+
rivers,
|
|
49
|
+
appData,
|
|
50
|
+
});
|
|
107
51
|
|
|
108
|
-
const { module: CastPlugin } =
|
|
109
|
-
findPluginByIdentifier(CHROMECAST_PLUGIN_ID, state.plugins, true) || {};
|
|
52
|
+
const { module: CastPlugin } = findCastPlugin(plugins);
|
|
110
53
|
|
|
111
54
|
const [playable, setPlayable] =
|
|
112
55
|
React.useState<Nullable<PlayableComponent>>(null);
|
|
@@ -145,27 +88,23 @@ export function HandlePlayable({
|
|
|
145
88
|
});
|
|
146
89
|
}, [casting]);
|
|
147
90
|
|
|
148
|
-
const { width: screenWidth, height: screenHeight } =
|
|
149
|
-
useDimensions(dimensionsContext);
|
|
150
|
-
|
|
151
91
|
const modalSize = useModalSize();
|
|
152
92
|
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
);
|
|
93
|
+
const isOrientationReady = useWaitForValidOrientation();
|
|
94
|
+
|
|
95
|
+
const style = React.useMemo(() => {
|
|
96
|
+
const isFullScreenReady =
|
|
97
|
+
mode === "PIP" || (mode === "FULLSCREEN" && isOrientationReady);
|
|
98
|
+
|
|
99
|
+
const getDimensionValue = (value: string | number) => {
|
|
100
|
+
return isModal ? value : isFullScreenReady ? "100%" : 0; // do not show player, until full screen mode is ready
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
width: getDimensionValue(modalSize.width),
|
|
105
|
+
height: getDimensionValue(modalSize.height),
|
|
106
|
+
} as ViewStyle;
|
|
107
|
+
}, [modalSize, isModal, mode, isOrientationReady]);
|
|
169
108
|
|
|
170
109
|
const Component = playable?.Component;
|
|
171
110
|
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {
|
|
2
|
+
findPluginByIdentifier,
|
|
3
|
+
findPluginByType,
|
|
4
|
+
} from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
5
|
+
|
|
6
|
+
import { CHROMECAST_PLUGIN_ID, YOUTUBE_PLUGIN_ID } from "./const";
|
|
7
|
+
import { omit } from "@applicaster/zapp-react-native-utils/utils";
|
|
8
|
+
import { getXray } from "@applicaster/zapp-react-native-utils/logger";
|
|
9
|
+
|
|
10
|
+
const { Logger } = getXray();
|
|
11
|
+
|
|
12
|
+
const logger = new Logger(
|
|
13
|
+
"QuickBrick",
|
|
14
|
+
"packages/zapp-react-native-ui-components/Components/HandlePlayable"
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const getPlayerModuleProperties = (PlayerModule: ZappPlugin) => {
|
|
18
|
+
if (PlayerModule?.Component && typeof PlayerModule.Component === "object") {
|
|
19
|
+
return omit(["Component"], PlayerModule);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return {};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const getPlayerWithModuleProperties = (
|
|
26
|
+
PlayerModule: ZappPlugin
|
|
27
|
+
): [ZappPlugin, PlayerModuleProperties] => {
|
|
28
|
+
return [
|
|
29
|
+
PlayerModule?.Component || PlayerModule,
|
|
30
|
+
getPlayerModuleProperties(PlayerModule),
|
|
31
|
+
];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const findCastPlugin = (plugins: ZappPlugin[]) =>
|
|
35
|
+
findPluginByIdentifier(CHROMECAST_PLUGIN_ID, plugins, true) || {};
|
|
36
|
+
|
|
37
|
+
export const findYoutubePlugin = (plugins: ZappPlugin[]) =>
|
|
38
|
+
findPluginByIdentifier(YOUTUBE_PLUGIN_ID, plugins, true) || {};
|
|
39
|
+
|
|
40
|
+
export const getPlayer = (
|
|
41
|
+
item: ZappEntry,
|
|
42
|
+
{
|
|
43
|
+
plugins,
|
|
44
|
+
contentTypes,
|
|
45
|
+
rivers,
|
|
46
|
+
appData: { layoutVersion },
|
|
47
|
+
}: {
|
|
48
|
+
plugins: ZappPlugin[];
|
|
49
|
+
contentTypes: Record<string, any>;
|
|
50
|
+
rivers: Record<string, any>;
|
|
51
|
+
appData: { layoutVersion: string };
|
|
52
|
+
}
|
|
53
|
+
): [ZappPlugin, PlayerModuleProperties] => {
|
|
54
|
+
let PlayerModule;
|
|
55
|
+
|
|
56
|
+
if (layoutVersion === "v2") {
|
|
57
|
+
const screen_id = contentTypes?.[item?.type?.value]?.screen_id;
|
|
58
|
+
const type = rivers?.[screen_id]?.type;
|
|
59
|
+
|
|
60
|
+
if (type) {
|
|
61
|
+
PlayerModule = findPluginByIdentifier(type, plugins)?.module;
|
|
62
|
+
|
|
63
|
+
if (!PlayerModule) {
|
|
64
|
+
logger.error({
|
|
65
|
+
message:
|
|
66
|
+
"PlayerModule is undefined – type mapping may be wrong or type not set for player",
|
|
67
|
+
data: {
|
|
68
|
+
type,
|
|
69
|
+
screen_id,
|
|
70
|
+
item_type_value: item?.type?.value,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return [null, {}];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return getPlayerWithModuleProperties(PlayerModule);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// TODO: Probably should be removed, Youtube plugin is deprecated
|
|
82
|
+
if (item?.content?.type === "youtube-id") {
|
|
83
|
+
PlayerModule = findYoutubePlugin(plugins)?.module;
|
|
84
|
+
|
|
85
|
+
return getPlayerWithModuleProperties(PlayerModule);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
PlayerModule = findPluginByType(
|
|
89
|
+
"playable",
|
|
90
|
+
(plugins as any[]).filter(
|
|
91
|
+
({ identifier }: { identifier: string }) =>
|
|
92
|
+
identifier !== YOUTUBE_PLUGIN_ID
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
if (!PlayerModule) {
|
|
97
|
+
logger.error({
|
|
98
|
+
message: "PlayerModule is undefined – playable plugin not found",
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return [null, {}];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return getPlayerWithModuleProperties(PlayerModule);
|
|
105
|
+
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
3
2
|
import { getBackgroundImageUrl } from "../utils";
|
|
4
3
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
4
|
+
import {
|
|
5
|
+
selectRemoteConfigurations,
|
|
6
|
+
useAppSelector,
|
|
7
|
+
} from "@applicaster/zapp-react-native-redux";
|
|
5
8
|
|
|
6
9
|
export const LayoutBackground = ({
|
|
7
10
|
Background,
|
|
@@ -12,7 +15,7 @@ export const LayoutBackground = ({
|
|
|
12
15
|
}) => {
|
|
13
16
|
const theme = useTheme();
|
|
14
17
|
|
|
15
|
-
const
|
|
18
|
+
const remoteConfigurations = useAppSelector(selectRemoteConfigurations);
|
|
16
19
|
|
|
17
20
|
const backgroundColor = theme.app_background_color;
|
|
18
21
|
const backgroundImageUrl = getBackgroundImageUrl(remoteConfigurations);
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
routeIsPlayerScreen,
|
|
19
19
|
} from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
20
20
|
import { isApplePlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
21
|
-
import {
|
|
21
|
+
import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
|
|
22
22
|
import { NavBarContainer } from "./NavBarContainer";
|
|
23
23
|
|
|
24
24
|
type ComponentsExtraProps = {
|
|
@@ -111,11 +111,7 @@ export const ScreenContainer = React.memo(function ScreenContainer({
|
|
|
111
111
|
const { activeRiver } = navigator;
|
|
112
112
|
const { title, visible } = useNavbarState();
|
|
113
113
|
|
|
114
|
-
const
|
|
115
|
-
"appState",
|
|
116
|
-
"remoteConfigurations",
|
|
117
|
-
"plugins",
|
|
118
|
-
]);
|
|
114
|
+
const plugins = usePlugins();
|
|
119
115
|
|
|
120
116
|
const navigationProps = getNavigationProps({
|
|
121
117
|
navigator,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useAppSelector } from "@applicaster/zapp-react-native-redux/hooks";
|
|
3
3
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
4
4
|
|
|
5
5
|
import { LayoutContainer } from "./LayoutContainer";
|
|
@@ -10,6 +10,7 @@ import { PathnameContext } from "../../../Contexts/PathnameContext";
|
|
|
10
10
|
import { ScreenDataContext } from "../../../Contexts/ScreenDataContext";
|
|
11
11
|
import { ScreenContextProvider } from "../../../Contexts/ScreenContext";
|
|
12
12
|
import { LayoutBackground } from "./LayoutBackground";
|
|
13
|
+
import { selectAppReady } from "@applicaster/zapp-react-native-redux";
|
|
13
14
|
|
|
14
15
|
type Components = {
|
|
15
16
|
NavBar: React.ComponentType<any>;
|
|
@@ -29,9 +30,7 @@ type Props = {
|
|
|
29
30
|
const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
|
|
30
31
|
const navigator = useNavigation();
|
|
31
32
|
|
|
32
|
-
const
|
|
33
|
-
"appState",
|
|
34
|
-
]);
|
|
33
|
+
const appReady = useAppSelector(selectAppReady);
|
|
35
34
|
|
|
36
35
|
if (!appReady) {
|
|
37
36
|
return null;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { pathOr } from "ramda";
|
|
3
2
|
|
|
4
|
-
import {
|
|
3
|
+
import { useAppSelector } from "@applicaster/zapp-react-native-redux/hooks";
|
|
5
4
|
|
|
6
5
|
import { ScreenLayoutContextProvider } from "./ScreenLayoutContextProvider";
|
|
7
6
|
import { StackNavigator } from "../../Navigator";
|
|
8
7
|
import { LayoutBackground } from "./LayoutBackground";
|
|
8
|
+
import { selectAppReady } from "@applicaster/zapp-react-native-redux";
|
|
9
9
|
|
|
10
10
|
type Components = {
|
|
11
11
|
NavBar: React.ComponentType<any>;
|
|
@@ -17,8 +17,7 @@ type Props = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const Layout = ({ Components }: Props) => {
|
|
20
|
-
const
|
|
21
|
-
const appReady = pathOr(false, ["appReady"], appState);
|
|
20
|
+
const appReady = useAppSelector(selectAppReady);
|
|
22
21
|
|
|
23
22
|
if (!appReady) {
|
|
24
23
|
return null;
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
|
|
4
4
|
import { findPluginByIdentifier } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
5
|
-
import {
|
|
5
|
+
import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
|
|
6
6
|
import {
|
|
7
7
|
inflateString,
|
|
8
8
|
objectToReadableString,
|
|
@@ -40,7 +40,7 @@ export async function inflateUrl(url) {
|
|
|
40
40
|
|
|
41
41
|
export function LinkHandler(props: Props) {
|
|
42
42
|
const screenData = props?.screenData;
|
|
43
|
-
const
|
|
43
|
+
const plugins = usePlugins();
|
|
44
44
|
|
|
45
45
|
const ScreenPlugin = findPluginByIdentifier(
|
|
46
46
|
WEBVIEW_SCREEN_IDENTIFIER,
|
package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import {
|
|
2
3
|
BorderContainerView,
|
|
3
4
|
getBorderPadding, // Export for testing (using a double underscore prefix is a common convention)
|
|
4
5
|
} from "../index";
|
|
5
|
-
import * as React from "react";
|
|
6
6
|
import { render } from "@testing-library/react-native";
|
|
7
7
|
import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
8
8
|
import { View } from "react-native";
|
|
@@ -11,6 +11,15 @@ jest.mock("@applicaster/zapp-react-native-utils/numberUtils", () => ({
|
|
|
11
11
|
toNumberWithDefaultZero: jest.fn((value) => Number(value) || 0),
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
|
+
jest.mock(
|
|
15
|
+
"@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks",
|
|
16
|
+
() => ({
|
|
17
|
+
useAccessibilityManager: jest.fn(() => ({
|
|
18
|
+
addHeading: jest.fn(),
|
|
19
|
+
})),
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
|
|
14
23
|
describe("BorderContainerView", () => {
|
|
15
24
|
describe("getBorderPadding", () => {
|
|
16
25
|
it("returns 0 for inside", () => {
|
|
@@ -42,6 +51,8 @@ describe("BorderContainerView", () => {
|
|
|
42
51
|
};
|
|
43
52
|
|
|
44
53
|
const borderPosition = null;
|
|
54
|
+
const mockEntry = { id: "test-entry" } as ZappEntry;
|
|
55
|
+
const mockHasFocusableInside = jest.fn(() => false);
|
|
45
56
|
|
|
46
57
|
const { queryByTestId } = render(
|
|
47
58
|
<BorderContainerView
|
|
@@ -52,6 +63,10 @@ describe("BorderContainerView", () => {
|
|
|
52
63
|
borderPaddingRight={toNumberWithDefaultZero(padding.paddingRight)}
|
|
53
64
|
borderPaddingBottom={toNumberWithDefaultZero(padding.paddingBottom)}
|
|
54
65
|
borderPaddingLeft={toNumberWithDefaultZero(padding.paddingLeft)}
|
|
66
|
+
hasFocusableInside={mockHasFocusableInside}
|
|
67
|
+
entry={mockEntry}
|
|
68
|
+
state="focused"
|
|
69
|
+
hasTextLabels={false}
|
|
55
70
|
>
|
|
56
71
|
<View testID="child" />
|
|
57
72
|
</BorderContainerView>
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as React from "react";
|
|
1
|
+
import React, { useMemo, useContext, useEffect } from "react";
|
|
3
2
|
import { ImageStyle, StyleSheet, View, ViewStyle } from "react-native";
|
|
3
|
+
import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
4
|
+
import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
5
|
+
import { MeasurementPortalContext } from "../../../MeasurmentsPortal/MeasurementsPortal";
|
|
4
6
|
|
|
5
7
|
type BorderPosition = "inside" | "outside" | "center";
|
|
6
8
|
|
|
7
9
|
interface Props {
|
|
10
|
+
hasFocusableInside: (entry: ZappEntry) => boolean;
|
|
11
|
+
entry: ZappEntry;
|
|
12
|
+
state: CellState;
|
|
13
|
+
hasTextLabels: boolean;
|
|
8
14
|
style: ImageStyle | ViewStyle;
|
|
9
15
|
borderPosition: BorderPosition;
|
|
10
16
|
borderPaddingTop: number;
|
|
@@ -118,8 +124,30 @@ export const BorderContainerView = (props: Props) => {
|
|
|
118
124
|
borderPaddingLeft,
|
|
119
125
|
style,
|
|
120
126
|
children,
|
|
127
|
+
hasFocusableInside,
|
|
128
|
+
entry,
|
|
129
|
+
state,
|
|
130
|
+
hasTextLabels,
|
|
121
131
|
} = props;
|
|
122
132
|
|
|
133
|
+
const accessibilityManager = useAccessibilityManager();
|
|
134
|
+
const isMeasurement = useContext(MeasurementPortalContext);
|
|
135
|
+
|
|
136
|
+
const isImageOnlyCell = useMemo(
|
|
137
|
+
() =>
|
|
138
|
+
state === "focused" &&
|
|
139
|
+
!hasTextLabels &&
|
|
140
|
+
!isMeasurement?.measuringInProgress &&
|
|
141
|
+
!hasFocusableInside(entry),
|
|
142
|
+
[entry, hasTextLabels, state, isMeasurement?.measuringInProgress]
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
if (isImageOnlyCell && entry?.title) {
|
|
147
|
+
accessibilityManager.addHeading(String(entry.title));
|
|
148
|
+
}
|
|
149
|
+
}, [isImageOnlyCell, entry?.title]);
|
|
150
|
+
|
|
123
151
|
const padding =
|
|
124
152
|
borderPosition === "outside"
|
|
125
153
|
? {
|
|
@@ -32,6 +32,7 @@ export default function Image({
|
|
|
32
32
|
placeholderImage,
|
|
33
33
|
entry,
|
|
34
34
|
withDimensions,
|
|
35
|
+
source: sourceProp,
|
|
35
36
|
...otherProps
|
|
36
37
|
}: Props) {
|
|
37
38
|
const [showDefault, setShowDefault] = React.useState(false);
|
|
@@ -48,7 +49,10 @@ export default function Image({
|
|
|
48
49
|
entry,
|
|
49
50
|
showDefault,
|
|
50
51
|
placeholderImage: placeholderImage || "",
|
|
51
|
-
otherProps
|
|
52
|
+
otherProps: {
|
|
53
|
+
source: sourceProp,
|
|
54
|
+
state: otherProps.state,
|
|
55
|
+
},
|
|
52
56
|
});
|
|
53
57
|
|
|
54
58
|
const onError = React.useCallback(() => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Image as RnImage, ImageStyle } from "react-native";
|
|
3
|
-
import { equals, omit } from "ramda";
|
|
4
3
|
|
|
5
4
|
import { useImageSource } from "./hooks";
|
|
5
|
+
import { equals } from "@applicaster/zapp-react-native-utils/utils";
|
|
6
6
|
|
|
7
7
|
type Source = {
|
|
8
8
|
uri: string;
|
|
@@ -25,11 +25,19 @@ function Image({
|
|
|
25
25
|
placeholderImage,
|
|
26
26
|
entry,
|
|
27
27
|
withDimensions,
|
|
28
|
+
source: sourceProp,
|
|
28
29
|
...otherProps
|
|
29
30
|
}: Props) {
|
|
30
31
|
const [error, setErrorState] = React.useState(null);
|
|
31
32
|
|
|
32
|
-
const source = useImageSource({
|
|
33
|
+
const source = useImageSource({
|
|
34
|
+
uri,
|
|
35
|
+
entry,
|
|
36
|
+
otherProps: {
|
|
37
|
+
source: sourceProp,
|
|
38
|
+
state: otherProps.state,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
33
41
|
|
|
34
42
|
React.useEffect(() => {
|
|
35
43
|
// reset error state on URI change as the error is referencing previous uri
|
|
@@ -49,7 +57,7 @@ function Image({
|
|
|
49
57
|
onError={React.useCallback(() => setErrorState(true), [])}
|
|
50
58
|
// as we have defaults as "" for placeholder image, we need to pass undefined to source to not throw warnings
|
|
51
59
|
source={_source?.uri ? _source : undefined}
|
|
52
|
-
{...
|
|
60
|
+
{...otherProps}
|
|
53
61
|
/>
|
|
54
62
|
);
|
|
55
63
|
}
|
|
@@ -23,9 +23,17 @@ function Image({
|
|
|
23
23
|
placeholderImage,
|
|
24
24
|
entry,
|
|
25
25
|
withDimensions,
|
|
26
|
+
source: sourceProp,
|
|
26
27
|
...otherProps
|
|
27
28
|
}: Props) {
|
|
28
|
-
const source = useImageSource({
|
|
29
|
+
const source = useImageSource({
|
|
30
|
+
uri,
|
|
31
|
+
entry,
|
|
32
|
+
otherProps: {
|
|
33
|
+
source: sourceProp,
|
|
34
|
+
state: otherProps.state,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
29
37
|
|
|
30
38
|
const updatedSource = source ? withDimensions(source) : { uri: "" };
|
|
31
39
|
|