@applicaster/quick-brick-core 15.0.0-rc.99 → 15.1.0-alpha.9834630500

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.
Files changed (26) hide show
  1. package/App/ActionSetters/index.ts +4 -5
  2. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useOpenSchemeHandler.test.tsx +27 -12
  3. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/usePresentSchemeHandler.test.tsx +72 -35
  4. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useUrlSchemeHandler.test.tsx +104 -197
  5. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/useOpenSchemeHandler/index.ts +7 -4
  6. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/usePresentSchemeHandler.ts +14 -12
  7. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/useUrlSchemeHandler.ts +30 -42
  8. package/App/DeepLinking/URLSchemeHandler/URLSchemeHandler.tsx +1 -4
  9. package/App/DeepLinking/URLSchemeHandler/__tests__/URLSchemeHandler.test.tsx +13 -20
  10. package/App/DeepLinking/URLSchemeHandler/__tests__/__snapshots__/URLSchemeHandler.test.tsx.snap +24 -0
  11. package/App/DeepLinking/URLSchemeListener/URLSchemeContextProvider.tsx +59 -0
  12. package/App/DeepLinking/URLSchemeListener/index.tsx +4 -3
  13. package/App/DeepLinking/helpers/index.ts +3 -3
  14. package/App/ErrorBoundary/__tests__/store.test.js +1 -1
  15. package/App/NavigationProvider/Loader.tsx +4 -3
  16. package/App/NavigationProvider/NavigationProvider.tsx +48 -27
  17. package/App/NavigationProvider/ScreenHooks/usePluginScreenHooks.ts +2 -2
  18. package/App/NavigationProvider/__tests__/navigationProvider.test.tsx +152 -141
  19. package/App/NavigationProvider/navigator/selectors.ts +5 -21
  20. package/App/NetworkStatusProvider/NetworkStatusProvider.tsx +2 -2
  21. package/App/NetworkStatusProvider/__tests__/NetworkStatusProvider.test.tsx +4 -4
  22. package/App/__tests__/createQuickBrickApp.test.js +1 -1
  23. package/App/appRemoteDataLoader/index.tsx +2 -2
  24. package/App/remoteContextReloader/getRemoteContextData/getNativeRemoteContextData.ts +1 -1
  25. package/App/remoteContextReloader/helpers.ts +3 -3
  26. package/package.json +8 -8
@@ -21,8 +21,7 @@ const warnUndefinedContext = (context) =>
21
21
  });
22
22
 
23
23
  type Subscription = {
24
- [x: string]: (() => any) | string;
25
- pluginId?: string;
24
+ [x: string]: () => any;
26
25
  };
27
26
 
28
27
  const getModuleContext = R.path(["module", "context"]);
@@ -30,7 +29,7 @@ const getModuleContext = R.path(["module", "context"]);
30
29
  const getContexts = R.compose(
31
30
  R.map((action) => {
32
31
  const item = getModuleContext(action);
33
- item.pluginId = action.name;
32
+ item["pluginId"] = action.name;
34
33
 
35
34
  return item;
36
35
  }),
@@ -47,10 +46,10 @@ const useSubscribeToActionProviders = () => {
47
46
  }, [actionContext]);
48
47
 
