@applicaster/zapp-react-native-utils 15.0.0-alpha.8680244503 → 15.0.0-alpha.9102777840
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/README.md +0 -6
- package/adsUtils/__tests__/createVMAP.test.ts +419 -0
- package/analyticsUtils/analyticsMapper.ts +10 -2
- package/appDataUtils/__tests__/urlScheme.test.ts +678 -0
- package/appUtils/HooksManager/__tests__/__snapshots__/hooksManager.test.js.snap +0 -188
- package/appUtils/HooksManager/__tests__/hooksManager.test.js +16 -2
- package/appUtils/RiverFocusManager/{index.js → index.ts} +25 -18
- package/appUtils/accessibilityManager/__tests__/utils.test.ts +360 -0
- package/appUtils/accessibilityManager/utils.ts +25 -5
- package/appUtils/contextKeysManager/__tests__/getKeys/failure.test.ts +7 -2
- package/appUtils/contextKeysManager/__tests__/getKeys/success.test.ts +48 -0
- package/appUtils/contextKeysManager/contextResolver.ts +51 -22
- package/appUtils/contextKeysManager/index.ts +65 -10
- package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +3 -0
- package/appUtils/focusManager/index.ios.ts +43 -4
- package/appUtils/focusManager/treeDataStructure/Tree/__tests__/Tree.test.js +46 -0
- package/appUtils/focusManager/treeDataStructure/Tree/index.js +18 -18
- package/appUtils/focusManagerAux/utils/index.ios.ts +122 -0
- package/appUtils/focusManagerAux/utils/index.ts +3 -5
- package/appUtils/focusManagerAux/utils/utils.ios.ts +202 -3
- package/appUtils/playerManager/playerNative.ts +2 -1
- package/cloudEventsUtils/__tests__/index.test.ts +529 -0
- package/cloudEventsUtils/index.ts +65 -1
- package/configurationUtils/__tests__/imageSrcFromMediaItem.test.ts +38 -0
- package/configurationUtils/index.ts +17 -11
- package/dateUtils/__tests__/dayjs.test.ts +330 -0
- package/enumUtils/__tests__/getEnumKeyByEnumValue.test.ts +207 -0
- package/errorUtils/__tests__/GeneralError.test.ts +97 -0
- package/errorUtils/__tests__/HttpStatusCode.test.ts +344 -0
- package/errorUtils/__tests__/MissingPluginError.test.ts +113 -0
- package/errorUtils/__tests__/NetworkError.test.ts +202 -0
- package/errorUtils/__tests__/getParsedResponse.test.ts +188 -0
- package/errorUtils/__tests__/invariant.test.ts +112 -0
- package/focusManager/aux/index.ts +1 -1
- package/headersUtils/__tests__/headersUtils.test.js +11 -1
- package/headersUtils/index.ts +2 -1
- package/manifestUtils/defaultManifestConfigurations/player.js +40 -10
- package/manifestUtils/platformIsTV.js +13 -0
- package/navigationUtils/index.ts +15 -5
- package/numberUtils/__tests__/toNumber.test.ts +27 -0
- package/numberUtils/__tests__/toPositiveNumber.test.ts +193 -0
- package/numberUtils/index.ts +23 -1
- package/package.json +4 -4
- package/reactHooks/analytics/__tests__/useSendAnalyticsOnPress.test.ts +537 -0
- package/reactHooks/app/__tests__/useAppState.test.ts +1 -1
- package/reactHooks/autoscrolling/__tests__/useTrackCurrentAutoScrollingElement.test.ts +1 -1
- package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +1 -2
- package/reactHooks/cell-click/__tests__/index.test.js +1 -3
- package/reactHooks/configuration/__tests__/index.test.tsx +1 -1
- package/reactHooks/connection/__tests__/index.test.js +1 -1
- package/reactHooks/dev/__tests__/useReRenderLog.test.ts +188 -0
- package/reactHooks/device/useIsTablet.tsx +14 -19
- package/reactHooks/events/index.ts +20 -0
- package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +32 -23
- package/reactHooks/feed/__tests__/useBuildPipesUrl.test.tsx +19 -19
- package/reactHooks/feed/__tests__/useEntryScreenId.test.tsx +1 -1
- package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +42 -30
- package/reactHooks/feed/__tests__/{useInflatedUrl.test.ts → useInflatedUrl.test.tsx} +62 -7
- package/reactHooks/feed/index.ts +0 -2
- package/reactHooks/feed/useInflatedUrl.ts +43 -17
- package/reactHooks/hookModal/hooks/useHookModalScreenData.ts +12 -8
- package/reactHooks/index.ts +2 -0
- package/reactHooks/layout/__tests__/index.test.tsx +1 -1
- package/reactHooks/layout/__tests__/useLayoutVersion.test.tsx +1 -1
- package/reactHooks/navigation/__tests__/index.test.tsx +40 -9
- package/reactHooks/navigation/index.ts +19 -4
- package/reactHooks/navigation/useRoute.ts +3 -1
- package/reactHooks/player/__tests__/useAutoSeek._test.tsx +1 -1
- package/reactHooks/player/__tests__/useTapSeek._test.ts +1 -1
- package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +1 -1
- package/reactHooks/resolvers/__tests__/useComponentResolver.test.tsx +1 -1
- package/reactHooks/screen/__tests__/useCurrentScreenData.test.tsx +2 -2
- package/reactHooks/screen/__tests__/useScreenBackgroundColor.test.tsx +1 -1
- package/reactHooks/screen/__tests__/useScreenData.test.tsx +1 -1
- package/reactHooks/screen/__tests__/useTargetScreenData.test.tsx +2 -2
- package/reactHooks/state/__tests__/useComponentScreenState.test.ts +246 -0
- package/reactHooks/state/index.ts +2 -0
- package/reactHooks/state/useComponentScreenState.ts +45 -0
- package/reactHooks/state/useRefWithInitialValue.ts +10 -0
- package/reactHooks/ui/__tests__/useFadeOutWhenBlurred.test.ts +580 -0
- package/reactHooks/utils/__tests__/index.test.js +1 -1
- package/rectUtils/__tests__/index.test.ts +549 -0
- package/rectUtils/index.ts +2 -2
- package/refreshUtils/RefreshCoordinator/__tests__/refreshCoordinator.test.ts +161 -0
- package/refreshUtils/RefreshCoordinator/index.ts +216 -0
- package/refreshUtils/RefreshCoordinator/utils/__tests__/getDataRefreshConfig.test.ts +104 -0
- package/refreshUtils/RefreshCoordinator/utils/index.ts +29 -0
- package/screenPickerUtils/__tests__/index.test.ts +333 -0
- package/screenPickerUtils/index.ts +5 -0
- package/screenState/__tests__/index.test.ts +1 -1
- package/screenUtils/index.ts +3 -0
- package/searchUtils/const.ts +7 -0
- package/searchUtils/index.ts +3 -0
- package/services/storageServiceSync.web.ts +1 -1
- package/stringUtils/index.ts +1 -1
- package/testUtils/index.tsx +1 -1
- package/time/__tests__/BackgroundTimer.test.ts +156 -0
- package/time/__tests__/Timer.test.ts +236 -0
- package/typeGuards/__tests__/isString.test.ts +21 -0
- package/typeGuards/index.ts +4 -0
- package/utils/__tests__/clone.test.ts +158 -0
- package/utils/__tests__/mergeRight.test.ts +48 -0
- package/utils/__tests__/path.test.ts +7 -0
- package/utils/clone.ts +7 -0
- package/utils/index.ts +12 -1
- package/utils/mergeRight.ts +5 -0
- package/utils/path.ts +6 -3
- package/utils/pathOr.ts +5 -1
- package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +19 -5
- package/zappFrameworkUtils/HookCallback/hookCallbackManifestExtensions.config.js +1 -1
- package/reactHooks/componentsMap/index.ts +0 -55
- package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +0 -75
- package/reactHooks/feed/useFeedRefresh.tsx +0 -65
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { WrappedWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
getInflatedDataSourceUrl,
|
|
7
|
+
getSearchContext,
|
|
8
|
+
useGetUrlInflater,
|
|
9
|
+
} from "../useInflatedUrl";
|
|
10
|
+
|
|
11
|
+
import { reactHooksLogger } from "../../logger";
|
|
12
|
+
|
|
13
|
+
jest.mock("../../navigation", () => ({
|
|
14
|
+
useRoute: () => ({ pathname: "/mock/path" }),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
// mock contexts hooks
|
|
18
|
+
jest.mock("@applicaster/zapp-react-native-ui-components/Contexts", () => ({
|
|
19
|
+
ZappPipesEntryContext: {
|
|
20
|
+
useZappPipesContext: () => [
|
|
21
|
+
{ id: "entry-1", extensions: { showId: "A123" } },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
ZappPipesSearchContext: {
|
|
25
|
+
useZappPipesContext: () => ["user%20query"],
|
|
26
|
+
},
|
|
27
|
+
ZappPipesScreenContext: {
|
|
28
|
+
useZappPipesContext: () => [{ id: "screen-1" }],
|
|
29
|
+
},
|
|
30
|
+
}));
|
|
31
|
+
|
|
1
32
|
jest.mock("../../logger", () => ({
|
|
2
33
|
reactHooksLogger: {
|
|
3
34
|
warning: jest.fn(),
|
|
@@ -5,13 +36,6 @@ jest.mock("../../logger", () => ({
|
|
|
5
36
|
},
|
|
6
37
|
}));
|
|
7
38
|
|
|
8
|
-
const {
|
|
9
|
-
getInflatedDataSourceUrl,
|
|
10
|
-
getSearchContext,
|
|
11
|
-
} = require("../useInflatedUrl");
|
|
12
|
-
|
|
13
|
-
const { reactHooksLogger } = require("../../logger");
|
|
14
|
-
|
|
15
39
|
let mockStore;
|
|
16
40
|
|
|
17
41
|
describe("getInflatedDataSourceUrl", () => {
|
|
@@ -188,3 +212,34 @@ describe("getSearchContext", () => {
|
|
|
188
212
|
expect(result).toHaveProperty(mapping.queryParam.property, searchContext);
|
|
189
213
|
});
|
|
190
214
|
});
|
|
215
|
+
|
|
216
|
+
describe("useGetUrlInflater", () => {
|
|
217
|
+
const { renderHook } = require("@testing-library/react-native");
|
|
218
|
+
|
|
219
|
+
it("returns original url when mapping is not provided", () => {
|
|
220
|
+
const { result } = renderHook(() => useGetUrlInflater(), {
|
|
221
|
+
wrapper: WrappedWithProviders,
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
const src = "https://foo.com/feed";
|
|
225
|
+
expect(result.current(src)).toBe(src);
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
it("inflates url using entry/search/screen contexts when mapping provided", () => {
|
|
229
|
+
const { result } = renderHook(() => useGetUrlInflater(), {
|
|
230
|
+
wrapper: ({ children }) => (
|
|
231
|
+
<WrappedWithProviders>{children}</WrappedWithProviders>
|
|
232
|
+
),
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
const source = "https://foo.com/shows/{{showId}}?q={{q}}";
|
|
236
|
+
|
|
237
|
+
const mapping = {
|
|
238
|
+
showId: { source: "entry", property: "extensions.showId" },
|
|
239
|
+
q: { source: "search", property: "q" },
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const url = result.current(source, mapping);
|
|
243
|
+
expect(url).toBe("https://foo.com/shows/A123?q=user%20query");
|
|
244
|
+
});
|
|
245
|
+
});
|
package/reactHooks/feed/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
1
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -169,7 +169,7 @@ const encodeIfNeeded: (string) => string = R.tryCatch(
|
|
|
169
169
|
|
|
170
170
|
export function getSearchContext(
|
|
171
171
|
searchContext: string,
|
|
172
|
-
mapping: ZappTypeMapping
|
|
172
|
+
mapping: Nullable<ZappTypeMapping>
|
|
173
173
|
) {
|
|
174
174
|
if (!mapping) {
|
|
175
175
|
return {};
|
|
@@ -183,31 +183,57 @@ export function getSearchContext(
|
|
|
183
183
|
return { [property]: encodeIfNeeded(searchContext) };
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
mapping?: ZappTypeMapping;
|
|
192
|
-
}) {
|
|
186
|
+
/**
|
|
187
|
+
* Hook returns a function that replace placeholders with context values
|
|
188
|
+
* @returns function that inflates urls based on contexts
|
|
189
|
+
*/
|
|
190
|
+
export const useGetUrlInflater = () => {
|
|
193
191
|
const { pathname } = useRoute();
|
|
194
192
|
|
|
195
193
|
const [entryContext] = ZappPipesEntryContext.useZappPipesContext(pathname);
|
|
196
194
|
const [searchContext] = ZappPipesSearchContext.useZappPipesContext();
|
|
197
195
|
const [screenContext] = ZappPipesScreenContext.useZappPipesContext();
|
|
198
196
|
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
197
|
+
const entryContextRef = useRef(entryContext);
|
|
198
|
+
entryContextRef.current = entryContext;
|
|
199
|
+
|
|
200
|
+
const screenContextRef = useRef(screenContext);
|
|
201
|
+
screenContextRef.current = screenContext;
|
|
202
|
+
|
|
203
|
+
const searchContextRef = useRef(searchContext);
|
|
204
|
+
searchContextRef.current = searchContext;
|
|
205
|
+
|
|
206
|
+
return useCallback(
|
|
207
|
+
(
|
|
208
|
+
feedUrl: Nullable<string>,
|
|
209
|
+
mapping?: Nullable<ZappTypeMapping>
|
|
210
|
+
): Nullable<string> => {
|
|
211
|
+
return getInflatedDataSourceUrl({
|
|
202
212
|
source: feedUrl,
|
|
203
213
|
contexts: {
|
|
204
|
-
entry:
|
|
205
|
-
screen:
|
|
206
|
-
search: getSearchContext(
|
|
214
|
+
entry: entryContextRef.current,
|
|
215
|
+
screen: screenContextRef.current,
|
|
216
|
+
search: getSearchContext(searchContextRef.current, mapping),
|
|
207
217
|
},
|
|
208
218
|
mapping,
|
|
209
|
-
})
|
|
210
|
-
|
|
219
|
+
});
|
|
220
|
+
},
|
|
221
|
+
[]
|
|
222
|
+
);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
export function useInflatedUrl({
|
|
226
|
+
feedUrl,
|
|
227
|
+
mapping,
|
|
228
|
+
}: {
|
|
229
|
+
feedUrl?: string;
|
|
230
|
+
mapping?: ZappTypeMapping;
|
|
231
|
+
}) {
|
|
232
|
+
const urlInflater = useGetUrlInflater();
|
|
233
|
+
|
|
234
|
+
const url = useMemo(
|
|
235
|
+
() => urlInflater(feedUrl, mapping),
|
|
236
|
+
[urlInflater, feedUrl, mapping]
|
|
211
237
|
);
|
|
212
238
|
|
|
213
239
|
return url;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { reactHooksLogger } from "../../logger";
|
|
2
|
-
import {
|
|
2
|
+
import { useZappHookModalStore } from "@applicaster/zapp-react-native-ui-components/Contexts/ZappHookModalContext";
|
|
3
3
|
|
|
4
4
|
const logger = reactHooksLogger.addSubsystem("useHookModalScreenData");
|
|
5
5
|
|
|
6
6
|
type VariousScreenData = LegacyNavigationScreenData | ZappRiver | ZappEntry;
|
|
7
7
|
|
|
8
|
-
export const useHookModalScreenData = (
|
|
9
|
-
|
|
8
|
+
export const useHookModalScreenData = (
|
|
9
|
+
skipSubscription: boolean
|
|
10
|
+
): VariousScreenData | undefined => {
|
|
11
|
+
const hookModalState = useZappHookModalStore((state) =>
|
|
12
|
+
skipSubscription ? undefined : state.state
|
|
13
|
+
);
|
|
10
14
|
|
|
11
|
-
if (!hookModalState
|
|
15
|
+
if (!hookModalState?.screenData) {
|
|
12
16
|
return;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
try {
|
|
16
|
-
const screenData = hookModalState.
|
|
17
|
-
const hookPlugin = hookModalState.
|
|
20
|
+
const screenData = hookModalState.screenData?.payload;
|
|
21
|
+
const hookPlugin = hookModalState.screenData.hookPlugin;
|
|
18
22
|
|
|
19
23
|
if (hookPlugin?.screen_id) {
|
|
20
24
|
return {
|
|
@@ -23,7 +27,7 @@ export const useHookModalScreenData = (): VariousScreenData | undefined => {
|
|
|
23
27
|
};
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
return hookModalState.
|
|
30
|
+
return hookModalState.screenData?.payload;
|
|
27
31
|
} catch (error) {
|
|
28
32
|
logger.error({
|
|
29
33
|
message: "Hook modal screen data creation failed",
|
|
@@ -34,6 +38,6 @@ export const useHookModalScreenData = (): VariousScreenData | undefined => {
|
|
|
34
38
|
jsOnly: true,
|
|
35
39
|
});
|
|
36
40
|
|
|
37
|
-
return hookModalState.
|
|
41
|
+
return hookModalState.screenData?.payload;
|
|
38
42
|
}
|
|
39
43
|
};
|
package/reactHooks/index.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
|
|
3
|
-
import { renderHook } from "@testing-library/react-
|
|
3
|
+
import { renderHook } from "@testing-library/react-native";
|
|
4
4
|
import { isNavBarVisible, useRoute } from "../";
|
|
5
5
|
import { Provider } from "react-redux";
|
|
6
6
|
import configureMockStore from "redux-mock-store";
|
|
7
7
|
import { NavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/NavigationContext";
|
|
8
|
-
import { ZappHookModalContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
|
|
9
8
|
import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/routeTypes";
|
|
10
9
|
import { ScreenDataContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenDataContext";
|
|
11
10
|
|
|
@@ -83,10 +82,44 @@ const hookModalContextState = {
|
|
|
83
82
|
},
|
|
84
83
|
setState: jest.fn(),
|
|
85
84
|
resetState: jest.fn(),
|
|
85
|
+
hookPresentationMode: null,
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
const hooksModalPathname = `${ROUTE_TYPES.HOOKS_MODAL}/${hookModalContextState.state.screenData.payload.id}`;
|
|
89
89
|
const videoModalPathname = `${ROUTE_TYPES.VIDEO_MODAL}/${videoModalNavigator.videoModalState.item.id}`;
|
|
90
|
+
|
|
91
|
+
jest.mock(
|
|
92
|
+
"@applicaster/zapp-react-native-ui-components/Contexts/ZappHookModalContext",
|
|
93
|
+
() => {
|
|
94
|
+
const mockState = {
|
|
95
|
+
isRunningInBackground: false,
|
|
96
|
+
setIsRunningInBackground: jest.fn(),
|
|
97
|
+
setIsPresentingFullScreen: jest.fn(),
|
|
98
|
+
isPresentationFullScreen: true,
|
|
99
|
+
isHooksExecutionInProgress: true,
|
|
100
|
+
setIsHooksExecutionInProgress: jest.fn(),
|
|
101
|
+
state: {
|
|
102
|
+
path: "/home",
|
|
103
|
+
screenData: { payload: { id: "hookExecutedInModal" } },
|
|
104
|
+
},
|
|
105
|
+
setState: jest.fn(),
|
|
106
|
+
resetState: jest.fn(),
|
|
107
|
+
hookPresentationMode: null,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const mockHook = jest.fn((selector) => {
|
|
111
|
+
return selector ? selector(mockState) : mockState;
|
|
112
|
+
}) as jest.MockedFunction<any> & { getState: () => typeof mockState };
|
|
113
|
+
|
|
114
|
+
mockHook.getState = jest.fn(() => mockState);
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
useZappHookModalStore: mockHook,
|
|
118
|
+
zappHookModalStore: mockHook,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
|
|
90
123
|
const mockStore = configureMockStore();
|
|
91
124
|
|
|
92
125
|
const store = mockStore({
|
|
@@ -125,13 +158,11 @@ const videoModalWrapper = ({ children }) => (
|
|
|
125
158
|
|
|
126
159
|
const hookModalWrapper = ({ children }) => (
|
|
127
160
|
<Provider store={store}>
|
|
128
|
-
<
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
</NavigationContext.Provider>
|
|
134
|
-
</ZappHookModalContext.ReactContext.Provider>
|
|
161
|
+
<NavigationContext.Provider value={hookModalNavigator}>
|
|
162
|
+
<PathnameContext.Provider value={hooksModalPathname}>
|
|
163
|
+
{children}
|
|
164
|
+
</PathnameContext.Provider>
|
|
165
|
+
</NavigationContext.Provider>
|
|
135
166
|
</Provider>
|
|
136
167
|
);
|
|
137
168
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
2
2
|
import { BackHandler } from "react-native";
|
|
3
|
+
import { shallow } from "zustand/shallow";
|
|
3
4
|
|
|
4
5
|
import {
|
|
5
6
|
useContentTypes,
|
|
@@ -8,13 +9,13 @@ import {
|
|
|
8
9
|
import { HooksManager } from "@applicaster/zapp-react-native-utils/appUtils/HooksManager";
|
|
9
10
|
|
|
10
11
|
import { LONG_KEY_PRESS_TIMEOUT } from "@applicaster/quick-brick-core/const";
|
|
11
|
-
import {
|
|
12
|
-
import { HookModalContextT } from "@applicaster/zapp-react-native-ui-components/Contexts/ZappHookModalContext";
|
|
12
|
+
import { useZappHookModalStore } from "@applicaster/zapp-react-native-ui-components/Contexts/ZappHookModalContext";
|
|
13
13
|
import { HOOKS_EVENTS } from "../../appUtils/HooksManager/constants";
|
|
14
14
|
import { getRiverFromRoute, getTargetRoute } from "../../navigationUtils";
|
|
15
15
|
import { useConnectionInfo } from "../connection";
|
|
16
16
|
|
|
17
17
|
import { isTV, isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
18
|
+
import { pick } from "@applicaster/zapp-react-native-utils/utils";
|
|
18
19
|
import { useNavbarState } from "../screen";
|
|
19
20
|
import { useRivers } from "../state";
|
|
20
21
|
import { useLayoutVersion } from "../layout";
|
|
@@ -88,6 +89,10 @@ export function isNavBarVisible(
|
|
|
88
89
|
if (route.startsWith("/hooks/")) {
|
|
89
90
|
const module = screenData?.module;
|
|
90
91
|
|
|
92
|
+
if (module === undefined) {
|
|
93
|
+
return showNavBar;
|
|
94
|
+
}
|
|
95
|
+
|
|
91
96
|
if (module?.presentFullScreen) {
|
|
92
97
|
return false;
|
|
93
98
|
}
|
|
@@ -164,7 +169,17 @@ export const useZappHooksForEntry = (
|
|
|
164
169
|
setIsHooksExecutionInProgress,
|
|
165
170
|
setIsPresentingFullScreen,
|
|
166
171
|
setIsRunningInBackground,
|
|
167
|
-
}
|
|
172
|
+
} = useZappHookModalStore(
|
|
173
|
+
(state) =>
|
|
174
|
+
pick(state, [
|
|
175
|
+
"setState",
|
|
176
|
+
"resetState",
|
|
177
|
+
"setIsHooksExecutionInProgress",
|
|
178
|
+
"setIsPresentingFullScreen",
|
|
179
|
+
"setIsRunningInBackground",
|
|
180
|
+
]),
|
|
181
|
+
shallow
|
|
182
|
+
);
|
|
168
183
|
|
|
169
184
|
const plugins = usePlugins();
|
|
170
185
|
const rivers = useRivers();
|
|
@@ -54,7 +54,9 @@ export const useRoute = (
|
|
|
54
54
|
|
|
55
55
|
const modalScreenData = modalState.screen;
|
|
56
56
|
|
|
57
|
-
const hookModalScreenData = useHookModalScreenData(
|
|
57
|
+
const hookModalScreenData = useHookModalScreenData(
|
|
58
|
+
!isHookModalPathname(pathname)
|
|
59
|
+
);
|
|
58
60
|
|
|
59
61
|
const videoModalScreenData =
|
|
60
62
|
navigator?.videoModalState?.item &&
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { act, renderHook } from "@testing-library/react-
|
|
1
|
+
import { act, renderHook } from "@testing-library/react-native";
|
|
2
2
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
|
|
3
3
|
|
|
4
4
|
import { ON_HOLD_INTERVAL, SEEK_TYPE, SKIP_TIME_BASE } from "../const";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { cleanup, renderHook } from "@testing-library/react-
|
|
3
|
+
import { cleanup, renderHook } from "@testing-library/react-native";
|
|
4
4
|
import configureStore from "redux-mock-store";
|
|
5
5
|
import { Provider } from "react-redux";
|
|
6
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Provider } from "react-redux";
|
|
3
|
-
import { renderHook } from "@testing-library/react-
|
|
3
|
+
import { renderHook } from "@testing-library/react-native";
|
|
4
4
|
import configureStore from "redux-mock-store";
|
|
5
|
-
import thunk from "redux-thunk";
|
|
5
|
+
import { thunk } from "redux-thunk";
|
|
6
6
|
|
|
7
7
|
const mockStore = configureStore([thunk]);
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Provider } from "react-redux";
|
|
3
|
-
import { renderHook } from "@testing-library/react-
|
|
3
|
+
import { renderHook } from "@testing-library/react-native";
|
|
4
4
|
import configureStore from "redux-mock-store";
|
|
5
|
-
import thunk from "redux-thunk";
|
|
5
|
+
import { thunk } from "redux-thunk";
|
|
6
6
|
|
|
7
7
|
const mockStore = configureStore([thunk]);
|
|
8
8
|
|