@applicaster/zapp-react-native-utils 15.0.0-alpha.5170277721 → 15.0.0-alpha.5219062121
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/actionsExecutor/ActionExecutorContext.tsx +3 -6
- package/actionsExecutor/feedDecorator.ts +6 -6
- package/adsUtils/__tests__/createVMAP.test.ts +419 -0
- package/adsUtils/index.ts +2 -2
- package/analyticsUtils/README.md +1 -1
- 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/HooksManager/index.ts +10 -10
- package/appUtils/RiverFocusManager/{index.js → index.ts} +25 -18
- package/appUtils/accessibilityManager/__tests__/utils.test.ts +360 -0
- package/appUtils/accessibilityManager/const.ts +4 -0
- package/appUtils/accessibilityManager/hooks.ts +20 -13
- package/appUtils/accessibilityManager/index.ts +28 -1
- package/appUtils/accessibilityManager/utils.ts +59 -8
- 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 +1 -1
- package/appUtils/focusManagerAux/utils/utils.ios.ts +199 -3
- package/appUtils/keyCodes/keys/keys.web.ts +1 -4
- package/appUtils/orientationHelper.ts +2 -4
- package/appUtils/platform/platformUtils.ts +117 -18
- package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +94 -4
- package/appUtils/playerManager/OverlayObserver/utils.ts +32 -20
- package/appUtils/playerManager/player.ts +4 -0
- package/appUtils/playerManager/playerNative.ts +31 -17
- package/appUtils/playerManager/usePlayerState.tsx +14 -2
- package/cellUtils/index.ts +32 -0
- package/cloudEventsUtils/__tests__/index.test.ts +529 -0
- package/cloudEventsUtils/index.ts +65 -1
- package/configurationUtils/__tests__/imageSrcFromMediaItem.test.ts +38 -0
- package/configurationUtils/__tests__/manifestKeyParser.test.ts +26 -26
- 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 +109 -11
- package/manifestUtils/keys.js +21 -0
- package/manifestUtils/platformIsTV.js +13 -0
- package/manifestUtils/sharedConfiguration/screenPicker/utils.js +1 -0
- package/manifestUtils/tvAction/container/index.js +1 -1
- package/navigationUtils/index.ts +15 -5
- package/numberUtils/__tests__/toNumber.test.ts +12 -0
- package/numberUtils/__tests__/toPositiveNumber.test.ts +165 -0
- package/numberUtils/index.ts +19 -1
- package/package.json +4 -4
- package/playerUtils/usePlayerTTS.ts +8 -3
- package/pluginUtils/index.ts +4 -0
- package/reactHooks/advertising/index.ts +2 -2
- 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/debugging/__tests__/index.test.js +4 -4
- package/reactHooks/dev/__tests__/useReRenderLog.test.ts +188 -0
- package/reactHooks/device/useIsTablet.tsx +14 -19
- package/reactHooks/device/useMemoizedIsTablet.ts +3 -3
- 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 +4 -1
- package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +42 -30
- package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +1 -1
- package/reactHooks/feed/__tests__/{useInflatedUrl.test.ts → useInflatedUrl.test.tsx} +62 -7
- package/reactHooks/feed/useEntryScreenId.ts +2 -2
- package/reactHooks/feed/useInflatedUrl.ts +43 -17
- package/reactHooks/flatList/useLoadNextPageIfNeeded.ts +13 -16
- 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/layout/useDimensions/__tests__/{useDimensions.test.ts → useDimensions.test.tsx} +105 -25
- package/reactHooks/layout/useDimensions/useDimensions.ts +2 -2
- package/reactHooks/navigation/__tests__/index.test.tsx +40 -9
- package/reactHooks/navigation/index.ts +27 -11
- package/reactHooks/navigation/useRoute.ts +11 -7
- package/reactHooks/player/TVSeekControlller/TVSeekController.ts +27 -10
- 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/resolvers/useCellResolver.ts +6 -2
- package/reactHooks/resolvers/useComponentResolver.ts +8 -2
- 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 +12 -4
- package/reactHooks/screen/useTargetScreenData.ts +4 -2
- package/reactHooks/state/useRefWithInitialValue.ts +10 -0
- package/reactHooks/state/useRivers.ts +1 -1
- package/reactHooks/ui/__tests__/useFadeOutWhenBlurred.test.ts +580 -0
- package/reactHooks/usePluginConfiguration.ts +2 -2
- package/reactHooks/utils/__tests__/index.test.js +1 -1
- package/rectUtils/__tests__/index.test.ts +549 -0
- package/rectUtils/index.ts +2 -2
- package/screenPickerUtils/__tests__/index.test.ts +333 -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 +30 -21
- 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__/mapAccum.test.ts +73 -0
- package/utils/__tests__/mergeRight.test.ts +48 -0
- package/utils/__tests__/selectors.test.ts +124 -0
- package/utils/index.ts +17 -0
- package/utils/mapAccum.ts +23 -0
- package/utils/mergeRight.ts +5 -0
- package/utils/path.ts +6 -3
- package/utils/pathOr.ts +5 -1
- package/utils/selectors.ts +46 -0
- package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +34 -11
- package/zappFrameworkUtils/HookCallback/hookCallbackManifestExtensions.config.js +1 -1
- package/reactHooks/componentsMap/index.ts +0 -55
|
@@ -1,193 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`HooksManager when target route is playable executes the player hook 1`] = `
|
|
4
|
-
[
|
|
5
|
-
{
|
|
6
|
-
"callback": [Function],
|
|
7
|
-
"hookPlugin": Hook {
|
|
8
|
-
"configuration": {
|
|
9
|
-
"config_field": "bar",
|
|
10
|
-
},
|
|
11
|
-
"identifier": "headless_player_hook",
|
|
12
|
-
"lastHook": true,
|
|
13
|
-
"manager": {
|
|
14
|
-
"executeHook": [Function],
|
|
15
|
-
"handleHooks": [Function],
|
|
16
|
-
"presentScreenHook": [Function],
|
|
17
|
-
"runInBackground": [Function],
|
|
18
|
-
"subscriber": {
|
|
19
|
-
"handlers": {
|
|
20
|
-
"complete": [
|
|
21
|
-
[MockFunction] {
|
|
22
|
-
"calls": [
|
|
23
|
-
[
|
|
24
|
-
{
|
|
25
|
-
"callback": [Function],
|
|
26
|
-
"hookPlugin": [Circular],
|
|
27
|
-
"payload": {
|
|
28
|
-
"foo": "bar",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
[Function],
|
|
32
|
-
],
|
|
33
|
-
],
|
|
34
|
-
"results": [
|
|
35
|
-
{
|
|
36
|
-
"type": "return",
|
|
37
|
-
"value": undefined,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
"presentScreenHook": [
|
|
43
|
-
[MockFunction],
|
|
44
|
-
],
|
|
45
|
-
"success": [
|
|
46
|
-
[MockFunction] {
|
|
47
|
-
"calls": [
|
|
48
|
-
[Circular],
|
|
49
|
-
],
|
|
50
|
-
"results": [
|
|
51
|
-
{
|
|
52
|
-
"type": "return",
|
|
53
|
-
"value": undefined,
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
"invokeHandler": [Function],
|
|
60
|
-
"on": [Function],
|
|
61
|
-
"removeHandler": [Function],
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
"module": {
|
|
65
|
-
"hasPlayerHook": true,
|
|
66
|
-
"run": [MockFunction] {
|
|
67
|
-
"calls": [
|
|
68
|
-
[
|
|
69
|
-
{
|
|
70
|
-
"foo": "bar",
|
|
71
|
-
},
|
|
72
|
-
[Function],
|
|
73
|
-
{
|
|
74
|
-
"config_field": "bar",
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
],
|
|
78
|
-
"results": [
|
|
79
|
-
{
|
|
80
|
-
"type": "return",
|
|
81
|
-
"value": undefined,
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
"state": 7,
|
|
87
|
-
"weight": 1,
|
|
88
|
-
},
|
|
89
|
-
"payload": {
|
|
90
|
-
"foo": "bar",
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
[Function],
|
|
94
|
-
]
|
|
95
|
-
`;
|
|
96
|
-
|
|
97
|
-
exports[`HooksManager when target route is playable executes the player hook 2`] = `
|
|
98
|
-
[
|
|
99
|
-
{
|
|
100
|
-
"callback": [Function],
|
|
101
|
-
"hookPlugin": Hook {
|
|
102
|
-
"configuration": {
|
|
103
|
-
"config_field": "bar",
|
|
104
|
-
},
|
|
105
|
-
"identifier": "headless_player_hook",
|
|
106
|
-
"lastHook": true,
|
|
107
|
-
"manager": {
|
|
108
|
-
"executeHook": [Function],
|
|
109
|
-
"handleHooks": [Function],
|
|
110
|
-
"presentScreenHook": [Function],
|
|
111
|
-
"runInBackground": [Function],
|
|
112
|
-
"subscriber": {
|
|
113
|
-
"handlers": {
|
|
114
|
-
"complete": [
|
|
115
|
-
[MockFunction] {
|
|
116
|
-
"calls": [
|
|
117
|
-
[Circular],
|
|
118
|
-
],
|
|
119
|
-
"results": [
|
|
120
|
-
{
|
|
121
|
-
"type": "return",
|
|
122
|
-
"value": undefined,
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
"presentScreenHook": [
|
|
128
|
-
[MockFunction],
|
|
129
|
-
],
|
|
130
|
-
"success": [
|
|
131
|
-
[MockFunction] {
|
|
132
|
-
"calls": [
|
|
133
|
-
[
|
|
134
|
-
{
|
|
135
|
-
"callback": [Function],
|
|
136
|
-
"hookPlugin": [Circular],
|
|
137
|
-
"payload": {
|
|
138
|
-
"foo": "bar",
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
[Function],
|
|
142
|
-
],
|
|
143
|
-
],
|
|
144
|
-
"results": [
|
|
145
|
-
{
|
|
146
|
-
"type": "return",
|
|
147
|
-
"value": undefined,
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
},
|
|
153
|
-
"invokeHandler": [Function],
|
|
154
|
-
"on": [Function],
|
|
155
|
-
"removeHandler": [Function],
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
"module": {
|
|
159
|
-
"hasPlayerHook": true,
|
|
160
|
-
"run": [MockFunction] {
|
|
161
|
-
"calls": [
|
|
162
|
-
[
|
|
163
|
-
{
|
|
164
|
-
"foo": "bar",
|
|
165
|
-
},
|
|
166
|
-
[Function],
|
|
167
|
-
{
|
|
168
|
-
"config_field": "bar",
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
],
|
|
172
|
-
"results": [
|
|
173
|
-
{
|
|
174
|
-
"type": "return",
|
|
175
|
-
"value": undefined,
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
"state": 7,
|
|
181
|
-
"weight": 1,
|
|
182
|
-
},
|
|
183
|
-
"payload": {
|
|
184
|
-
"foo": "bar",
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
[Function],
|
|
188
|
-
]
|
|
189
|
-
`;
|
|
190
|
-
|
|
191
3
|
exports[`HooksManager when there are preload hooks hook with screen: executes 1`] = `
|
|
192
4
|
[
|
|
193
5
|
{
|
|
@@ -116,9 +116,23 @@ describe("HooksManager", () => {
|
|
|
116
116
|
headlessPlayerHook.configuration
|
|
117
117
|
);
|
|
118
118
|
|
|
119
|
-
expect(successHandler
|
|
119
|
+
expect(successHandler).toHaveBeenCalledTimes(1);
|
|
120
|
+
expect(successHandler.mock.calls[0][0].payload).toEqual(payload);
|
|
120
121
|
|
|
121
|
-
expect(
|
|
122
|
+
expect(successHandler.mock.calls[0][0].hookPlugin.identifier).toBe(
|
|
123
|
+
"headless_player_hook"
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
expect(typeof successHandler.mock.calls[0][1]).toBe("function");
|
|
127
|
+
|
|
128
|
+
expect(completeHandler).toHaveBeenCalledTimes(1);
|
|
129
|
+
expect(completeHandler.mock.calls[0][0].payload).toEqual(payload);
|
|
130
|
+
|
|
131
|
+
expect(completeHandler.mock.calls[0][0].hookPlugin.identifier).toBe(
|
|
132
|
+
"headless_player_hook"
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
expect(typeof completeHandler.mock.calls[0][1]).toBe("function");
|
|
122
136
|
});
|
|
123
137
|
});
|
|
124
138
|
|
|
@@ -230,7 +230,7 @@ export function HooksManager({
|
|
|
230
230
|
function completeHook(hookPlugin, payload, callback) {
|
|
231
231
|
logHookEvent(
|
|
232
232
|
hooksManagerLogger.info,
|
|
233
|
-
`completeHook: hook sequence completed successfully: ${hookPlugin
|
|
233
|
+
`completeHook: hook sequence completed successfully: ${hookPlugin.identifier}`,
|
|
234
234
|
{
|
|
235
235
|
payload,
|
|
236
236
|
hook: hookPlugin,
|
|
@@ -276,7 +276,7 @@ export function HooksManager({
|
|
|
276
276
|
if (hookPlugin.isCancelled()) {
|
|
277
277
|
logHookEvent(
|
|
278
278
|
hooksManagerLogger.info,
|
|
279
|
-
`hookCallback: hook was cancelled: ${hookPlugin
|
|
279
|
+
`hookCallback: hook was cancelled: ${hookPlugin.identifier}`,
|
|
280
280
|
{}
|
|
281
281
|
);
|
|
282
282
|
|
|
@@ -305,7 +305,7 @@ export function HooksManager({
|
|
|
305
305
|
if (!success) {
|
|
306
306
|
logHookEvent(
|
|
307
307
|
hooksManagerLogger.info,
|
|
308
|
-
`hookCallback: hook was cancelled: ${hookPlugin
|
|
308
|
+
`hookCallback: hook was cancelled: ${hookPlugin.identifier}`,
|
|
309
309
|
{
|
|
310
310
|
payload,
|
|
311
311
|
hook: hookPlugin,
|
|
@@ -334,7 +334,7 @@ export function HooksManager({
|
|
|
334
334
|
if (isHookInHomescreen && isHookFlowBlocker && cancelled) {
|
|
335
335
|
logHookEvent(
|
|
336
336
|
hooksManagerLogger.info,
|
|
337
|
-
`hookCallback: send app to background, cancelled flow blocker hook ${hookPlugin
|
|
337
|
+
`hookCallback: send app to background, cancelled flow blocker hook ${hookPlugin.identifier} on home screen`,
|
|
338
338
|
{
|
|
339
339
|
payload,
|
|
340
340
|
hook: hookPlugin,
|
|
@@ -349,7 +349,7 @@ export function HooksManager({
|
|
|
349
349
|
} else {
|
|
350
350
|
logHookEvent(
|
|
351
351
|
hooksManagerLogger.info,
|
|
352
|
-
`hookCallback: hook successfully finished: ${hookPlugin
|
|
352
|
+
`hookCallback: hook successfully finished: ${hookPlugin.identifier}`,
|
|
353
353
|
{
|
|
354
354
|
payload,
|
|
355
355
|
hook: hookPlugin,
|
|
@@ -359,7 +359,7 @@ export function HooksManager({
|
|
|
359
359
|
if (!callback) {
|
|
360
360
|
logHookEvent(
|
|
361
361
|
hooksManagerLogger.warn,
|
|
362
|
-
`hookCallback: ${hookPlugin
|
|
362
|
+
`hookCallback: ${hookPlugin.identifier} is missing \`callback\`, using hookCallback(default one)`,
|
|
363
363
|
{
|
|
364
364
|
hookPlugin,
|
|
365
365
|
}
|
|
@@ -401,7 +401,7 @@ export function HooksManager({
|
|
|
401
401
|
|
|
402
402
|
logHookEvent(
|
|
403
403
|
hooksManagerLogger.info,
|
|
404
|
-
`presentScreenHook: Presenting screen hook: ${hookPlugin
|
|
404
|
+
`presentScreenHook: Presenting screen hook: ${hookPlugin.identifier}`,
|
|
405
405
|
{
|
|
406
406
|
hook: hookPlugin,
|
|
407
407
|
payload,
|
|
@@ -421,7 +421,7 @@ export function HooksManager({
|
|
|
421
421
|
hooksManager.executeHook = function (hookPlugin, payload, callback) {
|
|
422
422
|
logHookEvent(
|
|
423
423
|
hooksManagerLogger.info,
|
|
424
|
-
`executeHook: ${hookPlugin
|
|
424
|
+
`executeHook: ${hookPlugin.identifier}`,
|
|
425
425
|
{
|
|
426
426
|
hook: hookPlugin,
|
|
427
427
|
payload,
|
|
@@ -433,7 +433,7 @@ export function HooksManager({
|
|
|
433
433
|
} catch (error) {
|
|
434
434
|
logHookEvent(
|
|
435
435
|
hooksManagerLogger.error,
|
|
436
|
-
`executeHook: error executing hook: ${hookPlugin
|
|
436
|
+
`executeHook: error executing hook: ${hookPlugin.identifier} error: ${error.message}`,
|
|
437
437
|
{
|
|
438
438
|
hook: hookPlugin,
|
|
439
439
|
payload,
|
|
@@ -460,7 +460,7 @@ export function HooksManager({
|
|
|
460
460
|
try {
|
|
461
461
|
logHookEvent(
|
|
462
462
|
hooksManagerLogger.info,
|
|
463
|
-
`runInBackground: Executing hook: ${hookPlugin
|
|
463
|
+
`runInBackground: Executing hook: ${hookPlugin.identifier}`,
|
|
464
464
|
{
|
|
465
465
|
hook: hookPlugin,
|
|
466
466
|
payload,
|
|
@@ -1,11 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager/index.ios";
|
|
2
|
+
import { QUICK_BRICK_CONTENT } from "@applicaster/quick-brick-core/const";
|
|
3
|
+
import { isNil, isEmpty } from "@applicaster/zapp-react-native-utils/utils";
|
|
4
|
+
import { isNotNil } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
4
5
|
|
|
5
6
|
let riverFocusData = {};
|
|
6
7
|
let initialyPresentedScreenFocused = false;
|
|
7
8
|
|
|
8
9
|
export const riverFocusManager = (function () {
|
|
10
|
+
/**
|
|
11
|
+
* Create unique key that will be used for save focused group data inside specific screen
|
|
12
|
+
* @param {{ screenId: string, isInsideContainer: boolean }}
|
|
13
|
+
* screenId Unique Id of the screen from layout.json
|
|
14
|
+
* isInsideContainer If this screen a screen picker child
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
function screenFocusableGroupId({
|
|
18
|
+
screenId,
|
|
19
|
+
isInsideContainer,
|
|
20
|
+
}: {
|
|
21
|
+
screenId: string;
|
|
22
|
+
isInsideContainer: Option<boolean>;
|
|
23
|
+
}) {
|
|
24
|
+
return `${QUICK_BRICK_CONTENT}-${screenId}${
|
|
25
|
+
isNil(isInsideContainer) ? "" : "-isInsideContainer"
|
|
26
|
+
}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
9
29
|
function setScreenFocusableData({
|
|
10
30
|
screenFocusableGroupId,
|
|
11
31
|
groupId,
|
|
@@ -78,8 +98,8 @@ export const riverFocusManager = (function () {
|
|
|
78
98
|
}) {
|
|
79
99
|
// Check if screen should be focused
|
|
80
100
|
const shouldFocus =
|
|
81
|
-
(initialyPresentedScreenFocused === false &&
|
|
82
|
-
|
|
101
|
+
(initialyPresentedScreenFocused === false && isEmpty(riverFocusData)) ||
|
|
102
|
+
isNotNil(riverFocusData[screenFocusableGroupId]) ||
|
|
83
103
|
isDeepLink;
|
|
84
104
|
|
|
85
105
|
// TODO: Uncommit it to start fixing bug where selection wrong item
|
|
@@ -118,19 +138,6 @@ export const riverFocusManager = (function () {
|
|
|
118
138
|
}
|
|
119
139
|
}
|
|
120
140
|
|
|
121
|
-
/**
|
|
122
|
-
* Create unique key that will be used for save focused group data inside specific screen
|
|
123
|
-
* @param {{ screenId: string, isInsideContainer: boolean }}
|
|
124
|
-
* screenId Unique Id of the screen from layout.json
|
|
125
|
-
* isInsideContainer If this screen a screen picker child
|
|
126
|
-
*
|
|
127
|
-
*/
|
|
128
|
-
function screenFocusableGroupId({ screenId, isInsideContainer }) {
|
|
129
|
-
return `RiverFocusableGroup-${screenId}${
|
|
130
|
-
R.isNil(isInsideContainer) ? "" : "-isInsideContainer"
|
|
131
|
-
}`;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
141
|
return {
|
|
135
142
|
setScreenFocusableData,
|
|
136
143
|
clearAllScreensData,
|