@applicaster/quick-brick-core 13.0.0-rc.3 → 13.0.0-rc.30
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/App/ActionsProvider/__tests__/__snapshots__/ActionsProvider.test.js.snap +7 -7
- package/App/AssetCache/__tests__/__snapshots__/assetCache.test.ts.snap +103 -103
- package/App/AssetCache/__tests__/assetCache.test.ts +3 -2
- package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/__snapshots__/schemeHandlerHooks.test.ts.snap +1 -1
- package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useOpenSchemeHandler.test.tsx +45 -116
- package/App/DeepLinking/URLSchemeHandler/__tests__/__snapshots__/URLSchemeHandler.test.tsx.snap +3 -3
- package/App/DeepLinking/URLSchemeListener/URLSchemeContextProvider.tsx +30 -3
- package/App/LoadingOverlay/LoadingOverlayManager.tsx +27 -0
- package/App/LoadingOverlay/index.tsx +44 -0
- package/App/LoadingOverlay/useLoadingOverlayVisibility.tsx +18 -0
- package/App/NavigationProvider/NavigationProvider.tsx +48 -20
- package/App/NavigationProvider/__tests__/__snapshots__/navigationProvider.test.tsx.snap +20 -22
- package/App/NavigationProvider/navigator/__tests__/__snapshots__/reducer.test.ts.snap +189 -189
- package/App/NavigationProvider/utils.ts +7 -4
- package/App/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +2 -2
- package/App/StoreConnector/__tests__/__snapshots__/storeConnector.test.js.snap +5 -5
- package/App/appLifeCycleManager/__tests__/__snapshots__/appLifeCycleManager.test.js.snap +4 -4
- package/App/appLifeCycleManager/__tests__/appLifeCycleManager.test.js +5 -5
- package/App/appLifeCycleManager/index.tsx +2 -3
- package/App/index.tsx +2 -0
- package/App/remoteContextReloader/__tests__/__snapshots__/remoteContextReloader.test.js.snap +9 -9
- package/App/remoteContextReloader/consts.ts +2 -0
- package/App/remoteContextReloader/getRemoteContextData/getNativeRemoteContextData.ts +17 -6
- package/createZappApp/__tests__/__snapshots__/createZappApp.test.js.snap +33 -33
- package/index.d.ts +1 -1
- package/package.json +25 -9
|
@@ -49,6 +49,7 @@ import { coreAppLogger } from "../logger";
|
|
|
49
49
|
import {
|
|
50
50
|
getPlatform,
|
|
51
51
|
isTV,
|
|
52
|
+
isVizioPlatform,
|
|
52
53
|
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
53
54
|
import { useConnectionInfo } from "@applicaster/zapp-react-native-utils/reactHooks/connection";
|
|
54
55
|
import {
|
|
@@ -66,6 +67,10 @@ import { inflateUrl } from "@applicaster/zapp-react-native-ui-components/Compone
|
|
|
66
67
|
import { useModalStore } from "@applicaster/zapp-react-native-utils/modalState";
|
|
67
68
|
import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
|
|
68
69
|
import { QBUIComponentEvents } from "@applicaster/zapp-react-native-ui-components/events";
|
|
70
|
+
import { Hook } from "@applicaster/zapp-react-native-utils/appUtils/HooksManager/Hook";
|
|
71
|
+
import { URLSchemeContext } from "../DeepLinking/URLSchemeListener/URLSchemeContextProvider";
|
|
72
|
+
|
|
73
|
+
import { loadingOverlayManager } from "../LoadingOverlay";
|
|
69
74
|
|
|
70
75
|
const logger = coreAppLogger.addSubsystem("Navigator");
|
|
71
76
|
|
|
@@ -75,17 +80,6 @@ type Props = {
|
|
|
75
80
|
plugins?: QuickBrickPlugin[];
|
|
76
81
|
};
|
|
77
82
|
|
|
78
|
-
type EntryWithParent = ZappEntry & { parent?: EntryWithParent };
|
|
79
|
-
|
|
80
|
-
type SingleEntry = {
|
|
81
|
-
data: EntryWithParent;
|
|
82
|
-
route: string;
|
|
83
|
-
id: string;
|
|
84
|
-
parentId?: string;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
type EntryContextType = { [K in string]: SingleEntry };
|
|
88
|
-
|
|
89
83
|
const navigationActions = {
|
|
90
84
|
[ACTIONS.PUSH]: push,
|
|
91
85
|
[ACTIONS.REPLACE]: replace,
|
|
@@ -96,6 +90,8 @@ const navigationActions = {
|
|
|
96
90
|
const platform = getPlatform();
|
|
97
91
|
|
|
98
92
|
export function NavigationProvider({ children }: Props) {
|
|
93
|
+
const { url: deepLinkURL } = React.useContext(URLSchemeContext);
|
|
94
|
+
|
|
99
95
|
const {
|
|
100
96
|
appData: { layoutVersion },
|
|
101
97
|
rivers,
|
|
@@ -122,9 +118,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
122
118
|
const pathname = state?.location?.pathname;
|
|
123
119
|
const pathnameRef = React.useRef(pathname);
|
|
124
120
|
|
|
125
|
-
const { context }
|
|
126
|
-
ZappPipesEntryContext.Context
|
|
127
|
-
);
|
|
121
|
+
const { context } = React.useContext(ZappPipesEntryContext.Context);
|
|
128
122
|
|
|
129
123
|
const { openModal, dismissModal } = useModalStore();
|
|
130
124
|
|
|
@@ -380,7 +374,18 @@ export function NavigationProvider({ children }: Props) {
|
|
|
380
374
|
}
|
|
381
375
|
};
|
|
382
376
|
|
|
383
|
-
const handleHookPresent = (
|
|
377
|
+
const handleHookPresent = (
|
|
378
|
+
{
|
|
379
|
+
hookPlugin,
|
|
380
|
+
route,
|
|
381
|
+
payload,
|
|
382
|
+
}: {
|
|
383
|
+
hookPlugin: Hook;
|
|
384
|
+
route: string;
|
|
385
|
+
payload: object;
|
|
386
|
+
},
|
|
387
|
+
dispose
|
|
388
|
+
) => {
|
|
384
389
|
if (hookPlugin?.lastHook) {
|
|
385
390
|
dispose();
|
|
386
391
|
}
|
|
@@ -394,6 +399,8 @@ export function NavigationProvider({ children }: Props) {
|
|
|
394
399
|
} else {
|
|
395
400
|
dispatch(push(route, { entry: payload, screen: hookPlugin }));
|
|
396
401
|
}
|
|
402
|
+
|
|
403
|
+
closeLoadingOverlay();
|
|
397
404
|
};
|
|
398
405
|
|
|
399
406
|
const handleHookError = ({ error, hookPlugin, callback }, dispose) => {
|
|
@@ -412,6 +419,8 @@ export function NavigationProvider({ children }: Props) {
|
|
|
412
419
|
if (callback && typeof callback === "function") {
|
|
413
420
|
callback();
|
|
414
421
|
}
|
|
422
|
+
|
|
423
|
+
closeLoadingOverlay();
|
|
415
424
|
};
|
|
416
425
|
|
|
417
426
|
const handleHookCancel = ({ hookPlugin, callback }, dispose) => {
|
|
@@ -427,6 +436,8 @@ export function NavigationProvider({ children }: Props) {
|
|
|
427
436
|
} else {
|
|
428
437
|
goBack(true, true);
|
|
429
438
|
}
|
|
439
|
+
|
|
440
|
+
closeLoadingOverlay();
|
|
430
441
|
};
|
|
431
442
|
|
|
432
443
|
const handleHookSuccess = ({ hookPlugin, callback }) => {
|
|
@@ -437,6 +448,10 @@ export function NavigationProvider({ children }: Props) {
|
|
|
437
448
|
}
|
|
438
449
|
};
|
|
439
450
|
|
|
451
|
+
const handleBackgroundHook = () => {
|
|
452
|
+
openLoadingOverlay();
|
|
453
|
+
};
|
|
454
|
+
|
|
440
455
|
const checkStartUpHooks = React.useMemo(() => {
|
|
441
456
|
if (!pluginConfigurations) return false;
|
|
442
457
|
|
|
@@ -498,8 +513,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
498
513
|
({ hookPlugin, payload, callback }, dispose) => {
|
|
499
514
|
if (hookPlugin?.lastHook) {
|
|
500
515
|
dispose({ disposeAll: true });
|
|
501
|
-
|
|
502
|
-
startUpHooks.current && setStartUpHooks(false);
|
|
516
|
+
currentStartUpHooks.current && setStartUpHooks(false);
|
|
503
517
|
}
|
|
504
518
|
|
|
505
519
|
dispatch(
|
|
@@ -507,6 +521,8 @@ export function NavigationProvider({ children }: Props) {
|
|
|
507
521
|
);
|
|
508
522
|
|
|
509
523
|
callback?.();
|
|
524
|
+
|
|
525
|
+
closeLoadingOverlay();
|
|
510
526
|
};
|
|
511
527
|
|
|
512
528
|
const offlinePlugin = React.useMemo(() => {
|
|
@@ -614,25 +630,37 @@ export function NavigationProvider({ children }: Props) {
|
|
|
614
630
|
},
|
|
615
631
|
};
|
|
616
632
|
|
|
617
|
-
HooksManager(hooksOptions)
|
|
633
|
+
const hooksManager = HooksManager(hooksOptions);
|
|
634
|
+
|
|
635
|
+
hooksManager.subscriber
|
|
618
636
|
.on(HOOKS_EVENTS.PRESENT_SCREEN_HOOK, handleHookPresent)
|
|
619
637
|
.on(HOOKS_EVENTS.ERROR, handleHookError)
|
|
620
638
|
.on(HOOKS_EVENTS.CANCEL, handleHookCancel)
|
|
621
639
|
.on(HOOKS_EVENTS.SUCCESS, handleHookSuccess)
|
|
640
|
+
.on(HOOKS_EVENTS.START_BACKGROUND_HOOK, handleBackgroundHook)
|
|
622
641
|
.on(
|
|
623
642
|
HOOKS_EVENTS.COMPLETE,
|
|
624
643
|
handleHookComplete(navigationAction, targetRoute, {
|
|
625
644
|
screen,
|
|
626
645
|
options,
|
|
627
646
|
})
|
|
628
|
-
)
|
|
629
|
-
|
|
647
|
+
);
|
|
648
|
+
|
|
649
|
+
hooksManager.handleHooks(legacyScreenData({ entry, screen }));
|
|
630
650
|
} else {
|
|
631
651
|
dispatch(navigationAction(targetRoute, { screen, entry, options }));
|
|
632
652
|
}
|
|
633
653
|
},
|
|
634
654
|
});
|
|
635
655
|
|
|
656
|
+
const openLoadingOverlay = React.useCallback(() => {
|
|
657
|
+
deepLinkURL && isVizioPlatform() && loadingOverlayManager.show();
|
|
658
|
+
}, [deepLinkURL]);
|
|
659
|
+
|
|
660
|
+
const closeLoadingOverlay = React.useCallback(() => {
|
|
661
|
+
loadingOverlayManager.hide();
|
|
662
|
+
}, []);
|
|
663
|
+
|
|
636
664
|
const openPiP = React.useCallback(() => {
|
|
637
665
|
dispatch(setVideoPiP());
|
|
638
666
|
}, []);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<NavigationProvider /> modal feature removes the visible flag when dismissing a modal 1`] = `
|
|
4
|
-
|
|
5
|
-
"options":
|
|
4
|
+
{
|
|
5
|
+
"options": {
|
|
6
6
|
"animated": true,
|
|
7
7
|
"animationType": "slide",
|
|
8
8
|
"onDismiss": [Function],
|
|
@@ -11,22 +11,20 @@ Object {
|
|
|
11
11
|
"presentationStyle": "overFullScreen",
|
|
12
12
|
"transparent": true,
|
|
13
13
|
},
|
|
14
|
-
"props":
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
"screen": Object {
|
|
14
|
+
"props": undefined,
|
|
15
|
+
"screen": {
|
|
18
16
|
"id": "A1234",
|
|
19
|
-
"navigations":
|
|
20
|
-
"ui_components":
|
|
17
|
+
"navigations": [],
|
|
18
|
+
"ui_components": [],
|
|
21
19
|
},
|
|
22
20
|
"visible": true,
|
|
23
21
|
}
|
|
24
22
|
`;
|
|
25
23
|
|
|
26
24
|
exports[`<NavigationProvider /> modal feature removes the visible flag when dismissing a modal 2`] = `
|
|
27
|
-
|
|
28
|
-
"options":
|
|
29
|
-
"props":
|
|
25
|
+
{
|
|
26
|
+
"options": {},
|
|
27
|
+
"props": {},
|
|
30
28
|
"screen": null,
|
|
31
29
|
"visible": false,
|
|
32
30
|
}
|
|
@@ -35,8 +33,8 @@ Object {
|
|
|
35
33
|
exports[`<NavigationProvider /> modal feature sets the modalState when opening a modal 1`] = `undefined`;
|
|
36
34
|
|
|
37
35
|
exports[`<NavigationProvider /> modal feature should reset state to initial when dismissing a modal ( closeModalBottomSheet ) opened by openModalBottomSheet 1`] = `
|
|
38
|
-
|
|
39
|
-
"options":
|
|
36
|
+
{
|
|
37
|
+
"options": {
|
|
40
38
|
"animated": false,
|
|
41
39
|
"animationType": "none",
|
|
42
40
|
"onDismiss": [Function],
|
|
@@ -45,14 +43,14 @@ Object {
|
|
|
45
43
|
"presentationStyle": "overFullScreen",
|
|
46
44
|
"transparent": true,
|
|
47
45
|
},
|
|
48
|
-
"props":
|
|
49
|
-
"screen":
|
|
50
|
-
"ModalBottomSheetContent":
|
|
46
|
+
"props": {},
|
|
47
|
+
"screen": {
|
|
48
|
+
"ModalBottomSheetContent": {
|
|
51
49
|
"id": "A1234",
|
|
52
|
-
"navigations":
|
|
53
|
-
"ui_components":
|
|
50
|
+
"navigations": [],
|
|
51
|
+
"ui_components": [],
|
|
54
52
|
},
|
|
55
|
-
"modalBottomSheetContentProps":
|
|
53
|
+
"modalBottomSheetContentProps": {
|
|
56
54
|
"some": "props",
|
|
57
55
|
},
|
|
58
56
|
},
|
|
@@ -61,9 +59,9 @@ Object {
|
|
|
61
59
|
`;
|
|
62
60
|
|
|
63
61
|
exports[`<NavigationProvider /> modal feature should reset state to initial when dismissing a modal ( closeModalBottomSheet ) opened by openModalBottomSheet 2`] = `
|
|
64
|
-
|
|
65
|
-
"options":
|
|
66
|
-
"props":
|
|
62
|
+
{
|
|
63
|
+
"options": {},
|
|
64
|
+
"props": {},
|
|
67
65
|
"screen": null,
|
|
68
66
|
"visible": false,
|
|
69
67
|
}
|