@applicaster/zapp-react-native-utils 13.0.0-rc.3 → 13.0.0-rc.5
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.
|
@@ -169,8 +169,12 @@ export class PlayerManager {
|
|
|
169
169
|
this.addPlayer(id, playerController);
|
|
170
170
|
|
|
171
171
|
if (playerController.playerRole === PlayerRole.Primary) {
|
|
172
|
-
if (
|
|
173
|
-
RNPlayerManager
|
|
172
|
+
if (RNPlayerManager) {
|
|
173
|
+
Object.keys(RNPlayerManager).forEach((pluginId) => {
|
|
174
|
+
if (pluginId !== playerController.playerPluginId) {
|
|
175
|
+
RNPlayerManager[pluginId].stopBackgroundPlayback?.();
|
|
176
|
+
}
|
|
177
|
+
});
|
|
174
178
|
}
|
|
175
179
|
|
|
176
180
|
playerController.addListener({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "13.0.0-rc.
|
|
3
|
+
"version": "13.0.0-rc.5",
|
|
4
4
|
"description": "Applicaster Zapp React Native utilities package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "13.0.0-rc.
|
|
31
|
+
"@applicaster/applicaster-types": "13.0.0-rc.5",
|
|
32
32
|
"buffer": "^5.2.1",
|
|
33
33
|
"camelize": "^1.0.0",
|
|
34
34
|
"create-react-context": "^0.2.3",
|
|
@@ -135,7 +135,11 @@ describe("useFeedLoader", () => {
|
|
|
135
135
|
);
|
|
136
136
|
|
|
137
137
|
expect(result.current.data).toBeNull();
|
|
138
|
-
|
|
138
|
+
|
|
139
|
+
expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
|
|
140
|
+
clearCache: true,
|
|
141
|
+
riverId: undefined,
|
|
142
|
+
});
|
|
139
143
|
|
|
140
144
|
const store2 = mockStore({
|
|
141
145
|
plugins: [],
|
|
@@ -172,7 +176,11 @@ describe("useFeedLoader", () => {
|
|
|
172
176
|
);
|
|
173
177
|
|
|
174
178
|
expect(result.current.data).toBeNull();
|
|
175
|
-
|
|
179
|
+
|
|
180
|
+
expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
|
|
181
|
+
clearCache: true,
|
|
182
|
+
riverId: undefined,
|
|
183
|
+
});
|
|
176
184
|
|
|
177
185
|
const store2 = mockStore({
|
|
178
186
|
plugins: [],
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { path } from "ramda";
|
|
3
2
|
import { useDispatch } from "react-redux";
|
|
4
3
|
|
|
5
4
|
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
6
5
|
import { useZappPipesFeed } from "@applicaster/zapp-react-native-redux/hooks";
|
|
7
6
|
|
|
8
7
|
import { reactHooksLogger } from "../logger";
|
|
9
|
-
import { useIsInitialRender } from "../utils";
|
|
8
|
+
import { useIsInitialRender, shouldDispatchData } from "../utils";
|
|
10
9
|
import { useInflatedUrl } from "./useInflatedUrl";
|
|
11
10
|
import { useRoute } from "../navigation";
|
|
12
11
|
|
|
@@ -56,8 +55,6 @@ export const useFeedLoader = ({
|
|
|
56
55
|
|
|
57
56
|
const currentFeed = useZappPipesFeed(callableFeedUrl);
|
|
58
57
|
|
|
59
|
-
const cachedFeed = React.useMemo(() => path(["data"])(currentFeed), []);
|
|
60
|
-
|
|
61
58
|
const riverId = screenData?.id;
|
|
62
59
|
|
|
63
60
|
const reloadData = React.useCallback<ReloadDataFunction>(
|
|
@@ -92,11 +89,18 @@ export const useFeedLoader = ({
|
|
|
92
89
|
}
|
|
93
90
|
}, [callableFeedUrl, currentFeed?.data]);
|
|
94
91
|
|
|
95
|
-
// If feed doesn't exist, load it
|
|
96
92
|
useEffect(() => {
|
|
97
|
-
if (
|
|
93
|
+
if (
|
|
94
|
+
shouldDispatchData(callableFeedUrl, currentFeed, pipesOptions.clearCache)
|
|
95
|
+
) {
|
|
98
96
|
if (callableFeedUrl) {
|
|
99
|
-
dispatch(
|
|
97
|
+
dispatch(
|
|
98
|
+
loadPipesData(callableFeedUrl, {
|
|
99
|
+
...pipesOptions,
|
|
100
|
+
clearCache: true,
|
|
101
|
+
riverId,
|
|
102
|
+
})
|
|
103
|
+
);
|
|
100
104
|
} else {
|
|
101
105
|
logger.info({
|
|
102
106
|
message:
|
|
@@ -30,3 +30,16 @@ export const useIsInitialRender = (): boolean => {
|
|
|
30
30
|
|
|
31
31
|
return isInitialRenderRef.current;
|
|
32
32
|
};
|
|
33
|
+
|
|
34
|
+
export const checkIsLocalFeed = (feedUrl) => feedUrl?.startsWith("pipesv2://");
|
|
35
|
+
|
|
36
|
+
export const shouldDispatchData = (
|
|
37
|
+
url: string,
|
|
38
|
+
feed: ZappPipesData | null,
|
|
39
|
+
clearCache: boolean
|
|
40
|
+
) => {
|
|
41
|
+
const currentFeedHasData = feed?.data;
|
|
42
|
+
const isLocalFeed = checkIsLocalFeed(url);
|
|
43
|
+
|
|
44
|
+
return !currentFeedHasData || clearCache || isLocalFeed;
|
|
45
|
+
};
|