@applicaster/zapp-react-native-ui-components 15.1.0 → 15.1.1

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.
@@ -16,6 +16,7 @@ import { useShallow } from "zustand/react/shallow";
16
16
  import { useScreenContextV2 } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
17
17
  import { useSafeAreaInsets } from "react-native-safe-area-context";
18
18
  import { useLoadPipesDataDispatch } from "@applicaster/zapp-react-native-utils/reactHooks";
19
+ import { useGetUrlInflater } from "@applicaster/zapp-react-native-utils/reactHooks/feed/useInflatedUrl";
19
20
 
20
21
  const BRIGHTNESS_THRESHOLD = 160;
21
22
  const ABOVE_DEFAULT_COLOR = "gray";
@@ -64,35 +65,51 @@ export const usePullToRefresh = (
64
65
 
65
66
  const [refreshing, setRefreshing] = React.useState(false);
66
67
 
67
- const feeds: string[] = React.useMemo(
68
+ const feedSources = React.useMemo(
68
69
  () =>
69
70
  (riverComponents || [])
70
- .map((riverComponent) => path(["data", "source"], riverComponent))
71
- .filter((feed) => !isNilOrEmpty(feed)),
71
+ .map((riverComponent) => ({
72
+ source: path(["data", "source"], riverComponent),
73
+ mapping: path(["data", "mapping"], riverComponent),
74
+ }))
75
+ .filter(({ source }) => !isNilOrEmpty(source)),
72
76
  [riverComponents]
73
77
  );
74
78
 
75
- const feedsLength = feeds.length;
79
+ const feedsLength = feedSources.length;
76
80
 
77
81
  const [requestsCompletedCounter, setRequestsCompletedCounter] =
78
82
  React.useState(0);
79
83
 
80
84
  const loadPipesDataDispatcher = useLoadPipesDataDispatch();
85
+ const urlInflater = useGetUrlInflater();
81
86
 
82
87
  React.useEffect(() => {
83
88
  // will not work for pipes v1 on 1st level screens
84
89
  if (refreshing && !isPipesV1) {
85
- feeds.forEach((feed) => {
86
- loadPipesDataDispatcher(feed, {
87
- silentRefresh: true,
88
- clearCache: true,
89
- callback: () => {
90
- setRequestsCompletedCounter(R.inc);
91
- },
92
- });
90
+ feedSources.forEach(({ source, mapping }) => {
91
+ const inflatedUrl = urlInflater(source, mapping);
92
+
93
+ if (inflatedUrl) {
94
+ loadPipesDataDispatcher(inflatedUrl, {
95
+ silentRefresh: true,
96
+ clearCache: true,
97
+ callback: () => {
98
+ setRequestsCompletedCounter(R.inc);
99
+ },
100
+ });
101
+ } else {
102
+ setRequestsCompletedCounter(R.inc);
103
+ }
93
104
  });
94
105
  }
95
- }, [refreshing, isPipesV1, feeds, loadPipesDataDispatcher]);
106
+ }, [
107
+ refreshing,
108
+ isPipesV1,
109
+ feedSources,
110
+ loadPipesDataDispatcher,
111
+ urlInflater,
112
+ ]);
96
113
 
97
114
  React.useEffect(() => {
98
115
  if (requestsCompletedCounter === feedsLength) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "15.1.0",
3
+ "version": "15.1.1",
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",
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "15.1.0",
32
- "@applicaster/zapp-react-native-bridge": "15.1.0",
33
- "@applicaster/zapp-react-native-redux": "15.1.0",
34
- "@applicaster/zapp-react-native-utils": "15.1.0",
31
+ "@applicaster/applicaster-types": "15.1.1",
32
+ "@applicaster/zapp-react-native-bridge": "15.1.1",
33
+ "@applicaster/zapp-react-native-redux": "15.1.1",
34
+ "@applicaster/zapp-react-native-utils": "15.1.1",
35
35
  "fast-json-stable-stringify": "^2.1.0",
36
36
  "promise": "^8.3.0",
37
37
  "url": "^0.11.0",