@applicaster/zapp-react-native-ui-components 14.0.0-alpha.1661204539 → 14.0.0-alpha.1887720441
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 -2
- package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
- package/Components/AudioPlayer/mobile/index.tsx +18 -0
- package/Components/AudioPlayer/tv/Artwork.tsx +41 -0
- package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +7 -7
- package/Components/AudioPlayer/tv/Layout.tsx +168 -0
- package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +9 -2
- package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +17 -10
- package/Components/AudioPlayer/tv/Title.tsx +46 -0
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +4 -4
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +9 -4
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +164 -0
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/channel.test.js.snap +19 -0
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +2 -3
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +2 -3
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +7 -3
- package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +13 -7
- package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +18 -57
- package/Components/AudioPlayer/types.ts +40 -0
- package/Components/Cell/index.js +7 -3
- package/Components/ComponentResolver/index.ts +1 -1
- package/Components/FeedLoader/index.js +1 -1
- package/Components/Focusable/Focusable.tsx +5 -3
- package/Components/Focusable/FocusableTvOS.tsx +3 -3
- package/Components/Focusable/FocusableiOS.tsx +2 -2
- package/Components/Focusable/__tests__/index.android.test.tsx +3 -0
- package/Components/Focusable/index.android.tsx +12 -8
- package/Components/Focusable/index.tsx +1 -1
- package/Components/FocusableList/index.tsx +4 -0
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +0 -2
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +42 -59
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +12 -8
- package/Components/HandlePlayable/HandlePlayable.tsx +25 -9
- package/Components/Layout/TV/LayoutBackground.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/Button.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -27
- package/Components/MasterCell/DefaultComponents/Image/hoc/withDimensions.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +1 -0
- package/Components/MasterCell/elementMapper.tsx +1 -2
- package/Components/MasterCell/index.tsx +1 -1
- package/Components/MasterCell/utils/behaviorProvider.ts +12 -67
- package/Components/MasterCell/utils/index.ts +3 -13
- 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 +20 -22
- package/Components/PlayerContainer/ErrorDisplay/index.ts +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +62 -66
- package/Components/PlayerContainer/ProgramInfo/index.tsx +1 -1
- package/Components/PlayerContainer/index.ts +1 -1
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +1 -6
- package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +379 -0
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +2 -2
- package/Components/River/RefreshControl.tsx +6 -4
- package/Components/River/RiverItem.tsx +8 -8
- package/Components/River/TV/River.tsx +2 -20
- 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 -6
- package/Components/River/index.tsx +1 -1
- package/Components/Screen/__tests__/Screen.test.tsx +23 -12
- 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/TopMarginApplicator/TopMarginApplicator.tsx +16 -15
- 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 +32 -8
- package/Components/VideoModal/PlayerDetails.tsx +24 -2
- package/Components/VideoModal/PlayerWrapper.tsx +26 -142
- package/Components/VideoModal/VideoModal.tsx +3 -17
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -180
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +17 -55
- package/Components/VideoModal/hooks/index.ts +0 -2
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +15 -26
- package/Components/VideoModal/hooks/useModalSize.ts +18 -2
- package/Components/VideoModal/utils.ts +6 -0
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -16
- package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +84 -24
- package/Components/Viewport/VisibilitySensor/VisibilitySensor.tsx +3 -3
- package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/index.ts +3 -3
- package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
- package/Decorators/RiverFeedLoader/index.tsx +2 -8
- package/Decorators/RiverFeedLoader/utils/index.ts +2 -7
- 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 +27 -308
- 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/index.d.ts +0 -1
- package/package.json +5 -10
- package/Components/AudioPlayer/Artwork.tsx +0 -35
- package/Components/AudioPlayer/AudioPlayerLayout.tsx +0 -202
- package/Components/AudioPlayer/Title.tsx +0 -39
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -66
- package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +0 -28
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -26
- package/Components/AudioPlayer/index.ts +0 -1
- package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +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
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/// <reference types="@applicaster/applicaster-types" />
|
|
2
|
+
/// <reference types="@applicaster/zapp-react-native-ui-components" />
|
|
3
|
+
import React, { useEffect, useMemo } from "react";
|
|
4
|
+
import * as R from "ramda";
|
|
5
|
+
import { Platform } from "react-native";
|
|
6
|
+
import Url from "url";
|
|
7
|
+
import { favoritesListener } from "@applicaster/zapp-react-native-bridge/Favorites";
|
|
8
|
+
import {
|
|
9
|
+
getInflatedDataSourceUrl,
|
|
10
|
+
getSearchContext,
|
|
11
|
+
useFeedLoader,
|
|
12
|
+
useFeedRefresh,
|
|
13
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
14
|
+
import { subscribeForUrlContextKeyChanges } from "@applicaster/zapp-pipes-v2-client";
|
|
15
|
+
import { ComponentDataSourceContext, ZappPipesDataProps } from "../types";
|
|
16
|
+
import { isVerticalListOrGrid } from "../utils";
|
|
17
|
+
|
|
18
|
+
const FAVORITES_TYPE = "FAVOURITES";
|
|
19
|
+
|
|
20
|
+
function getDataSourceUrl({
|
|
21
|
+
component,
|
|
22
|
+
feedUrl,
|
|
23
|
+
screenData,
|
|
24
|
+
entryContext,
|
|
25
|
+
searchContext,
|
|
26
|
+
screenContext,
|
|
27
|
+
}): { dataSourceUrl: string | null; type: string | null } {
|
|
28
|
+
if (feedUrl) {
|
|
29
|
+
return { dataSourceUrl: feedUrl, type: null };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (component.data) {
|
|
33
|
+
const {
|
|
34
|
+
data: { source, type, mapping },
|
|
35
|
+
} = component;
|
|
36
|
+
|
|
37
|
+
if (type === FAVORITES_TYPE) {
|
|
38
|
+
return { dataSourceUrl: source || FAVORITES_TYPE, type };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (source) {
|
|
42
|
+
if (type === "APPLICASTER_COLLECTION" && !R.includes("://", source)) {
|
|
43
|
+
return {
|
|
44
|
+
dataSourceUrl: `applicaster://fetchData?type=${type}&collectionId=${source}`,
|
|
45
|
+
type,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (type === "APPLICASTER_CATEGORY" && !R.includes("://", source)) {
|
|
50
|
+
return {
|
|
51
|
+
dataSourceUrl: `applicaster://fetchData?type=${type}&categoryId=${source}&platform=${Platform.OS}`,
|
|
52
|
+
type,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (mapping) {
|
|
57
|
+
const contexts = {
|
|
58
|
+
entry: entryContext,
|
|
59
|
+
screen: screenContext || screenData,
|
|
60
|
+
search: getSearchContext(searchContext, mapping),
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const dataSourceUrl = getInflatedDataSourceUrl({
|
|
64
|
+
source,
|
|
65
|
+
mapping,
|
|
66
|
+
contexts,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (!dataSourceUrl) {
|
|
70
|
+
return { dataSourceUrl: null, type: null };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return { dataSourceUrl, type };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return { dataSourceUrl: source, type };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return { dataSourceUrl: null, type: null };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function getMethodAndParams(component) {
|
|
84
|
+
const method: "get" | "post" = R.pathOr("get", ["data", "method"], component);
|
|
85
|
+
|
|
86
|
+
const bodyParams: Record<string, unknown> = R.pathOr(
|
|
87
|
+
{},
|
|
88
|
+
["data", "bodyParams"],
|
|
89
|
+
component
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
method,
|
|
94
|
+
bodyParams,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function getListenerFromPlugin(
|
|
99
|
+
dataSourceUrl: string,
|
|
100
|
+
plugins: QuickBrickPlugin[]
|
|
101
|
+
): AddDataSourceListener | void {
|
|
102
|
+
const url = Url.parse(dataSourceUrl, false);
|
|
103
|
+
|
|
104
|
+
const addListener = R.compose(
|
|
105
|
+
R.path(["module", "addDataSourceListener"]),
|
|
106
|
+
R.find(R.propEq("identifier", url.host))
|
|
107
|
+
)(plugins);
|
|
108
|
+
|
|
109
|
+
return addListener;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function applyItemLimit(zappPipesData, component) {
|
|
113
|
+
if (!zappPipesData || !zappPipesData.data) {
|
|
114
|
+
return zappPipesData;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const { data } = zappPipesData;
|
|
118
|
+
|
|
119
|
+
const {
|
|
120
|
+
rules: { item_limit },
|
|
121
|
+
} = component;
|
|
122
|
+
|
|
123
|
+
if (item_limit && data.entry && data.entry.length) {
|
|
124
|
+
return {
|
|
125
|
+
...zappPipesData,
|
|
126
|
+
data: {
|
|
127
|
+
...data,
|
|
128
|
+
entry: R.slice(
|
|
129
|
+
0,
|
|
130
|
+
Math.min(Number(item_limit), R.length(data.entry)),
|
|
131
|
+
data.entry
|
|
132
|
+
),
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return zappPipesData;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
type UrlFeedResolverProps = ComponentDataSourceContext & {
|
|
141
|
+
children: (dataProps: ZappPipesDataProps) => React.ReactNode;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export function UrlFeedResolver({
|
|
145
|
+
children,
|
|
146
|
+
component,
|
|
147
|
+
feedUrl,
|
|
148
|
+
isLast,
|
|
149
|
+
entryContext,
|
|
150
|
+
screenContext,
|
|
151
|
+
searchContext,
|
|
152
|
+
screenData,
|
|
153
|
+
plugins,
|
|
154
|
+
}: UrlFeedResolverProps) {
|
|
155
|
+
const { dataSourceUrl, type } = useMemo(
|
|
156
|
+
() =>
|
|
157
|
+
getDataSourceUrl({
|
|
158
|
+
component,
|
|
159
|
+
feedUrl,
|
|
160
|
+
screenData,
|
|
161
|
+
entryContext,
|
|
162
|
+
searchContext,
|
|
163
|
+
screenContext,
|
|
164
|
+
}),
|
|
165
|
+
[
|
|
166
|
+
component?.id,
|
|
167
|
+
feedUrl,
|
|
168
|
+
entryContext,
|
|
169
|
+
searchContext,
|
|
170
|
+
screenContext,
|
|
171
|
+
screenData?.id,
|
|
172
|
+
]
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
const shouldClearCache = useMemo(
|
|
176
|
+
() => Boolean(component?.rules?.clear_cache_on_reload),
|
|
177
|
+
[component?.id]
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
const pipesOptions = useMemo(
|
|
181
|
+
() => ({
|
|
182
|
+
clearCache: type === FAVORITES_TYPE,
|
|
183
|
+
loadLocalFavorites: type === FAVORITES_TYPE,
|
|
184
|
+
silentRefresh: !shouldClearCache,
|
|
185
|
+
...getMethodAndParams(component),
|
|
186
|
+
}),
|
|
187
|
+
[type, shouldClearCache, component]
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
const { reloadData, loadNext, error, loading, url, data } = useFeedLoader({
|
|
191
|
+
feedUrl: dataSourceUrl ?? "",
|
|
192
|
+
pipesOptions,
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// Setup listeners for data source URL
|
|
196
|
+
useEffect(() => {
|
|
197
|
+
if (dataSourceUrl?.includes("pipesv2://") && reloadData) {
|
|
198
|
+
const addListener = getListenerFromPlugin(dataSourceUrl, plugins);
|
|
199
|
+
|
|
200
|
+
if (addListener) {
|
|
201
|
+
return addListener(reloadData);
|
|
202
|
+
}
|
|
203
|
+
} else {
|
|
204
|
+
return subscribeForUrlContextKeyChanges(dataSourceUrl, {}, reloadData);
|
|
205
|
+
}
|
|
206
|
+
}, [dataSourceUrl, reloadData]);
|
|
207
|
+
|
|
208
|
+
// Setup favorites listener
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
if (type === FAVORITES_TYPE && reloadData) {
|
|
211
|
+
favoritesListener.on("FAVORITES_CHANGED", reloadData);
|
|
212
|
+
|
|
213
|
+
return () => {
|
|
214
|
+
favoritesListener.removeHandler("FAVORITES_CHANGED", reloadData);
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}, [type, reloadData]);
|
|
218
|
+
|
|
219
|
+
// Apply feed refresh hook
|
|
220
|
+
useFeedRefresh({
|
|
221
|
+
reloadData,
|
|
222
|
+
component,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
const loadNextData = useMemo(
|
|
226
|
+
() => (!isLast && isVerticalListOrGrid(component) ? undefined : loadNext),
|
|
227
|
+
[isLast, component, loadNext]
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
const zappPipesDataProps = useMemo(() => {
|
|
231
|
+
const pipeData = { url, loading, data, error };
|
|
232
|
+
|
|
233
|
+
return {
|
|
234
|
+
zappPipesData: applyItemLimit(pipeData, component),
|
|
235
|
+
reloadData,
|
|
236
|
+
loadNextData,
|
|
237
|
+
};
|
|
238
|
+
}, [url, loading, data, error, component, reloadData, loadNextData]);
|
|
239
|
+
|
|
240
|
+
return <>{children(zappPipesDataProps)}</>;
|
|
241
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReloadDataFunction } from "@applicaster/zapp-react-native-utils/reactHooks/feed/useFeedLoader";
|
|
2
|
+
|
|
3
|
+
export type ZappPipesData = {
|
|
4
|
+
url: string;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
data: ZappFeed;
|
|
7
|
+
error?: Error;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type ComponentDataSourceContext = {
|
|
11
|
+
component: ZappUIComponent;
|
|
12
|
+
feedUrl?: string;
|
|
13
|
+
riverId: string;
|
|
14
|
+
getStaticComponentFeed?: GeneralContentScreenProps["getStaticComponentFeed"];
|
|
15
|
+
componentIndex?: number;
|
|
16
|
+
isScreenWrappedInContainer?: boolean;
|
|
17
|
+
isLast?: boolean;
|
|
18
|
+
entryContext?: Record<string, any>;
|
|
19
|
+
screenContext?: Record<string, any>;
|
|
20
|
+
searchContext?: string;
|
|
21
|
+
screenData?: any;
|
|
22
|
+
plugins?: QuickBrickPlugin[];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type ZappPipesDataProps = {
|
|
26
|
+
zappPipesData: ZappPipesData;
|
|
27
|
+
reloadData?: ReloadDataFunction;
|
|
28
|
+
loadNextData?: () => void;
|
|
29
|
+
};
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.1887720441",
|
|
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",
|
|
@@ -27,14 +27,11 @@
|
|
|
27
27
|
"url": "https://github.com/applicaster/quickbrick/issues"
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"redux-mock-store": "^1.5.3"
|
|
32
|
-
},
|
|
33
30
|
"dependencies": {
|
|
34
|
-
"@applicaster/applicaster-types": "14.0.0-alpha.
|
|
35
|
-
"@applicaster/zapp-react-native-bridge": "14.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-redux": "14.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "14.0.0-alpha.1887720441",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "14.0.0-alpha.1887720441",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "14.0.0-alpha.1887720441",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.1887720441",
|
|
38
35
|
"promise": "^8.3.0",
|
|
39
36
|
"url": "^0.11.0",
|
|
40
37
|
"uuid": "^3.3.2"
|
|
@@ -42,10 +39,8 @@
|
|
|
42
39
|
"peerDependencies": {
|
|
43
40
|
"@applicaster/zapp-pipes-v2-client": "*",
|
|
44
41
|
"@react-native-community/netinfo": "*",
|
|
45
|
-
"immer": "*",
|
|
46
42
|
"react": "*",
|
|
47
43
|
"react-native": "*",
|
|
48
|
-
"react-native-safe-area-context": "*",
|
|
49
44
|
"react-native-svg": "*",
|
|
50
45
|
"uglify-js": "*",
|
|
51
46
|
"validate-color": "*",
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View, Image } from "react-native";
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
srcImage: string;
|
|
6
|
-
config?: {
|
|
7
|
-
titleColor: string;
|
|
8
|
-
summaryColor: string;
|
|
9
|
-
backgroundColor: string;
|
|
10
|
-
backgroundImage: string;
|
|
11
|
-
isRTL: boolean;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const containerStyles = {
|
|
16
|
-
marginHorizontal: 24,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const imageStyles = {
|
|
20
|
-
width: 400,
|
|
21
|
-
height: 400,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export function Artwork({ srcImage }: Props) {
|
|
25
|
-
return (
|
|
26
|
-
<View style={containerStyles}>
|
|
27
|
-
<Image
|
|
28
|
-
fadeDuration={0}
|
|
29
|
-
source={{ uri: srcImage }}
|
|
30
|
-
style={imageStyles}
|
|
31
|
-
resizeMode="cover"
|
|
32
|
-
/>
|
|
33
|
-
</View>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from "react";
|
|
2
|
-
import { View, ImageBackground, Animated, ViewStyle } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
|
-
|
|
6
|
-
import { Artwork } from "./Artwork";
|
|
7
|
-
import { directionStyles } from "./helpers";
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
artwork?: string;
|
|
11
|
-
config: {
|
|
12
|
-
titleColor: string;
|
|
13
|
-
summaryColor: string;
|
|
14
|
-
backgroundColor: string;
|
|
15
|
-
backgroundImage: string;
|
|
16
|
-
isRTL: boolean;
|
|
17
|
-
};
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
style: ViewStyle;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export function AudioPlayerLayout({ artwork, config, children, style }: Props) {
|
|
23
|
-
const fadeAnimation = useRef(new Animated.Value(0)).current;
|
|
24
|
-
|
|
25
|
-
const fadeAudioPlayerIn = () => {
|
|
26
|
-
Animated.timing(fadeAnimation, {
|
|
27
|
-
toValue: 1,
|
|
28
|
-
duration: 3000,
|
|
29
|
-
useNativeDriver: true,
|
|
30
|
-
}).start();
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const { isRTL, backgroundColor, backgroundImage } = config;
|
|
34
|
-
|
|
35
|
-
const backgroundImageSource = { uri: backgroundImage };
|
|
36
|
-
|
|
37
|
-
const backgroundColorStyle = backgroundImage
|
|
38
|
-
? "transparent"
|
|
39
|
-
: backgroundColor;
|
|
40
|
-
|
|
41
|
-
const mainContainerStyles = platformSelect({
|
|
42
|
-
tvos: {
|
|
43
|
-
width: 1920,
|
|
44
|
-
height: 1080,
|
|
45
|
-
alignItems: "center",
|
|
46
|
-
justifyContent: "center",
|
|
47
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
48
|
-
backgroundColor: backgroundColorStyle,
|
|
49
|
-
},
|
|
50
|
-
android_tv: {
|
|
51
|
-
position: "absolute",
|
|
52
|
-
width: 1920,
|
|
53
|
-
height: 1080,
|
|
54
|
-
alignItems: "center",
|
|
55
|
-
justifyContent: "center",
|
|
56
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
57
|
-
backgroundColor: backgroundColorStyle,
|
|
58
|
-
},
|
|
59
|
-
web: {
|
|
60
|
-
width: 1920,
|
|
61
|
-
height: 1080,
|
|
62
|
-
alignItems: "center",
|
|
63
|
-
justifyContent: "center",
|
|
64
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
65
|
-
backgroundColor: backgroundColorStyle,
|
|
66
|
-
},
|
|
67
|
-
native: {
|
|
68
|
-
backgroundColor: backgroundColorStyle,
|
|
69
|
-
overflow: "hidden",
|
|
70
|
-
...style,
|
|
71
|
-
},
|
|
72
|
-
samsung_tv: {
|
|
73
|
-
position: "absolute",
|
|
74
|
-
margin: "auto",
|
|
75
|
-
display: "flex",
|
|
76
|
-
flexWrap: "wrap",
|
|
77
|
-
width: "100vw",
|
|
78
|
-
flex: 1,
|
|
79
|
-
alignItems: "center",
|
|
80
|
-
justifyContent: "center",
|
|
81
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
82
|
-
backgroundColor: backgroundColorStyle,
|
|
83
|
-
},
|
|
84
|
-
lg_tv: {
|
|
85
|
-
position: "absolute",
|
|
86
|
-
margin: "auto",
|
|
87
|
-
display: "flex",
|
|
88
|
-
flexWrap: "wrap",
|
|
89
|
-
width: "100vw",
|
|
90
|
-
flex: 1,
|
|
91
|
-
alignItems: "center",
|
|
92
|
-
justifyContent: "center",
|
|
93
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
94
|
-
backgroundColor: backgroundColorStyle,
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const backgroundImgStyles = platformSelect({
|
|
99
|
-
tvos: {
|
|
100
|
-
width: 1920,
|
|
101
|
-
height: 1080,
|
|
102
|
-
alignItems: "center",
|
|
103
|
-
justifyContent: "center",
|
|
104
|
-
},
|
|
105
|
-
android_tv: {
|
|
106
|
-
width: "100%",
|
|
107
|
-
height: "100%",
|
|
108
|
-
alignItems: "center",
|
|
109
|
-
justifyContent: "center",
|
|
110
|
-
},
|
|
111
|
-
web: {
|
|
112
|
-
position: "absolute",
|
|
113
|
-
margin: "auto",
|
|
114
|
-
display: "flex",
|
|
115
|
-
flexWrap: "wrap",
|
|
116
|
-
width: "100%",
|
|
117
|
-
height: "100%",
|
|
118
|
-
flex: 1,
|
|
119
|
-
alignItems: "center",
|
|
120
|
-
justifyContent: "center",
|
|
121
|
-
},
|
|
122
|
-
native: {
|
|
123
|
-
flex: 1,
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const textContainerStyles = platformSelect({
|
|
128
|
-
tvos: {
|
|
129
|
-
width: 600,
|
|
130
|
-
height: 362,
|
|
131
|
-
marginHorizontal: 24,
|
|
132
|
-
alignItems: directionStyles(isRTL).justifyContent,
|
|
133
|
-
},
|
|
134
|
-
android_tv: {
|
|
135
|
-
width: 600,
|
|
136
|
-
height: 362,
|
|
137
|
-
marginHorizontal: 24,
|
|
138
|
-
alignItems: directionStyles(isRTL).justifyContent,
|
|
139
|
-
},
|
|
140
|
-
web: {
|
|
141
|
-
margin: 10,
|
|
142
|
-
height: "100vh",
|
|
143
|
-
alignItems: directionStyles(isRTL).justifyContent,
|
|
144
|
-
justifyContent: "center",
|
|
145
|
-
},
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
const audioPlayerLayoutTV = backgroundImageSource?.uri ? (
|
|
149
|
-
<ImageBackground
|
|
150
|
-
source={backgroundImageSource}
|
|
151
|
-
style={backgroundImgStyles}
|
|
152
|
-
resizeMode="cover"
|
|
153
|
-
>
|
|
154
|
-
<View style={mainContainerStyles}>
|
|
155
|
-
{!!artwork && <Artwork srcImage={artwork} config={config} />}
|
|
156
|
-
<View style={textContainerStyles}>{children}</View>
|
|
157
|
-
</View>
|
|
158
|
-
</ImageBackground>
|
|
159
|
-
) : (
|
|
160
|
-
<View style={mainContainerStyles}>
|
|
161
|
-
{!!artwork && <Artwork srcImage={artwork} config={config} />}
|
|
162
|
-
<View style={textContainerStyles}>{children}</View>
|
|
163
|
-
</View>
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
const audioPlayerLayoutMobile = () => {
|
|
167
|
-
fadeAudioPlayerIn();
|
|
168
|
-
|
|
169
|
-
return (
|
|
170
|
-
<View style={mainContainerStyles} pointerEvents="none">
|
|
171
|
-
<Animated.View
|
|
172
|
-
style={[
|
|
173
|
-
mainContainerStyles,
|
|
174
|
-
{
|
|
175
|
-
opacity: fadeAnimation,
|
|
176
|
-
},
|
|
177
|
-
]}
|
|
178
|
-
>
|
|
179
|
-
<ImageBackground
|
|
180
|
-
source={backgroundImageSource}
|
|
181
|
-
style={backgroundImgStyles}
|
|
182
|
-
resizeMode="cover"
|
|
183
|
-
>
|
|
184
|
-
<View style={mainContainerStyles} />
|
|
185
|
-
</ImageBackground>
|
|
186
|
-
</Animated.View>
|
|
187
|
-
</View>
|
|
188
|
-
);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const audioPlayerLayout = platformSelect({
|
|
192
|
-
tvos: audioPlayerLayoutTV,
|
|
193
|
-
android_tv: audioPlayerLayoutTV,
|
|
194
|
-
web: audioPlayerLayoutTV,
|
|
195
|
-
samsung_tv: audioPlayerLayoutTV,
|
|
196
|
-
lg_tv: audioPlayerLayoutTV,
|
|
197
|
-
ios: audioPlayerLayoutMobile(),
|
|
198
|
-
android: audioPlayerLayoutMobile(),
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
return audioPlayerLayout;
|
|
202
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View, Text, TextStyle } from "react-native";
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
config: {
|
|
6
|
-
titleColor: string;
|
|
7
|
-
summaryColor: string;
|
|
8
|
-
backgroundColor: string;
|
|
9
|
-
backgroundImage: string;
|
|
10
|
-
isRTL: boolean;
|
|
11
|
-
titleFontFamily: string;
|
|
12
|
-
titleFontSize: number;
|
|
13
|
-
};
|
|
14
|
-
title: string | number;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const containerStyles = {
|
|
18
|
-
width: 600,
|
|
19
|
-
height: 100,
|
|
20
|
-
marginBottom: 12,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const textStyles = ({ titleColor, isRTL, titleFontFamily, titleFontSize }) => ({
|
|
24
|
-
textAlign: (isRTL ? "left" : "right") as TextStyle["textAlign"],
|
|
25
|
-
fontSize: titleFontSize ? Number(titleFontSize) : 38,
|
|
26
|
-
fontWeight: "600" as TextStyle["fontWeight"],
|
|
27
|
-
color: titleColor,
|
|
28
|
-
fontFamily: titleFontFamily || null,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export function Title({ title, config }: Props) {
|
|
32
|
-
return (
|
|
33
|
-
<View style={containerStyles}>
|
|
34
|
-
<Text style={textStyles(config)} numberOfLines={2}>
|
|
35
|
-
{title}
|
|
36
|
-
</Text>
|
|
37
|
-
</View>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`<AudioPlayerLayout /> renders correctly 1`] = `
|
|
4
|
-
<View
|
|
5
|
-
pointerEvents="none"
|
|
6
|
-
style={
|
|
7
|
-
{
|
|
8
|
-
"backgroundColor": "transparent",
|
|
9
|
-
"overflow": "hidden",
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
>
|
|
13
|
-
<View
|
|
14
|
-
collapsable={false}
|
|
15
|
-
style={
|
|
16
|
-
{
|
|
17
|
-
"backgroundColor": "transparent",
|
|
18
|
-
"opacity": 0,
|
|
19
|
-
"overflow": "hidden",
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
>
|
|
23
|
-
<View
|
|
24
|
-
accessibilityIgnoresInvertColors={true}
|
|
25
|
-
style={
|
|
26
|
-
{
|
|
27
|
-
"flex": 1,
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
>
|
|
31
|
-
<Image
|
|
32
|
-
resizeMode="cover"
|
|
33
|
-
source={
|
|
34
|
-
{
|
|
35
|
-
"uri": "https://example.com",
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
style={
|
|
39
|
-
[
|
|
40
|
-
{
|
|
41
|
-
"bottom": 0,
|
|
42
|
-
"left": 0,
|
|
43
|
-
"position": "absolute",
|
|
44
|
-
"right": 0,
|
|
45
|
-
"top": 0,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"height": undefined,
|
|
49
|
-
"width": undefined,
|
|
50
|
-
},
|
|
51
|
-
undefined,
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
/>
|
|
55
|
-
<View
|
|
56
|
-
style={
|
|
57
|
-
{
|
|
58
|
-
"backgroundColor": "transparent",
|
|
59
|
-
"overflow": "hidden",
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/>
|
|
63
|
-
</View>
|
|
64
|
-
</View>
|
|
65
|
-
</View>
|
|
66
|
-
`;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`<Channel /> renders correctly 1`] = `
|
|
4
|
-
<View
|
|
5
|
-
style={
|
|
6
|
-
{
|
|
7
|
-
"height": 72,
|
|
8
|
-
"marginBottom": 30,
|
|
9
|
-
"width": 128,
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
>
|
|
13
|
-
<Image
|
|
14
|
-
fadeDuration={0}
|
|
15
|
-
source={
|
|
16
|
-
{
|
|
17
|
-
"uri": "https://example.com",
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
style={
|
|
21
|
-
{
|
|
22
|
-
"height": 72,
|
|
23
|
-
"width": 128,
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/>
|
|
27
|
-
</View>
|
|
28
|
-
`;
|