@applicaster/zapp-react-native-ui-components 14.0.0-alpha.7900711229 → 14.0.0-alpha.8419134002

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.
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { View, Image, StyleSheet } from "react-native";
2
+ import { View, StyleSheet } from "react-native";
3
+ import { QBImage } from "@applicaster/zapp-react-native-ui-components/Components/Image";
3
4
  import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
4
5
 
5
6
  const styles = StyleSheet.create({
@@ -29,7 +30,7 @@ export function Artwork({ srcImage, config }: Props) {
29
30
 
30
31
  return (
31
32
  <View style={styles.container}>
32
- <Image
33
+ <QBImage
33
34
  fadeDuration={0}
34
35
  source={{ uri: srcImage }}
35
36
  style={[styles.image, { borderRadius }]}
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { View, Image } from "react-native";
2
+ import { Image } from "react-native";
3
+ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
3
4
 
4
5
  type Props = {
5
6
  srcImage: string;
@@ -15,17 +16,16 @@ type Props = {
15
16
  const imageStyles = {
16
17
  width: 128,
17
18
  height: 72,
18
- };
19
19
 
20
- const containerStyles = {
21
- ...imageStyles,
22
20
  marginBottom: 30,
23
21
  };
24
22
 
25
23
  export function Channel({ srcImage }: Props) {
24
+ if (isNilOrEmpty(srcImage)) {
25
+ return null;
26
+ }
27
+
26
28
  return (
27
- <View style={containerStyles}>
28
- <Image fadeDuration={0} source={{ uri: srcImage }} style={imageStyles} />
29
- </View>
29
+ <Image fadeDuration={0} source={{ uri: srcImage }} style={imageStyles} />
30
30
  );
31
31
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { View, ImageBackground, ViewStyle } from "react-native";
2
+ import { ImageBackground, View, ViewStyle } from "react-native";
3
3
 
4
4
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
5
5
 
@@ -11,6 +11,7 @@ type Props = {
11
11
  config: {
12
12
  titleColor: string;
13
13
  summaryColor: string;
14
+ backgroundImageOverlay?: string;
14
15
  backgroundColor: string;
15
16
  backgroundImage: Option<string>;
16
17
  isRTL: boolean;
@@ -20,13 +21,40 @@ type Props = {
20
21
  style: ViewStyle;
21
22
  };
22
23
 
24
+ const backgroundImgStyles = platformSelect({
25
+ tvos: {
26
+ width: "100%",
27
+ height: "100%",
28
+ alignItems: "center",
29
+ justifyContent: "center",
30
+ },
31
+ android_tv: {
32
+ width: "100%",
33
+ height: "100%",
34
+ alignItems: "center",
35
+ justifyContent: "center",
36
+ },
37
+ web: {
38
+ position: "absolute",
39
+ margin: "auto",
40
+ display: "flex",
41
+ flexWrap: "wrap",
42
+ width: "100%",
43
+ height: "100%",
44
+ flex: 1,
45
+ alignItems: "center",
46
+ justifyContent: "center",
47
+ },
48
+ });
49
+
23
50
  export function AudioPlayerTVLayout({
24
51
  artwork,
25
52
  config,
26
53
  children,
27
54
  style,
28
55
  }: Props) {
29
- const { isRTL, backgroundColor, backgroundImage } = config;
56
+ const { backgroundColor, backgroundImage, backgroundImageOverlay, isRTL } =
57
+ config;
30
58
 
31
59
  const backgroundImageSource = { uri: backgroundImage };
32
60
 
@@ -34,108 +62,87 @@ export function AudioPlayerTVLayout({
34
62
  ? "transparent"
35
63
  : backgroundColor;
36
64
 
37
- const mainContainerStyles = platformSelect({
65
+ const textContainerStyles = platformSelect({
38
66
  tvos: {
39
- width: "100%",
40
- height: "100%",
41
- alignItems: "center",
42
67
  justifyContent: "center",
43
- flexDirection: directionStyles(isRTL).flexDirection,
44
- backgroundColor: backgroundColorStyle,
68
+ alignItems: directionStyles(isRTL).justifyContent,
45
69
  },
46
70
  android_tv: {
47
- width: "100%",
48
- height: "100%",
49
- alignItems: "center",
50
71
  justifyContent: "center",
51
- flexDirection: directionStyles(isRTL).flexDirection,
52
- backgroundColor: backgroundColorStyle,
72
+ alignItems: directionStyles(isRTL).justifyContent,
53
73
  },
54
74
  web: {
55
- width: 1920,
56
- height: 1080,
57
- alignItems: "center",
58
- justifyContent: "center",
59
- flexDirection: directionStyles(isRTL).flexDirection,
60
- backgroundColor: backgroundColorStyle,
61
- },
62
- native: {
63
- backgroundColor: backgroundColorStyle,
64
- overflow: "hidden",
65
- ...style,
66
- },
67
- samsung_tv: {
68
- position: "absolute",
69
- margin: "auto",
70
- display: "flex",
71
- flexWrap: "wrap",
72
- width: "100vw",
73
- flex: 1,
74
- alignItems: "center",
75
- justifyContent: "center",
76
- flexDirection: directionStyles(isRTL).flexDirection,
77
- backgroundColor: backgroundColorStyle,
78
- },
79
- lg_tv: {
80
- position: "absolute",
81
- margin: "auto",
82
- display: "flex",
83
- flexWrap: "wrap",
84
- width: "100vw",
85
- flex: 1,
86
- alignItems: "center",
87
75
  justifyContent: "center",
88
- flexDirection: directionStyles(isRTL).flexDirection,
89
- backgroundColor: backgroundColorStyle,
76
+ alignItems: directionStyles(isRTL).justifyContent,
90
77
  },
91
78
  });
92
79
 
93
- const backgroundImgStyles = platformSelect({
94
- tvos: {
95
- width: "100%",
96
- height: "100%",
97
- alignItems: "center",
98
- justifyContent: "center",
99
- },
100
- android_tv: {
101
- width: "100%",
102
- height: "100%",
103
- alignItems: "center",
104
- justifyContent: "center",
105
- },
106
- web: {
107
- position: "absolute",
108
- margin: "auto",
109
- display: "flex",
110
- flexWrap: "wrap",
111
- width: "100%",
112
- height: "100%",
113
- flex: 1,
114
- alignItems: "center",
115
- justifyContent: "center",
116
- },
117
- });
80
+ const mainContainerStyles = React.useMemo(
81
+ () =>
82
+ platformSelect({
83
+ tvos: {
84
+ width: "100%",
85
+ height: "100%",
86
+ alignItems: "center",
87
+ justifyContent: "center",
88
+ flexDirection: directionStyles(isRTL).flexDirection,
89
+ backgroundColor: backgroundColorStyle,
90
+ },
91
+ android_tv: {
92
+ width: "100%",
93
+ height: "100%",
94
+ alignItems: "center",
95
+ justifyContent: "center",
96
+ flexDirection: directionStyles(isRTL).flexDirection,
97
+ backgroundColor: backgroundColorStyle,
98
+ },
99
+ web: {
100
+ width: 1920,
101
+ height: 1080,
102
+ alignItems: "center",
103
+ justifyContent: "center",
104
+ flexDirection: directionStyles(isRTL).flexDirection,
105
+ backgroundColor: backgroundColorStyle,
106
+ },
107
+ native: {
108
+ backgroundColor: backgroundColorStyle,
109
+ overflow: "hidden",
110
+ ...style,
111
+ },
112
+ samsung_tv: {
113
+ position: "absolute",
114
+ margin: "auto",
115
+ display: "flex",
116
+ flexWrap: "wrap",
117
+ height: "100vh",
118
+ width: "100vw",
119
+ alignItems: "center",
120
+ justifyContent: "center",
121
+ flexDirection: directionStyles(isRTL).flexDirection,
122
+ backgroundColor: backgroundColorStyle,
123
+ },
124
+ lg_tv: {
125
+ position: "absolute",
126
+ margin: "auto",
127
+ display: "flex",
128
+ flexWrap: "wrap",
129
+ height: "100vh",
130
+ width: "100vw",
131
+ alignItems: "center",
132
+ justifyContent: "center",
133
+ flexDirection: directionStyles(isRTL).flexDirection,
134
+ backgroundColor: backgroundColorStyle,
135
+ },
136
+ }),
137
+ [backgroundColorStyle, isRTL, style]
138
+ );
118
139
 
119
- const textContainerStyles = platformSelect({
120
- tvos: {
121
- width: 600,
122
- height: 362,
123
- marginHorizontal: 24,
124
- alignItems: directionStyles(isRTL).justifyContent,
125
- },
126
- android_tv: {
127
- width: 600,
128
- height: 362,
129
- marginHorizontal: 24,
130
- alignItems: directionStyles(isRTL).justifyContent,
131
- },
132
- web: {
133
- margin: 10,
134
- height: "100vh",
135
- alignItems: directionStyles(isRTL).justifyContent,
136
- justifyContent: "center",
137
- },
138
- });
140
+ const backgroundOverlayStyles = React.useMemo(
141
+ () => ({
142
+ backgroundColor: backgroundImageOverlay,
143
+ }),
144
+ [backgroundImageOverlay]
145
+ );
139
146
 
140
147
  if (backgroundImage) {
141
148
  return (
@@ -144,7 +151,7 @@ export function AudioPlayerTVLayout({
144
151
  style={backgroundImgStyles}
145
152
  resizeMode="cover"
146
153
  >
147
- <View style={mainContainerStyles}>
154
+ <View style={[mainContainerStyles, backgroundOverlayStyles]}>
148
155
  <Artwork srcImage={artwork} config={config} />
149
156
  <View style={textContainerStyles}>{children}</View>
150
157
  </View>
@@ -1,6 +1,8 @@
1
1
  import React from "react";
2
2
  import { View, Text, ViewStyle, TextStyle } from "react-native";
3
3
  import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
4
+ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
5
+
4
6
  import { directionStyles } from "./helpers";
5
7
 
6
8
  type Props = {
@@ -19,7 +21,6 @@ type Props = {
19
21
 
20
22
  const containerStyles = ({ isRTL }) => ({
21
23
  width: 600,
22
- height: 40,
23
24
  justifyContent: directionStyles(isRTL)
24
25
  .justifyContent as ViewStyle["justifyContent"],
25
26
  });
@@ -38,11 +39,16 @@ const textStyles = ({
38
39
  });
39
40
 
40
41
  export function Runtime({ start_time, end_time, config }: Props) {
42
+ if (isNilOrEmpty(start_time) && isNilOrEmpty(end_time)) {
43
+ return null;
44
+ }
45
+
41
46
  return (
42
47
  <View style={containerStyles({ isRTL: config.isRTL })}>
43
48
  {!!start_time && !!end_time && (
44
49
  <Text
45
50
  style={textStyles(config) as TextStyle}
51
+ numberOfLines={1}
46
52
  >{`${start_time} - ${end_time}`}</Text>
47
53
  )}
48
54
  </View>
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { View, Text, TextStyle, StyleSheet } from "react-native";
3
3
  import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
4
+ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
4
5
 
5
6
  type Props = {
6
7
  config: {
@@ -18,7 +19,6 @@ type Props = {
18
19
  const styles = StyleSheet.create({
19
20
  container: {
20
21
  width: 600,
21
- height: 80,
22
22
  marginBottom: 30,
23
23
  },
24
24
  });
@@ -38,9 +38,13 @@ const textStyles = ({
38
38
  });
39
39
 
40
40
  export function Summary({ summary, config }: Props) {
41
+ if (isNilOrEmpty(summary)) {
42
+ return null;
43
+ }
44
+
41
45
  return (
42
46
  <View style={styles.container}>
43
- <Text style={textStyles(config)} numberOfLines={2}>
47
+ <Text style={textStyles(config)} numberOfLines={3}>
44
48
  {summary}
45
49
  </Text>
46
50
  </View>
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { View, Text, TextStyle, StyleSheet } from "react-native";
3
3
  import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
4
+ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
4
5
 
5
6
  type Props = {
6
7
  config: {
@@ -18,7 +19,6 @@ type Props = {
18
19
  const styles = StyleSheet.create({
19
20
  container: {
20
21
  width: 600,
21
- height: 100,
22
22
  marginBottom: 12,
23
23
  },
24
24
  });
@@ -32,9 +32,13 @@ const textStyles = ({ titleColor, isRTL, titleFontFamily, titleFontSize }) => ({
32
32
  });
33
33
 
34
34
  export function Title({ title, config }: Props) {
35
+ if (isNilOrEmpty(title)) {
36
+ return null;
37
+ }
38
+
35
39
  return (
36
40
  <View style={styles.container}>
37
- <Text style={textStyles(config)} numberOfLines={2}>
41
+ <Text style={textStyles(config)} numberOfLines={3}>
38
42
  {title}
39
43
  </Text>
40
44
  </View>
@@ -4,13 +4,13 @@ exports[`<Runtime /> LTR renders correctly 1`] = `
4
4
  <View
5
5
  style={
6
6
  {
7
- "height": 40,
8
7
  "justifyContent": "flex-start",
9
8
  "width": 600,
10
9
  }
11
10
  }
12
11
  >
13
12
  <Text
13
+ numberOfLines={1}
14
14
  style={
15
15
  {
16
16
  "alignItems": "flex-end",
@@ -33,13 +33,13 @@ exports[`<Runtime /> RTL renders correctly 1`] = `
33
33
  <View
34
34
  style={
35
35
  {
36
- "height": 40,
37
36
  "justifyContent": "flex-end",
38
37
  "width": 600,
39
38
  }
40
39
  }
41
40
  >
42
41
  <Text
42
+ numberOfLines={1}
43
43
  style={
44
44
  {
45
45
  "alignItems": "flex-start",
@@ -30,10 +30,15 @@ exports[`<AudioPlayerTV /> renders correctly 1`] = `
30
30
  />
31
31
  <View
32
32
  style={
33
- {
34
- "backgroundColor": "transparent",
35
- "overflow": "hidden",
36
- }
33
+ [
34
+ {
35
+ "backgroundColor": "transparent",
36
+ "overflow": "hidden",
37
+ },
38
+ {
39
+ "backgroundColor": undefined,
40
+ },
41
+ ]
37
42
  }
38
43
  >
39
44
  <View
@@ -65,7 +70,13 @@ exports[`<AudioPlayerTV /> renders correctly 1`] = `
65
70
  />
66
71
  </View>
67
72
  <View>
68
- <View
73
+ <Image
74
+ fadeDuration={0}
75
+ source={
76
+ {
77
+ "uri": "https://example.com",
78
+ }
79
+ }
69
80
  style={
70
81
  {
71
82
  "height": 72,
@@ -73,33 +84,17 @@ exports[`<AudioPlayerTV /> renders correctly 1`] = `
73
84
  "width": 128,
74
85
  }
75
86
  }
76
- >
77
- <Image
78
- fadeDuration={0}
79
- source={
80
- {
81
- "uri": "https://example.com",
82
- }
83
- }
84
- style={
85
- {
86
- "height": 72,
87
- "width": 128,
88
- }
89
- }
90
- />
91
- </View>
87
+ />
92
88
  <View
93
89
  style={
94
90
  {
95
- "height": 100,
96
91
  "marginBottom": 12,
97
92
  "width": 600,
98
93
  }
99
94
  }
100
95
  >
101
96
  <Text
102
- numberOfLines={2}
97
+ numberOfLines={3}
103
98
  style={
104
99
  {
105
100
  "color": "white",
@@ -116,14 +111,13 @@ exports[`<AudioPlayerTV /> renders correctly 1`] = `
116
111
  <View
117
112
  style={
118
113
  {
119
- "height": 80,
120
114
  "marginBottom": 30,
121
115
  "width": 600,
122
116
  }
123
117
  }
124
118
  >
125
119
  <Text
126
- numberOfLines={2}
120
+ numberOfLines={3}
127
121
  style={
128
122
  {
129
123
  "color": "white",
@@ -141,13 +135,13 @@ exports[`<AudioPlayerTV /> renders correctly 1`] = `
141
135
  <View
142
136
  style={
143
137
  {
144
- "height": 40,
145
138
  "justifyContent": "flex-end",
146
139
  "width": 600,
147
140
  }
148
141
  }
149
142
  >
150
143
  <Text
144
+ numberOfLines={1}
151
145
  style={
152
146
  {
153
147
  "alignItems": "flex-start",
@@ -1,7 +1,13 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<Channel /> renders correctly 1`] = `
4
- <View
4
+ <Image
5
+ fadeDuration={0}
6
+ source={
7
+ {
8
+ "uri": "https://example.com",
9
+ }
10
+ }
5
11
  style={
6
12
  {
7
13
  "height": 72,
@@ -9,20 +15,5 @@ exports[`<Channel /> renders correctly 1`] = `
9
15
  "width": 128,
10
16
  }
11
17
  }
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>
18
+ />
28
19
  `;
@@ -4,14 +4,13 @@ exports[`<Summary /> renders correctly 1`] = `
4
4
  <View
5
5
  style={
6
6
  {
7
- "height": 80,
8
7
  "marginBottom": 30,
9
8
  "width": 600,
10
9
  }
11
10
  }
12
11
  >
13
12
  <Text
14
- numberOfLines={2}
13
+ numberOfLines={3}
15
14
  style={
16
15
  {
17
16
  "color": "white",
@@ -4,14 +4,13 @@ exports[`<Title /> renders correctly 1`] = `
4
4
  <View
5
5
  style={
6
6
  {
7
- "height": 100,
8
7
  "marginBottom": 12,
9
8
  "width": 600,
10
9
  }
11
10
  }
12
11
  >
13
12
  <Text
14
- numberOfLines={2}
13
+ numberOfLines={3}
15
14
  style={
16
15
  {
17
16
  "color": "white",
@@ -35,6 +35,11 @@ export function AudioPlayerTV(props: Props) {
35
35
  const backgroundImage = getProp("audio_player_background_image");
36
36
  const channelIcon = getProp("audio_player_channel_icon");
37
37
  const rtlFlag = getProp("audio_player_rtl");
38
+
39
+ const backgroundImageOverlay = getProp(
40
+ "audio_player_background_image_overlay"
41
+ );
42
+
38
43
  const artworkBorderRadius = getProp("audio_player_artwork_border_radius");
39
44
 
40
45
  const isRTL = rtlFlag === "1" || rtlFlag === "true" || rtlFlag === true;
@@ -113,6 +118,7 @@ export function AudioPlayerTV(props: Props) {
113
118
  runTimeFontSize,
114
119
  channelIcon,
115
120
  artworkBorderRadius,
121
+ backgroundImageOverlay,
116
122
  };
117
123
  }, [getProp]);
118
124
 
@@ -3,11 +3,15 @@ import * as R from "ramda";
3
3
  import { connectToStore } from "@applicaster/zapp-react-native-redux";
4
4
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
5
5
 
6
- import { HorizontalScrollContext, RiverOffsetContext } from "../../Contexts";
6
+ import {
7
+ HorizontalScrollContext,
8
+ RiverOffsetContext,
9
+ ScreenScrollingContext,
10
+ } from "../../Contexts";
11
+
7
12
  import { CellComponent } from "./Cell";
8
13
  import { TvOSCellComponent } from "./TvOSCellComponent";
9
14
  import { withConsumer } from "../../Contexts/HeaderOffsetContext";
10
- import { ScreenScrollingContext } from "../../Contexts/ScreenScrollingContext";
11
15
 
12
16
  import { ScreenLayoutContextConsumer } from "../../Contexts/ScreenLayoutContext";
13
17
  import { createContext } from "@applicaster/zapp-react-native-utils/reactUtils/createContext";
@@ -86,7 +86,7 @@ export function masterCellBuilder({
86
86
  entry: item,
87
87
  state: getEntryState(state, entryIsSelected),
88
88
  }),
89
- [state, item?.id, entryIsSelected] // Assuming that item won't mutate
89
+ [state, item, entryIsSelected] // Assuming that item won't mutate
90
90
  );
91
91
 
92
92
  const wrapperRef = React.useRef(null);
@@ -1,58 +1,28 @@
1
1
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
2
- import { StorageSingleValueProvider } from "@applicaster/zapp-react-native-utils/storage/StorageSingleSelectProvider";
2
+ import { StorageSingleValueProvider } from "@applicaster/zapp-react-native-bridge/ZappStorage/StorageSingleSelectProvider";
3
3
  import { PushTopicManager } from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
4
- import { StorageMultiSelectProvider } from "@applicaster/zapp-react-native-utils/storage/StorageMultiSelectProvider";
4
+ import { StorageMultiSelectProvider } from "@applicaster/zapp-react-native-bridge/ZappStorage/StorageMultiSelectProvider";
5
5
  import React, { useEffect } from "react";
6
6
  import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
7
7
  import { BehaviorSubject } from "rxjs";
8
8
  import { masterCellLogger } from "../logger";
9
9
  import get from "lodash/get";
10
- import { ScreenMultiSelectProvider } from "@applicaster/zapp-react-native-utils/storage/ScreenStateMultiSelectProvider";
11
- import { ScreenSingleValueProvider } from "@applicaster/zapp-react-native-utils/storage/ScreenSingleValueProvider";
12
- import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks";
13
- import { useScreenStateStore } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useScreenStateStore";
14
-
15
- const parseContextKey = (
16
- key: string,
17
- context: string = "ctx"
18
- ): string | null => {
19
- if (!key?.startsWith(`@{${context}/`)) return null;
20
-
21
- return key.substring(`@{${context}/`.length, key.length - 1);
10
+
11
+ const parseContextKey = (key: string): string | null => {
12
+ if (!key?.startsWith("@{ctx/")) return null;
13
+
14
+ return key.substring("@{ctx/".length, key.length - 1);
22
15
  };
23
16
 
24
17
  const getDataSourceProvider = (
25
- behavior: Behavior,
26
- screenRoute: string,
27
- screenStateStore: ScreenStateStore
18
+ behavior: Behavior
28
19
  ): BehaviorSubject<string[] | string> | null => {
29
20
  if (!behavior) return null;
30
21
 
31
22
  const selection = String(behavior.current_selection);
32
- const screenKey = parseContextKey(selection, "screen");
33
-
34
- if (screenKey) {
35
- if (behavior.select_mode === "multi") {
36
- return ScreenMultiSelectProvider.getProvider(
37
- screenKey,
38
- screenRoute,
39
- screenStateStore
40
- ).getObservable();
41
- }
42
-
43
- if (behavior.select_mode === "single") {
44
- return ScreenSingleValueProvider.getProvider(
45
- screenKey,
46
- screenRoute,
47
- screenStateStore
48
- ).getObservable();
49
- }
50
- }
51
-
52
23
  const contextKey = parseContextKey(selection);
53
24
 
54
25
  if (contextKey) {
55
- // TODO: Add storage scope to behavior
56
26
  if (behavior.select_mode === "multi") {
57
27
  return StorageMultiSelectProvider.getProvider(contextKey).getObservable();
58
28
  }
@@ -71,8 +41,6 @@ const getDataSourceProvider = (
71
41
 
72
42
  export const useBehaviorUpdate = (behavior: Behavior) => {
73
43
  const [lastUpdate, setLastUpdate] = React.useState<number | null>(null);
74
- const screenRoute = useRoute()?.pathname || "";
75
- const screenStateStore = useScreenStateStore();
76
44
  const player = usePlayer();
77
45
 
78
46
  const triggerUpdate = () => setLastUpdate(Date.now());
@@ -80,11 +48,7 @@ export const useBehaviorUpdate = (behavior: Behavior) => {
80
48
  useEffect(() => {
81
49
  if (!behavior) return;
82
50
 
83
- const dataSource = getDataSourceProvider(
84
- behavior,
85
- screenRoute,
86
- screenStateStore
87
- );
51
+ const dataSource = getDataSourceProvider(behavior);
88
52
 
89
53
  if (dataSource) {
90
54
  const subscription = dataSource.subscribe(triggerUpdate);
@@ -108,17 +72,10 @@ export const useBehaviorUpdate = (behavior: Behavior) => {
108
72
 
109
73
  // We cant use async in this function (its inside render),
110
74
  // so we rely on useBehaviorUpdate to update current value and trigger re-render
111
- export const isCellSelected = ({
112
- item,
113
- screenRoute,
114
- screenStateStore,
115
- behavior,
116
- }: {
117
- item: ZappEntry;
118
- screenRoute: string;
119
- screenStateStore: ScreenStateStore;
120
- behavior?: Behavior;
121
- }): boolean => {
75
+ export const isCellSelected = (
76
+ item: ZappEntry,
77
+ behavior?: Behavior
78
+ ): boolean => {
122
79
  if (!behavior) return false;
123
80
 
124
81
  const id = behavior.selector ? get(item, behavior.selector) : item.id;
@@ -142,32 +99,7 @@ export const isCellSelected = ({
142
99
  }
143
100
 
144
101
  const selection = String(behavior.current_selection);
145
-
146
- const screenKey = parseContextKey(selection, "screen");
147
-
148
- if (screenKey) {
149
- if (behavior.select_mode === "single") {
150
- const selectedItem = ScreenSingleValueProvider.getProvider(
151
- screenKey,
152
- screenRoute,
153
- screenStateStore
154
- ).getValue();
155
-
156
- return selectedItem === String(id);
157
- }
158
-
159
- if (behavior.select_mode === "multi") {
160
- const selectedItems = ScreenMultiSelectProvider.getProvider(
161
- screenKey,
162
- screenRoute,
163
- screenStateStore
164
- ).getSelectedItems();
165
-
166
- return selectedItems?.includes(String(id));
167
- }
168
- }
169
-
170
- const contextKey = parseContextKey(selection, "ctx");
102
+ const contextKey = parseContextKey(selection);
171
103
 
172
104
  if (contextKey) {
173
105
  if (behavior.select_mode === "single") {
@@ -8,8 +8,6 @@ import { masterCellLogger } from "../logger";
8
8
  import { getCellState } from "../../Cell/utils";
9
9
  import { getColorFromData } from "@applicaster/zapp-react-native-utils/cellUtils";
10
10
  import { isCellSelected, useBehaviorUpdate } from "./behaviorProvider";
11
- import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks";
12
- import { useScreenStateStore } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useScreenStateStore";
13
11
 
14
12
  const hasElementSpecificViewType = (viewType) => (element) => {
15
13
  if (R.isNil(element)) {
@@ -192,18 +190,8 @@ export const getFocusedButtonId = (focusable) => {
192
190
  });
193
191
  };
194
192
 
195
- export const isSelected = ({
196
- item,
197
- screenRoute,
198
- screenStateStore,
199
- behavior,
200
- }: {
201
- item: ZappEntry;
202
- screenRoute: string;
203
- screenStateStore: ScreenStateStore;
204
- behavior?: Behavior;
205
- }) => {
206
- return isCellSelected({ item, screenRoute, screenStateStore, behavior });
193
+ export const isSelected = (item: ZappEntry, behavior?: Behavior) => {
194
+ return isCellSelected(item, behavior);
207
195
  };
208
196
 
209
197
  export const useCellState = ({
@@ -216,17 +204,9 @@ export const useCellState = ({
216
204
  focused: boolean;
217
205
  }): CellState => {
218
206
  const lastUpdate = useBehaviorUpdate(behavior);
219
- const router = useRoute();
220
- const screenStateStore = useScreenStateStore();
221
207
 
222
208
  const _isSelected = useMemo(
223
- () =>
224
- isSelected({
225
- item,
226
- screenRoute: router?.pathname,
227
- screenStateStore,
228
- behavior,
229
- }),
209
+ () => isSelected(item, behavior),
230
210
  [behavior, item, lastUpdate]
231
211
  );
232
212
 
@@ -36,7 +36,6 @@ export function CurrentScreenContextProvider({
36
36
  screenData: NavigationScreenData;
37
37
  }) {
38
38
  const { pathname, isActive = false, screenData } = props;
39
- console.log("CurrentScreenContextProvider", { screenData });
40
39
 
41
40
  const [initialScreenData, setInitialScreenData] = React.useState(screenData);
42
41
 
@@ -4,8 +4,8 @@ which helps in detecting whether a given component is visible within the viewpor
4
4
  It is useful for implementing lazy loading or triggering specific actions when a component comes into view.
5
5
  */
6
6
 
7
- import React, { useEffect, useState, useRef, ReactNode, FC } from "react";
8
- import { View, Dimensions } from "react-native";
7
+ import React, { FC, ReactNode, useEffect, useRef, useState } from "react";
8
+ import { Dimensions, View } from "react-native";
9
9
  import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
10
10
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
11
11
 
@@ -78,7 +78,7 @@ const VisibilitySensorComponent: FC<Props> = ({
78
78
  };
79
79
 
80
80
  const stopWatching = () => {
81
- interval = clearInterval(interval);
81
+ clearInterval(interval);
82
82
  };
83
83
 
84
84
  const isInViewPort = () => {
@@ -1,10 +1,10 @@
1
1
  import {
2
- getColor,
3
2
  ACTIVE_COLOR,
4
3
  BACKGROUND_COLOR,
5
- MAIN_TEXT_COLOR,
6
4
  FOCUSED_TEXT_COLOR,
7
- } from "../../../colors/index";
5
+ getColor,
6
+ MAIN_TEXT_COLOR,
7
+ } from "../../../colors";
8
8
 
9
9
  const Image = "Image";
10
10
  const View = "View";
@@ -11,8 +11,6 @@ export const withScreenDataContextProvider = (Component: any) => {
11
11
  // use only initial activeRiver as this context should only be used for "Home", initial route
12
12
  const screenData = React.useMemo(() => ({ screen: activeRiver }), []);
13
13
 
14
- console.log("withScreenDataContextProvider", { screenData, activeRiver });
15
-
16
14
  return (
17
15
  <ScreenDataContext.Provider value={screenData}>
18
16
  <Component {...props} />
@@ -13,7 +13,6 @@ import {
13
13
  loadDatasources,
14
14
  usePipesContexts,
15
15
  } from "./utils";
16
- import { useScreenResolvers } from "@applicaster/zapp-react-native-utils/actionsExecutor/screenResolver";
17
16
 
18
17
  type RiverProps = {
19
18
  dispatch: DispatchProp;
@@ -26,7 +25,7 @@ export function WithRiverFeedLoader(Component: ZappComponent) {
26
25
  return function WrappedWithRiverFeedLoader(props: RiverProps) {
27
26
  const { river } = props;
28
27
  const { screenData, pathname } = useRoute();
29
- const resolvers = useScreenResolvers();
28
+
30
29
  const pipesContexts = usePipesContexts(river.id, pathname);
31
30
 
32
31
  const componentsToLoad = ignoreComponentsWithClearCacheFlag(
@@ -50,12 +49,7 @@ export function WithRiverFeedLoader(Component: ZappComponent) {
50
49
  item?.filter((item2) => item2 !== undefined)
51
50
  );
52
51
 
53
- loadDatasources(
54
- nonEmptyDataSources,
55
- river?.id,
56
- props.dispatch,
57
- resolvers
58
- );
52
+ loadDatasources(nonEmptyDataSources, river?.id, props.dispatch);
59
53
  }, []);
60
54
 
61
55
  return <Component {...props} />;
@@ -12,16 +12,11 @@ export { getDatasourceUrl } from "./getDatasourceUrl";
12
12
 
13
13
  export const DATASOURCE_CHUNKS = 10;
14
14
 
15
- export async function loadDatasources(
16
- urls: string[][],
17
- riverId,
18
- dispatch,
19
- resolvers
20
- ) {
15
+ export async function loadDatasources(urls: string[][], riverId, dispatch) {
21
16
  return reducePromises<string, void>(
22
17
  mapPromises<string, void>((url) => {
23
18
  if (url) {
24
- return dispatch(loadPipesData(url, { riverId, resolvers }));
19
+ return dispatch(loadPipesData(url, { riverId }));
25
20
  }
26
21
  }),
27
22
  undefined,
@@ -19,11 +19,7 @@ import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-compon
19
19
  import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
20
20
 
21
21
  import { isVerticalListOrGrid } from "./utils";
22
- import {
23
- subscribeForUrlContextKeyChanges,
24
- subscribeForUrlScreenKeyChanges,
25
- } from "@applicaster/zapp-pipes-v2-client";
26
- import { useScreenStateStore } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useScreenStateStore";
22
+ import { subscribeForUrlContextKeyChanges } from "@applicaster/zapp-pipes-v2-client";
27
23
 
28
24
  type Props = {
29
25
  component: ZappUIComponent;
@@ -208,9 +204,7 @@ export function zappPipesDataConnector(
208
204
  Component: React.FC<any> | React.ComponentClass<any>
209
205
  ) {
210
206
  return function WrappedWithZappPipesData(props: Props) {
211
- const { screenData, pathname } = useRoute();
212
- const screenStateStore = useScreenStateStore();
213
-
207
+ const { screenData } = useRoute();
214
208
  const { plugins } = usePickFromState(["plugins"]);
215
209
 
216
210
  const screenContextData = useScreenContext();
@@ -292,18 +286,6 @@ export function zappPipesDataConnector(
292
286
  componentIndex
293
287
  );
294
288
 
295
- useEffect(() => {
296
- if (!(dataSourceUrl?.includes("pipesv2://") && reloadData)) {
297
- return subscribeForUrlScreenKeyChanges(
298
- dataSourceUrl,
299
- pathname,
300
- screenStateStore,
301
- {},
302
- reloadData
303
- );
304
- }
305
- }, [dataSourceUrl, reloadData]);
306
-
307
289
  useEffect(() => {
308
290
  if (dataSourceUrl?.includes("pipesv2://") && reloadData) {
309
291
  const addListener = getListenerFromPlugin(dataSourceUrl, plugins);
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.7900711229",
3
+ "version": "14.0.0-alpha.8419134002",
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",
@@ -31,10 +31,10 @@
31
31
  "redux-mock-store": "^1.5.3"
32
32
  },
33
33
  "dependencies": {
34
- "@applicaster/applicaster-types": "14.0.0-alpha.7900711229",
35
- "@applicaster/zapp-react-native-bridge": "14.0.0-alpha.7900711229",
36
- "@applicaster/zapp-react-native-redux": "14.0.0-alpha.7900711229",
37
- "@applicaster/zapp-react-native-utils": "14.0.0-alpha.7900711229",
34
+ "@applicaster/applicaster-types": "14.0.0-alpha.8419134002",
35
+ "@applicaster/zapp-react-native-bridge": "14.0.0-alpha.8419134002",
36
+ "@applicaster/zapp-react-native-redux": "14.0.0-alpha.8419134002",
37
+ "@applicaster/zapp-react-native-utils": "14.0.0-alpha.8419134002",
38
38
  "promise": "^8.3.0",
39
39
  "url": "^0.11.0",
40
40
  "uuid": "^3.3.2"