@applicaster/zapp-react-native-ui-components 13.0.0-alpha.4118873321 → 13.0.0-alpha.4133940547

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.
@@ -24,6 +24,7 @@ type Props = {
24
24
  audio_player_rtl?: boolean;
25
25
  magic_background?: boolean;
26
26
  audio_player_background_image_query?: string;
27
+ audio_player_background_image_default_color?: string;
27
28
  start_time?: string;
28
29
  end_time?: string;
29
30
  };
@@ -35,6 +36,7 @@ type Props = {
35
36
  audio_player_rtl?: string;
36
37
  magic_background?: string;
37
38
  audio_player_background_image_query?: string;
39
+ audio_player_background_image_default_color?: string;
38
40
  audio_player_background_image?: string;
39
41
  audio_player_artwork_aspect_ratio?: string;
40
42
  lg_tv_audio_player_title_font_family?: string;
@@ -80,6 +82,10 @@ export function AudioPlayer(props: Props) {
80
82
  "audio_player_background_image_query"
81
83
  );
82
84
 
85
+ const audioPlayerBackgroundImageDefaultColor = getProp(
86
+ "audio_player_background_image_default_color"
87
+ );
88
+
83
89
  const isRTL = rtlFlag === "1" || rtlFlag === "true" || rtlFlag === true;
84
90
 
85
91
  const titleFontFamily = getProp(
@@ -158,6 +164,7 @@ export function AudioPlayer(props: Props) {
158
164
  channelIcon,
159
165
  magicBackground,
160
166
  audioPlayerBackgroundImageQuery,
167
+ audioPlayerBackgroundImageDefaultColor,
161
168
  };
162
169
  }, [getProp]);
163
170
 
@@ -6,6 +6,7 @@ const defaults = {
6
6
  audio_player_rtl: false,
7
7
  magic_background: false,
8
8
  audio_player_background_image_query: "",
9
+ audio_player_background_image_default_color: "",
9
10
  };
10
11
 