49
48
  const subscriptions = getContexts(actionContext.actions).map((context) => {
50
- const subscription = React.useContext<Subscription>(context);
49
+ const subscription = React.useContext<{}>(context);
51
50
 
52
51
  if (subscription) {
53
- subscription.pluginId = context.pluginId;
52
+ subscription["pluginId"] = context.pluginId;
54
53
 
55
54
  return subscription;
56
55
  } else {
@@ -1,13 +1,14 @@
1
1
  /* eslint-disable max-len */
2
+ import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
2
3
  import * as feedLoader from "@applicaster/zapp-react-native-utils/reactHooks/feed/useFeedLoader";
3
4
  import * as useNavigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
4
5
  import { waitFor, cleanup, renderHook } from "@testing-library/react-native";
5
6
  import nock from "nock";
7
+ import * as R from "ramda";
6
8
  import React from "react";
7
- import { mergeDeepRight } from "ramda";
9
+ import { Provider } from "react-redux";
10
+ import configureStore from "redux-mock-store";
8
11
  import * as helpers from "../../../helpers";
9
- import { WrappedWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
10
-
11
12
  import {
12
13
  noTargetScreenError,
13
14
  resolveError,
@@ -23,7 +24,6 @@ const rivers: Record<string, Partial<ZappRiver>> = {
23
24
  home: true,
24
25
  },
25
26
  B0987: {
26
- type: "any",
27
27
  id: "B0987",
28
28
  },
29
29
  C5678: {
@@ -42,7 +42,7 @@ const contentTypes: ZappContentTypes = {
42
42
  const endpoint = "http://feed.com";
43
43
 
44
44
  const pipesEndpoints: ZappPipesEndpoints = {
45
- [endpoint]: {
45
+ [`${endpoint}`]: {
46
46
  context_keys: [],
47
47
  context_obj: [],
48
48
  },
@@ -55,6 +55,7 @@ const navigator = {
55
55
  goHome: jest.fn(),
56
56
  } as any;
57
57
 
58
+ const mockStore = configureStore();
58
59
  jest.spyOn(useNavigationHooks, "useNavigation").mockReturnValue(navigator);
59
60
 
60
61
  const helperSpy = jest.spyOn(helpers, "handlePresentNavigation");
@@ -79,17 +80,31 @@ jest.mock("../../../logger", () => ({
79
80
  // to use import instead of require it's required to use jest.mock above
80
81
  const { useOpenSchemeHandler } = require("../useOpenSchemeHandler");
81
82
 
82
- const mockStoreObj = { rivers, contentTypes, pipesEndpoints, appData };
83
+ const getWrapper = (storeProps = {}) => {
84
+ const store = mockStore(
85
+ R.mergeDeepRight(
86
+ { rivers, contentTypes, pipesEndpoints, appData },
87
+ storeProps
88
+ )
89
+ );
90
+
91
+ appStore.set(store);
92
+
93
+ const Wrapper = ({ children }: { children: React.ReactChild }) => (
94
+ /* @ts-ignore */
95
+ <Provider store={store}>{children}</Provider>
96
+ );
97
+
98
+ return Wrapper;
99
+ };
100
+
101
+ const testHook = async ({ url, query, storeProps = {}, tests }) => {
102
+ const wrapper = getWrapper(storeProps);
83
103
 
84
- const testHook = async ({ url, query, storeProps = {}, tests }: any) => {
85
104
  const callback = jest.fn((fn) => fn(tests));
86
105
 
87
106
  renderHook(() => useOpenSchemeHandler({ url, query, onFinish: callback }), {
88
- wrapper: ({ children }) => (
89
- <WrappedWithProviders store={mergeDeepRight(mockStoreObj, storeProps)}>
90
- {children}
91
- </WrappedWithProviders>
92
- ),
107
+ wrapper,
93
108
  });
94
109
 
95
110
  await waitFor(() => expect(callback).toHaveBeenCalled());
@@ -1,14 +1,11 @@
1
- import * as R from "ramda";
2
1
  import axios from "axios";
3
- import { renderHook } from "@testing-library/react-native";
2
+ import { renderHook, waitFor } from "@testing-library/react-native";
4
3
  import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
5
4
  import * as helpers from "../../../helpers";
6
5
  import * as feedLoader from "@applicaster/zapp-react-native-utils/reactHooks/feed/useFeedLoader";
7
6
  import { WrappedWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
8
7
  import { usePresentSchemeHandler } from "../usePresentSchemeHandler";
9
8
 
10
- import configureStore from "redux-mock-store";
11
-
12
9
  const rivers = {
13
10
  A1234: {
14
11
  id: "A1234",
@@ -28,8 +25,6 @@ jest.mock(
28
25
  })
29
26
  );
30
27
 
31
- const mockStore = configureStore();
32
-
33
28
  const helperSpy = jest.spyOn(helpers, "handlePresentNavigation");
34
29
  const feedLoaderSpy = jest.spyOn(feedLoader, "useFeedLoader");
35
30
 
@@ -179,46 +174,88 @@ describe("usePresentSchemeHandler", () => {
179
174
  });
180
175
 
181
176
  describe("loading new river", () => {
182
- it("Re-sets app ready state and calls loadAppContextData with new river and cellStyles data", async () => {
183
- const store = mockStore({ test: "test" });
184
-
185
- const wrapper = WrappedWithProviders;
177
+ const query = { rivers_configuration_id: "layout-uuid" };
186
178
 
187
- const query = {
188
- rivers_configuration_id: "test",
189
- };
179
+ const baseSessionData = {
180
+ accountsAccountId: "account-123",
181
+ bundleIdentifier: "com.example.app",
182
+ app_family_id: "42",
183
+ version_name: "1.0.0",
184
+ };
190
185
 
191
- const storageSpy = jest.spyOn(sessionStorage, "getAllItems");
192
- const axiosGetSpy = jest.spyOn(axios, "get");
186
+ let storageSpy: jest.SpyInstance;
187
+ let axiosGetSpy: jest.SpyInstance;
193
188
 
194
- const getAllItems = jest.fn().mockResolvedValue({
195
- accountsAccountId: "accountsAccountId",
196
- bundleIdentifier: "bundleIdentifier",
197
- app_family_id: "app_family_id",
198
- version_name: "version_name",
199
- store: "store",
200
- });
189
+ beforeEach(() => {
190
+ storageSpy = jest.spyOn(sessionStorage, "getAllItems");
191
+ axiosGetSpy = jest.spyOn(axios, "get");
192
+ axiosGetSpy.mockResolvedValue({ data: {} });
193
+ });
201
194
 
202
- const get = jest.fn().mockResolvedValue({ data: "url" });
195
+ afterEach(() => {
196
+ storageSpy.mockRestore();
197
+ axiosGetSpy.mockRestore();
198
+ });
203
199
 
204
- storageSpy.mockImplementation(getAllItems);
205
- axiosGetSpy.mockImplementation(get);
200
+ it("fetches the rivers, cell styles and presets mapping URLs", async () => {
201
+ storageSpy.mockResolvedValue({ ...baseSessionData, store: "store" });
206
202
 
207
203
  renderHook(() => usePresentSchemeHandler({ query, url: "", onFinish }), {
208
- wrapper,
204
+ wrapper: WrappedWithProviders,
209
205
  });
210
206
 
211
- return () => {
212
- const actions = store.getActions();
213
-
214
- expect(
215
- actions?.find(R.propEq("type", "SET_APP_NOT_READY"))
216
- ).toBeDefined();
207
+ await waitFor(() => {
208
+ expect(axiosGetSpy).toHaveBeenCalledWith(
209
+ expect.stringContaining("/layouts/layout-uuid.json")
210
+ );
211
+ });
212
+ });
217
213
 
218
- expect(actions?.find(R.propEq("type", "SET_APP_READY"))).toBeDefined();
214
+ describe("WEB_STORE_PLATFORM CDN store key mapping", () => {
215
+ it.each([
216
+ ["samsung", "samsung_app_store"],
217
+ ["lg", "lg_content_store"],
218
+ ["vizio", "vizio_app_store"],
219
+ ])(
220
+ 'maps store="%s" to "%s" in the rivers URL',
221
+ async (store, expectedCdnKey) => {
222
+ storageSpy.mockResolvedValue({ ...baseSessionData, store });
223
+
224
+ renderHook(
225
+ () => usePresentSchemeHandler({ query, url: "", onFinish }),
226
+ { wrapper: WrappedWithProviders }
227
+ );
228
+
229
+ await waitFor(() => {
230
+ expect(axiosGetSpy).toHaveBeenCalledWith(
231
+ expect.stringContaining(`/${expectedCdnKey}/`)
232
+ );
233
+ });
234
+
235
+ // Confirm the raw store name is NOT used in the URL
236
+ expect(axiosGetSpy).not.toHaveBeenCalledWith(
237
+ expect.stringContaining(`/${store}/`)
238
+ );
239
+ }
240
+ );
219
241
 
220
- expect(navigator.replace).toBeCalledWith({});
221
- };
242
+ it("passes through an unmapped store value unchanged", async () => {
243
+ storageSpy.mockResolvedValue({
244
+ ...baseSessionData,
245
+ store: "apple_tv",
246
+ });
247
+
248
+ renderHook(
249
+ () => usePresentSchemeHandler({ query, url: "", onFinish }),
250
+ { wrapper: WrappedWithProviders }
251
+ );
252
+
253
+ await waitFor(() => {
254
+ expect(axiosGetSpy).toHaveBeenCalledWith(
255
+ expect.stringContaining("/apple_tv/")
256
+ );
257
+ });
258
+ });
222
259
  });
223
260
  });
224
261
 
@@ -1,35 +1,11 @@
1
1
  import * as React from "react";
2
- import { renderHook } from "@testing-library/react-native";
2
+ import { renderHook } from "@testing-library/react-hooks";
3
3
  import * as URLHandlersMap from "..";
4
4
 
5
5
  import { Provider } from "react-redux";
6
6
  import configureStore from "redux-mock-store";
7
7
 
8
8
  import { log_warning } from "../../../logger";
9
- import { handleActionSchemeUrl } from "../useUrlSchemeHandler";
10
- import { appStore } from "../../../../../../zapp-react-native-redux/AppStore";
11
-
12
- type UrlSchemeHandlerArgs = {
13
- query: Record<string, unknown>;
14
- url: string;
15
- onFinish?: (callback: () => void) => void;
16
- };
17
-
18
- type PluginType = "general" | "player";
19
-
20
- interface ZappPlugin {
21
- urlScheme?: {
22
- host: string;
23
- handler: (args: UrlSchemeHandlerArgs) => void;
24
- };
25
- }
26
-
27
- interface QuickBrickPlugin {
28
- module: ZappPlugin;
29
- name: string;
30
- identifier: string;
31
- type: PluginType;
32
- }
33
9
 
34
10
  const mockStore = configureStore();
35
11
 
@@ -38,222 +14,153 @@ jest.mock("../../../logger", () => ({
38
14
  log_warning: jest.fn(),
39
15
  }));
40
16
 
41
- const mockHandler = jest.fn(({ onFinish }) => {
42
- onFinish?.(() => {});
43
- });
44
-
45
- const mockComplexHandler = jest.fn(({ onFinish }) => {
46
- onFinish?.(() => {});
47
- });
48
-
49
- const lambdaPlugin: QuickBrickPlugin = {
50
- module: {} as ZappPlugin,
17
+ const lambdaPlugin = {
18
+ module: jest.fn() as ZappPlugin,
51
19
  name: "Lambda plugin",
52
20
  identifier: "someplugin",
53
- type: "general",
21
+ type: "general" as PluginType,
54
22
  };
55
23
 
56
- const pluginWithHandler: QuickBrickPlugin = {
24
+ const pluginWithHandler = {
57
25
  name: "Plugin handling scheme",
58
26
  identifier: "plugin-with-handler",
59
- type: "general",
27
+ type: "general" as PluginType,
60
28
  module: {
61
29
  urlScheme: {
62
30
  host: "foo",
63
- handler: mockHandler,
64
- },
65
- },
66
- };
67
-
68
- const pluginWithComplexHandler: QuickBrickPlugin = {
69
- name: "Plugin with nested handler",
70
- identifier: "plugin-with-nested-handler",
71
- type: "general",
72
- module: {
73
- urlScheme: {
74
- host: "complex",
75
- handler: mockComplexHandler,
31
+ handler: jest.fn(({ onFinish }) => {
32
+ onFinish(() => {});
33
+ }),
76
34
  },
77
- },
35
+ } as ZappPlugin,
78
36
  };
79
37
 
80
- const plugins = [lambdaPlugin, pluginWithHandler, pluginWithComplexHandler];
38
+ const plugins: QuickBrickPlugin[] = [lambdaPlugin, pluginWithHandler];
81
39
 
82
40
  const { useUrlSchemeHandler } = require("../useUrlSchemeHandler");
83
41
 
84
42
  describe("useUrlSchemeHandler", () => {
85
- const store = mockStore({ plugins });
43
+ // beforeEach(() => {
44
+ // log_warning.mockClear();
45
+ // });
86
46
 
87
- appStore.set(store);
47
+ const store = mockStore({ test: "test", plugins });
88
48
 
89
- const wrapper: React.FC = ({ children }) => (
49
+ const wrapper: React.FC<any> = ({ children }) => (
90
50
  <Provider store={store}>{children}</Provider>
91
51
  );
92
52
 
93
- beforeEach(() => {
94
- jest.clearAllMocks();
53
+ it("calls correct urlScheme handler with query params", () => {
54
+ const presentSpy = jest.fn();
55
+ const onFinish = jest.fn();
56
+ const url = "test://present?foo=bar";
95
57
 
96
- Object.keys(URLHandlersMap.schemeHandlerHooks).forEach((key) => {
97
- delete (URLHandlersMap.schemeHandlerHooks as any)[key];
98
- });
58
+ URLHandlersMap.schemeHandlerHooks.present = presentSpy;
59
+
60
+ renderHook(
61
+ () =>
62
+ useUrlSchemeHandler({
63
+ url,
64
+ onFinish,
65
+ }),
66
+ { wrapper }
67
+ );
68
+
69
+ expect(presentSpy).toBeCalledWith({ query: { foo: "bar" }, url, onFinish });
99
70
  });
100
71
 
101
- describe("Basic URL scheme handling", () => {
102
- it("handles query params correctly", () => {
103
- const testHandler = jest.fn();
104
- (URLHandlersMap.schemeHandlerHooks as any).test = testHandler;
105
- const testUrl = "test://test?foo=bar";
106
-
107
- renderHook(
108
- () =>
109
- useUrlSchemeHandler({
110
- url: testUrl,
111
- onFinish: jest.fn(),
112
- }),
113
- { wrapper }
114
- );
115
-
116
- expect(testHandler).toBeCalledWith({
117
- query: { foo: "bar" },
118
- url: testUrl,
119
- onFinish: expect.any(Function),
120
- });
72
+ it("not throws an error and calls onFinish if correct url scheme handler can not be found", () => {
73
+ const url = "test://nonExistingHost?foo=bar";
74
+
75
+ const onFinish = jest.fn((cb) => {
76
+ cb();
121
77
  });
122
78
 
123
- it("handles missing scheme handlers gracefully", () => {
124
- const testUrl = "test://unknown?foo=bar";
125
- const finishCallback = jest.fn();
79
+ renderHook(
80
+ () =>
81
+ useUrlSchemeHandler({
82
+ url,
83
+ onFinish,
84
+ }),
85
+ { wrapper }
86
+ );
126
87
 
127
- const onFinish = jest.fn((cb) => {
128
- cb();
129
- finishCallback();
130
- });
88
+ expect(onFinish).toBeCalled();
131
89
 
132
- renderHook(
133
- () =>
134
- useUrlSchemeHandler({
135
- url: testUrl,
136
- onFinish,
137
- }),
138
- { wrapper }
139
- );
90
+ expect(log_warning).toHaveBeenCalledWith(
91
+ `unable to resolve ${url}: Non of the installed plugins knows how to handle this urlScheme ${url}`
92
+ );
93
+ });
140
94
 
141
- expect(finishCallback).toBeCalled();
95
+ it("calls onFinish when the handler does", () => {
96
+ const url = "test://present?foo=bar";
97
+ const onFinish = jest.fn();
142
98
 
143
- expect(log_warning).toBeCalledWith(expect.stringContaining(testUrl));
99
+ const presentSpy = jest.fn(() => {
100
+ onFinish();
144
101
  });
102
+
103
+ URLHandlersMap.schemeHandlerHooks.present = presentSpy;
104
+
105
+ renderHook(
106
+ () =>
107
+ useUrlSchemeHandler({
108
+ url,
109
+ onFinish,
110
+ }),
111
+ { wrapper }
112
+ );
113
+
114
+ expect(onFinish).toBeCalled();
145
115
  });
146
116
 
147
- describe("Plugin-based scheme handling", () => {
148
- it("resolves and calls plugin handlers", () => {
149
- const testUrl = "test://foo?param=test";
150
- const onFinish = jest.fn();
151
-
152
- renderHook(
153
- () =>
154
- useUrlSchemeHandler({
155
- url: testUrl,
156
- onFinish,
157
- }),
158
- { wrapper }
159
- );
160
-
161
- expect(mockHandler).toBeCalledWith({
162
- query: { param: "test" },
163
- url: testUrl,
164
- onFinish,
165
- });
166
- });
117
+ it("calls onFinish if handler returns an error", () => {
118
+ const url = "test://present?foo=bar";
167
119
 
168
- it("handles complex plugin configurations", () => {
169
- const testUrl = "test://complex?param=nested";
170
- const onFinish = jest.fn();
171
-
172
- renderHook(
173
- () =>
174
- useUrlSchemeHandler({
175
- url: testUrl,
176
- onFinish,
177
- }),
178
- { wrapper }
179
- );
180
-
181
- expect(mockComplexHandler).toBeCalledWith({
182
- query: { param: "nested" },
183
- url: testUrl,
184
- onFinish,
185
- });
120
+ const onFinish = jest.fn((cb) => {
121
+ cb();
186
122
  });
187
123
 
188
- it("ignores plugins without urlScheme", () => {
189
- const testUrl = "test://nonexistent?param=value";
190
- const finishCallback = jest.fn();
191
-
192
- const onFinish = jest.fn((cb) => {
193
- cb();
194
- finishCallback();
195
- });
196
-
197
- renderHook(
198
- () =>
199
- useUrlSchemeHandler({
200
- url: testUrl,
201
- onFinish,
202
- }),
203
- { wrapper }
204
- );
205
-
206
- expect(lambdaPlugin.module).not.toHaveProperty("urlScheme");
207
- expect(finishCallback).toBeCalled();
124
+ const presentSpy = jest.fn(() => {
125
+ throw new Error("error");
208
126
  });
209
- });
210
127
 
211
- describe("Action scheme handling", () => {
212
- it("handles action schemes using plugins", () => {
213
- const testUrl = "test://foo?action=test";
128
+ URLHandlersMap.schemeHandlerHooks.present = presentSpy;
214
129
 
215
- handleActionSchemeUrl({
216
- url: testUrl,
217
- plugins,
218
- } as any);
130
+ renderHook(
131
+ () =>
132
+ useUrlSchemeHandler({
133
+ url,
134
+ onFinish,
135
+ }),
136
+ { wrapper }
137
+ );
219
138
 
220
- expect(mockHandler).toBeCalledWith({
221
- query: { action: "test" },
222
- url: testUrl,
223
- });
224
- });
139
+ expect(onFinish).toBeCalled();
225
140
 
226
- it("throws for unknown action schemes", () => {
227
- const testUrl = "test://unknown?action=test";
141
+ expect(log_warning).toHaveBeenCalledWith(`unable to resolve ${url}: error`);
142
+ });
143
+
144
+ it("finds the plugin for the host", () => {
145
+ const url = "scheme://foo?whatever=bar";
228
146
 
229
- expect(() => {
230
- handleActionSchemeUrl({
231
- url: testUrl,
232
- plugins,
233
- } as any);
234
- }).toThrow(/Non of the installed plugins/);
147
+ const onFinish = jest.fn((cb) => {
148
+ cb();
235
149
  });
236
150
 
237
- it("handles malformed URLs gracefully", () => {
238
- const testUrl = "invalid-url";
239
- const finishCallback = jest.fn();
240
-
241
- const onFinish = jest.fn((cb) => {
242
- cb();
243
- finishCallback();
244
- });
245
-
246
- renderHook(
247
- () =>
248
- useUrlSchemeHandler({
249
- url: testUrl,
250
- onFinish,
251
- }),
252
- { wrapper }
253
- );
254
-
255
- expect(log_warning).toBeCalled();
256
- expect(finishCallback).toBeCalled();
151
+ renderHook(
152
+ () => {
153
+ useUrlSchemeHandler({ url, onFinish });
154
+ },
155
+ { wrapper }
156
+ );
157
+
158
+ expect(pluginWithHandler.module.urlScheme.handler).toBeCalledWith({
159
+ url,
160
+ onFinish,
161
+ query: { whatever: "bar" },
257
162
  });
163
+
164
+ expect(onFinish).toBeCalled();
258
165
  });
259
166
  });
@@ -1,4 +1,8 @@
1
- import { useContentTypes } from "@applicaster/zapp-react-native-redux";
1
+ import {
2
+ useAppSelector,
3
+ selectContentTypes,
4
+ selectRivers,
5
+ } from "@applicaster/zapp-react-native-redux";
2
6
  import { ZappPipesEntryContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
3
7
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
4
8
  import { useEffect } from "react";
@@ -20,7 +24,6 @@ import {
20
24
  withInitialPlayerState,
21
25
  } from "./utils";
22
26
  import { log_warning } from "../../../logger";
23
- import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks";
24
27
 
25
28
  async function handleQuery({
26
29
  query,
@@ -98,8 +101,8 @@ async function handleQuery({
98
101
  }
99
102
 
100
103
  export function useOpenSchemeHandler({ query, url, onFinish }) {
101
- const rivers = useRivers();
102
- const contentTypes = useContentTypes();
104
+ const rivers = useAppSelector(selectRivers);
105
+ const contentTypes = useAppSelector(selectContentTypes);
103
106
  const navigator = useNavigation();
104
107
  const homeId = getHomeScreenId(rivers);
105
108
  const homeRoute = `/river/${homeId}`;