11
12
  export function getPropertyFromEntryOrConfig({ entry, plugin_configuration }) {
@@ -24,8 +24,7 @@ type Props = {
24
24
  id: string;
25
25
  children: (arg1: boolean) => React.ComponentType<any>;
26
26
  isFocusDisabled: boolean;
27
- initialItemId: string;
28
- isPreferredFocusDisabled: boolean;
27
+ isWithMemory: boolean;
29
28
  focusGroupRef: React.Component;
30
29
  shouldUsePreferredFocus: boolean;
31
30
  groupId: string;
@@ -40,8 +39,7 @@ export class FocusableGroup extends BaseFocusable<Props> {
40
39
  children,
41
40
  id,
42
41
  isFocusDisabled,
43
- initialItemId,
44
- isPreferredFocusDisabled,
42
+ isWithMemory,
45
43
  style = {},
46
44
  groupId,
47
45
  ...otherProps
@@ -63,8 +61,7 @@ export class FocusableGroup extends BaseFocusable<Props> {
63
61
  itemId={id}
64
62
  ref={this.ref}
65
63
  isFocusDisabled={isFocusDisabled}
66
- initialItemId={initialItemId}
67
- isPreferredFocusDisabled={isPreferredFocusDisabled}
64
+ isWithMemory={isWithMemory}
68
65
  onGroupFocus={onGroupFocus}
69
66
  onGroupBlur={onGroupBlur}
70
67
  style={style}
@@ -16,7 +16,6 @@ type Props = {
16
16
  prioritiseFocusOn?: number;
17
17
  groupId?: string;
18
18
  hasTVPreferredFocus?: boolean;
19
- isPreferredFocusDisabled?: boolean;
20
19
  onFocus?: () => void;
21
20
  onBlur?: () => void;
22
21
  willReceiveFocus?: (event?: any) => void;
@@ -91,6 +91,15 @@ export type PlayNextData = {
91
91
  onPlayNextPerformNextVideoPlay: () => void;
92
92
  };
93
93
 
94
+ export type PlayerState = {
95
+ duration: number;
96
+ currentTime?: number;
97
+ seekableDuration: number;
98
+ isLive: boolean;
99
+ isBuffering: boolean;
100
+ isPaused: boolean;
101
+ };
102
+
94
103
  const focusableBottomContainerId = "player-container-bottom";
95
104
 
96
105
  // Styles
@@ -335,9 +344,9 @@ const PlayerContainerComponent = (props: Props) => {
335
344
 
336
345
  const resumeTime = Number(item?.extensions?.resumeTime);
337
346
 
338
- // TODO: This is temp hack, will be removed on next pr with player refactoring
347
+ // Сhecking that the player itself knows where to start playing, and there is no need to call seekTo after returning from the Сhromecast
339
348
  if (
340
- !!playerManager.getActivePlayer()?.getContinueWatchingOffset === false &&
349
+ !playerManager.getActivePlayer()?.hasResumePosition() &&
341
350
  !isNaN(resumeTime)
342
351
  ) {
343
352
  player?.seekTo(resumeTime);
@@ -514,6 +523,12 @@ const PlayerContainerComponent = (props: Props) => {
514
523
  useEffect(() => {
515
524
  playerEvent("source_changed", { item });
516
525
 
526
+ return () => {
527
+ playerEvent("player_did_close", { item });
528
+ };
529
+ }, [item?.id, Player]);
530
+
531
+ useEffect(() => {
517
532
  if (!isModal) {
518
533
  showNavBar(false);
519
534
  }
@@ -523,13 +538,11 @@ const PlayerContainerComponent = (props: Props) => {
523
538
  }
524
539
 
525
540
  return () => {
526
- playerEvent("player_did_close", { item });
527
-
528
541
  if (!isModal) {
529
542
  showNavBar(true);
530
543
  }
531
544
  };
532
- }, [showNavBar, /* added as suggested: */ item?.id, isModal, Player]);
545
+ }, [showNavBar, isModal, Player]);
533
546
 
534
547
  useEffect(() => {
535
548
  if (prevItemId && !R.equals(prevItemId, item?.id)) {
@@ -1,4 +1,4 @@
1
- import React, { PropsWithChildren, useEffect, useState } from "react";
1
+ import React, { PropsWithChildren } from "react";
2
2
  import { ImageBackground, View } from "react-native";
3
3
 
4
4
  import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
@@ -12,7 +12,6 @@ import {
12
12
  type Props = PropsWithChildren<{
13
13
  entry: ZappEntry;
14
14
  style?: { [K: string]: any };
15
- docked?: boolean;
16
15
  imageStyle?: { [K: string]: any };
17
16
  imageKey?: string;
18
17
  defaultImageDimensions?: { [K: string]: any };
@@ -24,7 +23,6 @@ const PlayerImageBackgroundComponent = ({
24
23
  entry,
25
24
  children,
26
25
  style,
27
- docked,
28
26
  imageStyle,
29
27
  imageKey,
30
28
  defaultImageDimensions,
@@ -36,42 +34,24 @@ const PlayerImageBackgroundComponent = ({
36
34
 
37
35
  const { playerAnimationState } = useModalAnimationContext();
38
36
 
39
- const [lastNonNullAnimationState, setLastNonNullAnimationState] =
40
- useState(playerAnimationState);
41
-
42
- useEffect(() => {
43
- if (playerAnimationState !== null) {
44
- setLastNonNullAnimationState(playerAnimationState);
45
- }
46
- }, [playerAnimationState]);
47
-
48
37
  if (!source) return <>{children}</>;
49
38
 
50
- const imageBackgroundStyle =
51
- lastNonNullAnimationState !== PlayerAnimationStateEnum.minimize && !docked
52
- ? defaultImageDimensions
53
- : imageSize;
54
-
55
39
  return (
56
40
  <View
57
41
  style={
58
- playerAnimationState === PlayerAnimationStateEnum.maximaze
42
+ playerAnimationState === PlayerAnimationStateEnum.maximize
59
43
  ? defaultImageDimensions
60
44
  : style
61
45
  }
62
46
  >
63
47
  <AnimationComponent
64
- style={
65
- playerAnimationState === PlayerAnimationStateEnum.maximaze
66
- ? defaultImageDimensions
67
- : style
68
- }
48
+ style={style}
69
49
  animationType={ComponentAnimationType.player}
70
50
  additionalData={defaultImageDimensions}
71
51
  >
72
52
  <ImageBackground
73
53
  resizeMode="cover"
74
- style={imageBackgroundStyle}
54
+ style={imageSize}
75
55
  imageStyle={imageStyle}
76
56
  source={source}
77
57
  >
@@ -34,6 +34,7 @@ type Props = {
34
34
  getStaticComponentFeed: any;
35
35
  pullToRefreshPipesV1RefreshingStateUpdater: () => boolean;
36
36
  refreshingPipesV1?: boolean;
37
+ stickyHeaderIndices?: number[];
37
38
  };
38
39
 
39
40
  const styles = StyleSheet.create({
@@ -61,6 +62,7 @@ function ComponentsMapComponent(props: Props) {
61
62
  // TODO: Remove when pipes v1 is deprecated.
62
63
  pullToRefreshPipesV1RefreshingStateUpdater,
63
64
  refreshingPipesV1,
65
+ stickyHeaderIndices,
64
66
  } = props;
65
67
 
66
68
  const flatListRef = React.useRef<FlatList | null>(null);
@@ -274,6 +276,7 @@ function ComponentsMapComponent(props: Props) {
274
276
  overScrollMode={Platform.OS === "android" ? "never" : "auto"}
275
277
  scrollIndicatorInsets={scrollIndicatorInsets}
276
278
  extraData={feed}
279
+ stickyHeaderIndices={stickyHeaderIndices}
277
280
  onLayout={handleOnLayout}
278
281
  removeClippedSubviews
279
282
  initialNumToRender={3}
@@ -28,10 +28,10 @@ type Return = {
28
28
  // TODO: Take this value from Zapp configuration, when feature is added to GeneralScreen
29
29
  const SHOULD_FAIL_ON_COMPONENT_LOADING = false;
30
30
 
31
- const createLoadingStateObservable = () =>
31
+ const createLoadingStateObservable = (count: number) =>
32
32
  new BehaviorSubject<LoadingState>({
33
33
  index: -1,
34
- done: false,
34
+ done: count === 0,
35
35
  waitForAllComponents: SHOULD_FAIL_ON_COMPONENT_LOADING,
36
36
  });
37
37
 
@@ -43,7 +43,7 @@ export const useLoadingState = (
43
43
  const [loadingError, setLoadingError] = React.useState(null);
44
44
 
45
45
  const loadingState = useRefWithInitialValue<BehaviorSubject<LoadingState>>(
46
- createLoadingStateObservable
46
+ () => createLoadingStateObservable(count)
47
47
  );
48
48
 
49
49
  const arePreviousComponentsLoaded = React.useCallback((index) => {
@@ -7,15 +7,12 @@ import {
7
7
  useCurrentScreenData,
8
8
  useDimensions,
9
9
  useRoute,
10
+ useIsTablet,
10
11
  } from "@applicaster/zapp-react-native-utils/reactHooks";
11
12
  import { useMemo, useEffect, useState } from "react";
12
13
 
13
14
  export const useWaitForValidOrientation = () => {
14
- const {
15
- width: screenWidth,
16
- height,
17
- deviceInfo,
18
- } = useDimensions("screen", {
15
+ const { width: screenWidth, height } = useDimensions("screen", {
19
16
  fullDimensions: true,
20
17
  updateForInactiveScreens: false,
21
18
  });
@@ -26,7 +23,7 @@ export const useWaitForValidOrientation = () => {
26
23
 
27
24
  const [readyState, setReadyState] = useState(false);
28
25
 
29
- const isTablet = deviceInfo?.isTablet;
26
+ const isTablet = useIsTablet();
30
27
 
31
28
  const { appData } = usePickFromState(["appData"]);
32
29
  const isTabletPortrait = appData?.isTabletPortrait;
@@ -46,7 +46,7 @@ export const AnimatedPlayerModalWrapper = (props: Props) => {
46
46
 
47
47
  React.useEffect(() => {
48
48
  (playerAnimationState === PlayerAnimationStateEnum.minimize ||
49
- playerAnimationState === PlayerAnimationStateEnum.maximaze) &&
49
+ playerAnimationState === PlayerAnimationStateEnum.maximize) &&
50
50
  setStartComponentsAnimation(true);
51
51
  }, [playerAnimationState]);
52
52
 
@@ -70,14 +70,19 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
70
70
  const { maximiseVideoModal, minimiseVideoModal, videoModalState } =
71
71
  useNavigation();
72
72
 
73
- const { mode: videoModalMode, item: videoModalItem } = videoModalState;
73
+ const {
74
+ mode: videoModalMode,
75
+ previousMode: previousVideoModalMode,
76
+ item: videoModalItem,
77
+ } = videoModalState;
78
+
74
79
  const isMaximizedModal: boolean = videoModalMode === "MAXIMIZED";
75
80
  const isMinimizedModal: boolean = videoModalMode === "MINIMIZED";
76
81
  const previousItemId = usePrevious(videoModalItem?.id);
77
82
 
78
83
  const isNotMinimizeMaximazeAnimation =
79
84
  playerAnimationState !== PlayerAnimationStateEnum.minimize &&
80
- playerAnimationState !== PlayerAnimationStateEnum.maximaze;
85
+ playerAnimationState !== PlayerAnimationStateEnum.maximize;
81
86
 
82
87
  const isEnablePanGesture =
83
88
  enableGesture &&
@@ -121,7 +126,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
121
126
  const preparedTranslationY =
122
127
  Math.abs(translationY) - lastScrollYValue.current;
123
128
 
124
- if (videoModalMode === "MAXIMIZED") {
129
+ if (isMaximizedModal) {
125
130
  const endOffsetY =
126
131
  lastSnap + preparedTranslationY + dragToss * velocityY + 150;
127
132
 
@@ -137,14 +142,14 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
137
142
 
138
143
  setLastSnap(destSnapPoint);
139
144
 
140
- if (destSnapPoint === modalSnapPoints[0]) {
145
+ if (destSnapPoint === modalSnapPoints[0] && isMinimizedModal) {
141
146
  translateYOffset.extractOffset();
142
147
  translateYOffset.setValue(preparedTranslationY);
143
148
  translateYOffset.flattenOffset();
144
149
  dragScrollY.setValue(0);
145
150
 
146
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
147
- } else {
151
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
152
+ } else if (destSnapPoint !== modalSnapPoints[0] && isMaximizedModal) {
148
153
  setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
149
154
  }
150
155
  } else {
@@ -158,7 +163,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
158
163
 
159
164
  dragScrollY.setValue(0);
160
165
 
161
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
166
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
162
167
  } else {
163
168
  resetPlayerAnimationState();
164
169
  }
@@ -168,7 +173,13 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
168
173
  resetPlayerAnimationState();
169
174
  }
170
175
  },
171
- [lastSnap, modalSnapPoints, playerAnimationState, videoModalMode]
176
+ [
177
+ lastSnap,
178
+ modalSnapPoints,
179
+ playerAnimationState,
180
+ isMinimizedModal,
181
+ isMaximizedModal,
182
+ ]
172
183
  );
173
184
 
174
185
  const onScroll = React.useCallback(({ nativeEvent }) => {
@@ -219,17 +230,18 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
219
230
  }, []);
220
231
 
221
232
  React.useEffect(() => {
222
- const { mode, previousMode, item } = videoModalState;
223
-
224
233
  if (
225
- mode === "MAXIMIZED" &&
234
+ videoModalMode === "MAXIMIZED" &&
226
235
  !enableGesture &&
227
236
  scrollPosition.current === 0
228
237
  ) {
229
238
  setIEnableGesture(true);
230
239
  }
231
240
 
232
- if (mode === "MINIMIZED" && previousMode === "MAXIMIZED") {
241
+ if (
242
+ videoModalMode === "MINIMIZED" &&
243
+ previousVideoModalMode === "MAXIMIZED"
244
+ ) {
233
245
  // set animation to the minimize values if moving from the player to another screen
234
246
  if (playerAnimationState === null) {
235
247
  setScrollModalAnimatedValue(
@@ -247,14 +259,16 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
247
259
  }
248
260
  } else if (
249
261
  playerAnimationState === null &&
250
- ((previousItemId === item?.id &&
251
- mode === "MAXIMIZED" &&
252
- (previousMode === "MINIMIZED" || previousMode === "MAXIMIZED")) ||
253
- (previousItemId !== item?.id && mode !== "FULLSCREEN"))
262
+ ((previousItemId === videoModalItem?.id &&
263
+ videoModalMode === "MAXIMIZED" &&
264
+ (previousVideoModalMode === "MINIMIZED" ||
265
+ previousVideoModalMode === "MAXIMIZED")) ||
266
+ (previousItemId !== videoModalItem?.id &&
267
+ videoModalMode !== "FULLSCREEN"))
254
268
  ) {
255
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
269
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
256
270
  }
257
- }, [videoModalState]);
271
+ }, [videoModalMode, previousVideoModalMode, videoModalItem]);
258
272
 
259
273
  React.useEffect(() => {
260
274
  if (playerAnimationState === PlayerAnimationStateEnum.minimize) {
@@ -296,7 +310,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
296
310
 
297
311
  resetPlayerAnimationState();
298
312
  });
299
- } else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
313
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
300
314
  Animated.timing(translateYOffset, getAnimatedConfig(0)).start(() => {
301
315
  maximiseVideoModal();
302
316
  setScrollModalAnimatedValue(translateYOffset, 0, setLastSnap);
@@ -50,7 +50,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
50
50
 
51
51
  const isNotMinimizeMaximazeAnimation =
52
52
  playerAnimationState !== PlayerAnimationStateEnum.minimize &&
53
- playerAnimationState !== PlayerAnimationStateEnum.maximaze;
53
+ playerAnimationState !== PlayerAnimationStateEnum.maximize;
54
54
 
55
55
  const isEnablePanGesture =
56
56
  !isLanguageOverlayVisible &&
@@ -89,7 +89,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
89
89
  setLastSnap(destSnapPoint);
90
90
 
91
91
  if (destSnapPoint === modalSnapPoints[0]) {
92
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
92
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
93
93
  } else {
94
94
  lastScrollY.setValue(0);
95
95
  lastScrollYValue.current = 0;
@@ -105,7 +105,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
105
105
  modalSnapPoints[1] - preparedTranslationY
106
106
  );
107
107
 
108
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
108
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
109
109
  } else {
110
110
  resetPlayerAnimationState();
111
111
  }
@@ -228,6 +228,8 @@ export const AnimationView = ({
228
228
  isAudioItem,
229
229
  moveUpValue,
230
230
  moveComponentHorizontalValue,
231
+ isRTL,
232
+ inlineAudioPlayer,
231
233
  ]
232
234
  );
233
235
 
@@ -246,7 +248,7 @@ export const AnimationView = ({
246
248
  default:
247
249
  return getAnimationValue(
248
250
  animationType,
249
- PlayerAnimationStateEnum.maximaze
251
+ PlayerAnimationStateEnum.maximize
250
252
  ).toValue;
251
253
  }
252
254
  }, [defaultValue, videoModalState]);
@@ -278,6 +280,11 @@ export const AnimationView = ({
278
280
  moveUpValue,
279
281
  moveComponentHorizontalValue,
280
282
  videoModalMode,
283
+ isAudioItem,
284
+ isTablet,
285
+ isTabletLandscape,
286
+ isRTL,
287
+ inlineAudioPlayer,
281
288
  ]
282
289
  );
283
290
 
@@ -306,7 +313,7 @@ export const AnimationView = ({
306
313
  }
307
314
 
308
315
  if (
309
- videoModalMode === "MAXIMIZED" &&
316
+ (videoModalMode === "MAXIMIZED" || videoModalMode === "MINIMIZED") &&
310
317
  defaultValue.x !== screenWidth &&
311
318
  width &&
312
319
  height
@@ -332,7 +339,13 @@ export const AnimationView = ({
332
339
  animatedValue.setValue(value);
333
340
  }
334
341
  }
335
- }, [videoModalState]);
342
+ }, [
343
+ animatedValue,
344
+ animationType,
345
+ getAnimationValue,
346
+ playerAnimationState,
347
+ videoModalState,
348
+ ]);
336
349
 
337
350
  React.useEffect(() => {
338
351
  if (
@@ -344,7 +357,7 @@ export const AnimationView = ({
344
357
  animatedValue,
345
358
  getAnimationValue(animationType, playerAnimationState)
346
359
  ).start();
347
- } else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
360
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
348
361
  animatedValue.setValue(defaultValue);
349
362
  }
350
363
  }, [playerAnimationState, startComponentsAnimation, defaultValue]);
@@ -14,12 +14,12 @@ import { useConfiguration } from "../utils";
14
14
 
15
15
  export enum PlayerAnimationStateEnum {
16
16
  minimize = "minimize",
17
- maximaze = "maximaze",
17
+ maximize = "maximize",
18
18
  drag_player = "drag_player",
19
19
  drag_scroll = "drag_scroll",
20
20
  }
21
21
 
22
- type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
22
+ export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
23
23
 
24
24
  export type ModalAnimationContextT = {
25
25
  isActiveGesture: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-alpha.4118873321",
3
+ "version": "13.0.0-alpha.4133940547",
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",
@@ -32,10 +32,10 @@
32
32
  "redux-mock-store": "^1.5.3"
33
33
  },
34
34
  "dependencies": {
35
- "@applicaster/applicaster-types": "13.0.0-alpha.4118873321",
36
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.4118873321",
37
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.4118873321",
38
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.4118873321",
35
+ "@applicaster/applicaster-types": "13.0.0-alpha.4133940547",
36
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.4133940547",
37
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.4133940547",
38
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.4133940547",
39
39
  "promise": "^8.3.0",
40
40
  "react-router-native": "^5.1.2",
41
41
  "url": "^0.11.0",