@applicaster/quick-brick-core 16.0.0-alpha.4065452341 → 16.0.0-alpha.4155601029
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/ActionSetters/index.ts +2 -2
- package/App/ActionsProvider/ActionsProvider.tsx +1 -1
- package/App/ActionsProvider/LegacyActionsRegistryAdapter.tsx +17 -1
- package/App/ActionsProvider/__tests__/LegacyActionsRegistryAdapter.test.tsx +64 -0
- package/App/AssetCache/logger.ts +1 -1
- package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/usePresentSchemeHandler.ts +3 -0
- package/App/DeepLinking/URLSchemeListener/URLSchemeContextProvider.tsx +4 -1
- package/App/DeepLinking/logger.ts +1 -1
- package/App/ErrorBoundary/index.tsx +5 -2
- package/App/ModalProvider/ModalContent.tsx +3 -16
- package/App/ModalProvider/ModalPresenter.tsx +16 -1
- package/App/ModalProvider/__tests__/ModalContent.test.tsx +4 -9
- package/App/ModalProvider/__tests__/ModalPresenter.test.tsx +17 -0
- package/App/ModalProvider/__tests__/index.test.tsx +24 -0
- package/App/ModalProvider/index.tsx +10 -3
- package/App/NavigationProvider/NavigationProvider.tsx +22 -11
- package/App/NavigationProvider/__tests__/navToolbox.test.ts +227 -0
- package/App/NavigationProvider/__tests__/navigationProvider.test.tsx +56 -0
- package/App/NavigationProvider/navToolbox.ts +224 -0
- package/App/NavigationProvider/utils.ts +23 -2
- package/App/NetworkStatusProvider/NetworkStatusProvider.tsx +40 -4
- package/App/NetworkStatusProvider/ResumeVerificationController.ts +282 -0
- package/App/NetworkStatusProvider/__tests__/NetworkStatusProvider.test.tsx +167 -1
- package/App/NetworkStatusProvider/__tests__/ResumeVerificationController.test.ts +486 -0
- package/App/NetworkStatusProvider/__tests__/resumeVerification.test.ts +126 -0
- package/App/NetworkStatusProvider/__tests__/useResumeVerifiedNetInfo.test.ts +204 -0
- package/App/NetworkStatusProvider/resumeVerification.ts +54 -0
- package/App/NetworkStatusProvider/useResumeVerifiedNetInfo.ts +33 -0
- package/App/ThemeManager/index.tsx +6 -1
- package/App/appLifeCycleManager/index.tsx +2 -2
- package/App/appRemoteDataLoader/index.tsx +2 -2
- package/App/appRemoteDataLoader/remoteDataLoader.ts +2 -2
- package/App/index.tsx +8 -2
- package/App/layoutPreview/LayoutPreviewReminder.tsx +136 -0
- package/App/layoutPreview/__tests__/persistence.test.ts +63 -0
- package/App/layoutPreview/persistence.ts +228 -0
- package/App/logger.js +2 -2
- package/App/remoteContextReloader/__tests__/getNativeRemoteContextData.test.ts +148 -0
- package/App/remoteContextReloader/__tests__/getPromiseForType.test.js +31 -0
- package/App/remoteContextReloader/getRemoteContextData/getNativeRemoteContextData.ts +107 -29
- package/App/remoteContextReloader/helpers.ts +2 -1
- package/App/uiActions/index.ts +13 -0
- package/App/uiActions/muteUnmute/__tests__/assetResolver.test.ts +226 -0
- package/App/uiActions/muteUnmute/__tests__/binding.test.ts +51 -0
- package/App/uiActions/muteUnmute/__tests__/defaultAssets.test.ts +73 -0
- package/App/uiActions/muteUnmute/__tests__/entryState.test.ts +57 -0
- package/App/uiActions/muteUnmute/__tests__/labelResolver.test.ts +35 -0
- package/App/uiActions/muteUnmute/assetResolver.ts +87 -0
- package/App/uiActions/muteUnmute/assets/action/flavour_1/mute.png +0 -0
- package/App/uiActions/muteUnmute/assets/action/flavour_1/unmute.png +0 -0
- package/App/uiActions/muteUnmute/assets/action/flavour_2/mute.png +0 -0
- package/App/uiActions/muteUnmute/assets/action/flavour_2/unmute.png +0 -0
- package/App/uiActions/muteUnmute/assets/button/flavour_1/mute.png +0 -0
- package/App/uiActions/muteUnmute/assets/button/flavour_1/unmute.png +0 -0
- package/App/uiActions/muteUnmute/assets/button/flavour_2/mute.png +0 -0
- package/App/uiActions/muteUnmute/assets/button/flavour_2/unmute.png +0 -0
- package/App/uiActions/muteUnmute/defaultAssets.ts +33 -0
- package/App/uiActions/muteUnmute/entryState.ts +28 -0
- package/App/uiActions/muteUnmute/index.ts +79 -0
- package/App/uiActions/muteUnmute/labelResolver.ts +15 -0
- package/App/uiActions/muteUnmute/types.ts +18 -0
- package/package.json +8 -8
|
@@ -4,8 +4,8 @@ import { allSettled } from "promise";
|
|
|
4
4
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
5
5
|
|
|
6
6
|
import * as React from "react";
|
|
7
|
-
import {
|
|
8
|
-
const logger =
|
|
7
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
8
|
+
const logger = subsystemLogger("app/lifecycle", "AppLifeCycleManager");
|
|
9
9
|
|
|
10
10
|
const debugActions = (actions) =>
|
|
11
11
|
logger.debug({
|
|
@@ -8,7 +8,7 @@ import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
|
8
8
|
import { LegacyActionsRegistryAdapter } from "./LegacyActionsRegistryAdapter";
|
|
9
9
|
|
|
10
10
|
const { log_debug } = createLogger({
|
|
11
|
-
subsystem: "
|
|
11
|
+
subsystem: "core/actions",
|
|
12
12
|
category: "ActionRegistration",
|
|
13
13
|
});
|
|
14
14
|
|
|
@@ -5,7 +5,7 @@ import { uiActionsRegistry } from "@applicaster/zapp-react-native-utils/uiAction
|
|
|
5
5
|
import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
6
6
|
|
|
7
7
|
const { log_debug, log_warning } = createLogger({
|
|
8
|
-
subsystem: "
|
|
8
|
+
subsystem: "core/actions/legacy_registry",
|
|
9
9
|
category: "ActionRegistration",
|
|
10
10
|
});
|
|
11
11
|
|
|
@@ -66,6 +66,22 @@ function LegacyActionBridge({ plugin }: { plugin: LegacyActionPlugin }) {
|
|
|
66
66
|
};
|
|
67
67
|
}, [plugin.identifier]);
|
|
68
68
|
|
|
69
|
+
// Consumers resolve a snapshot of `value`; when the plugin publishes a new
|
|
70
|
+
// one (e.g. cast devices found), make them re-resolve so availability
|
|
71
|
+
// predicates are not read from a stale value. Registration already
|
|
72
|
+
// notifies, so the first render is skipped.
|
|
73
|
+
const isFirstValueRef = React.useRef(true);
|
|
74
|
+
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
if (isFirstValueRef.current) {
|
|
77
|
+
isFirstValueRef.current = false;
|
|
78
|
+
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
uiActionsRegistry.notifyProviderChanged(plugin.identifier);
|
|
83
|
+
}, [value, plugin.identifier]);
|
|
84
|
+
|
|
69
85
|
return null;
|
|
70
86
|
}
|
|
71
87
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
|
+
import { uiActionsRegistry } from "@applicaster/zapp-react-native-utils/uiActionsRegistrator";
|
|
4
|
+
import { LegacyActionsRegistryAdapter } from "../LegacyActionsRegistryAdapter";
|
|
5
|
+
|
|
6
|
+
const CastContext = React.createContext<any>(null);
|
|
7
|
+
|
|
8
|
+
const plugin = {
|
|
9
|
+
identifier: "cast-action-test",
|
|
10
|
+
module: { context: CastContext },
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const renderWithValue = (value) => (
|
|
14
|
+
<CastContext.Provider value={value}>
|
|
15
|
+
<LegacyActionsRegistryAdapter actionPlugins={{ cast: plugin } as any} />
|
|
16
|
+
</CastContext.Provider>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
describe("LegacyActionsRegistryAdapter", () => {
|
|
20
|
+
it("makes consumers re-resolve when the plugin publishes a new value", () => {
|
|
21
|
+
const noDevices = { isActionAvailable: () => false };
|
|
22
|
+
const devicesFound = { isActionAvailable: () => true };
|
|
23
|
+
|
|
24
|
+
const { rerender, unmount } = render(renderWithValue(noDevices));
|
|
25
|
+
|
|
26
|
+
// what a consumer resolved at first paint
|
|
27
|
+
expect(
|
|
28
|
+
uiActionsRegistry
|
|
29
|
+
.getAction("cast-action-test")
|
|
30
|
+
?.isActionAvailable?.({} as any)
|
|
31
|
+
).toBe(false);
|
|
32
|
+
|
|
33
|
+
const listener = jest.fn();
|
|
34
|
+
const unsubscribe = uiActionsRegistry.subscribe(listener);
|
|
35
|
+
|
|
36
|
+
rerender(renderWithValue(devicesFound));
|
|
37
|
+
|
|
38
|
+
expect(listener).toHaveBeenCalledTimes(1);
|
|
39
|
+
|
|
40
|
+
expect(
|
|
41
|
+
uiActionsRegistry
|
|
42
|
+
.getAction("cast-action-test")
|
|
43
|
+
?.isActionAvailable?.({} as any)
|
|
44
|
+
).toBe(true);
|
|
45
|
+
|
|
46
|
+
unsubscribe();
|
|
47
|
+
unmount();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("does not notify again when the value is unchanged", () => {
|
|
51
|
+
const stable = { isActionAvailable: () => true };
|
|
52
|
+
const { rerender, unmount } = render(renderWithValue(stable));
|
|
53
|
+
|
|
54
|
+
const listener = jest.fn();
|
|
55
|
+
const unsubscribe = uiActionsRegistry.subscribe(listener);
|
|
56
|
+
|
|
57
|
+
rerender(renderWithValue(stable));
|
|
58
|
+
|
|
59
|
+
expect(listener).not.toHaveBeenCalled();
|
|
60
|
+
|
|
61
|
+
unsubscribe();
|
|
62
|
+
unmount();
|
|
63
|
+
});
|
|
64
|
+
});
|
package/App/AssetCache/logger.ts
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
|
|
29
29
|
import { log_error, log_info } from "../../logger";
|
|
30
30
|
import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks/state";
|
|
31
|
+
import { rememberLayoutPreview } from "../../../layoutPreview/persistence";
|
|
31
32
|
|
|
32
33
|
const getFeed = (query) => ({
|
|
33
34
|
content: { src: query.data_source },
|
|
@@ -155,6 +156,8 @@ export function usePresentSchemeHandler({
|
|
|
155
156
|
rivers_configuration_id
|
|
156
157
|
);
|
|
157
158
|
|
|
159
|
+
await rememberLayoutPreview(rivers_configuration_id);
|
|
160
|
+
|
|
158
161
|
onFinish((done) => {
|
|
159
162
|
actions?.setAppReady();
|
|
160
163
|
navigator.replace(homeRiver);
|
|
@@ -3,6 +3,7 @@ import React, {
|
|
|
3
3
|
createContext,
|
|
4
4
|
useEffect,
|
|
5
5
|
useCallback,
|
|
6
|
+
useMemo,
|
|
6
7
|
ComponentType,
|
|
7
8
|
ReactChild,
|
|
8
9
|
} from "react";
|
|
@@ -196,9 +197,11 @@ function URLSchemeContextProvider(props: Props) {
|
|
|
196
197
|
};
|
|
197
198
|
}, []);
|
|
198
199
|
|
|
200
|
+
const contextValue = useMemo(() => ({ url: state, done }), [state, done]);
|
|
201
|
+
|
|
199
202
|
return (
|
|
200
203
|
<View style={fillStyles.container}>
|
|
201
|
-
<URLSchemeContext.Provider value={
|
|
204
|
+
<URLSchemeContext.Provider value={contextValue}>
|
|
202
205
|
{props.children}
|
|
203
206
|
</URLSchemeContext.Provider>
|
|
204
207
|
</View>
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import pick from "lodash/pick";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
5
5
|
import { ErrorScreen } from "@applicaster/zapp-react-native-ui-components/Components/ErrorScreen";
|
|
6
6
|
|
|
7
7
|
import { useErrorStore } from "./store";
|
|
8
8
|
import * as QuickBrickManager from "@applicaster/zapp-react-native-bridge/QuickBrick";
|
|
9
9
|
|
|
10
|
-
const errorBoundaryLogger =
|
|
10
|
+
const errorBoundaryLogger = subsystemLogger(
|
|
11
|
+
"crash/error_boundary",
|
|
12
|
+
"ErrorBoundary"
|
|
13
|
+
);
|
|
11
14
|
|
|
12
15
|
type Props = {
|
|
13
16
|
children: React.ReactNode;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { View, StyleSheet } from "react-native";
|
|
4
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
4
|
|
|
6
5
|
import { ScreenResolver } from "@applicaster/zapp-react-native-ui-components/Components/ScreenResolver";
|
|
7
6
|
|
|
@@ -18,8 +17,6 @@ const styles = StyleSheet.create({
|
|
|
18
17
|
export function ModalContent(props: Props) {
|
|
19
18
|
const { modalScreenProps } = props;
|
|
20
19
|
|
|
21
|
-
const insets = useSafeAreaInsets();
|
|
22
|
-
|
|
23
20
|
if (modalScreenProps?.screenData?.modalBottomSheetContentProps) {
|
|
24
21
|
const { ModalBottomSheetContent, modalBottomSheetContentProps } =
|
|
25
22
|
modalScreenProps?.screenData || {};
|
|
@@ -34,19 +31,9 @@ export function ModalContent(props: Props) {
|
|
|
34
31
|
|
|
35
32
|
return (
|
|
36
33
|
// A presented screen fills the window, including the status bar and home
|
|
37
|
-
// indicator.
|
|
38
|
-
//
|
|
39
|
-
<View
|
|
40
|
-
style={[
|
|
41
|
-
styles.container,
|
|
42
|
-
{
|
|
43
|
-
paddingTop: insets.top,
|
|
44
|
-
paddingBottom: insets.bottom,
|
|
45
|
-
paddingLeft: insets.left,
|
|
46
|
-
paddingRight: insets.right,
|
|
47
|
-
},
|
|
48
|
-
]}
|
|
49
|
-
>
|
|
34
|
+
// indicator. The modal wraps it in its own SafeAreaProvider, so the screen
|
|
35
|
+
// reads the real insets itself and places its own chrome inside them.
|
|
36
|
+
<View style={styles.container}>
|
|
50
37
|
<ScreenResolver {...modalScreenProps} />
|
|
51
38
|
</View>
|
|
52
39
|
);
|
|
@@ -8,12 +8,27 @@ type Props = ModalProps & {
|
|
|
8
8
|
visible: boolean;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
// RN's iPhone default is portrait only. The player locks the window to
|
|
12
|
+
// landscape before this modal is presented, and UIKit aborts the process
|
|
13
|
+
// when the two masks do not overlap. No JS error is logged.
|
|
14
|
+
const SUPPORTED_ORIENTATIONS: ModalProps["supportedOrientations"] = [
|
|
15
|
+
"portrait",
|
|
16
|
+
"portrait-upside-down",
|
|
17
|
+
"landscape",
|
|
18
|
+
"landscape-left",
|
|
19
|
+
"landscape-right",
|
|
20
|
+
];
|
|
21
|
+
|
|
11
22
|
export function ModalPresenter(props: Props) {
|
|
12
23
|
const { children, ModalContainer, visible, ...presenterOptions } = props;
|
|
13
24
|
const Presenter = React.useMemo(() => ModalContainer || Modal, []);
|
|
14
25
|
|
|
15
26
|
return (
|
|
16
|
-
<Presenter
|
|
27
|
+
<Presenter
|
|
28
|
+
visible={visible}
|
|
29
|
+
{...presenterOptions}
|
|
30
|
+
supportedOrientations={SUPPORTED_ORIENTATIONS}
|
|
31
|
+
>
|
|
17
32
|
<GestureHandlerRootView>{children}</GestureHandlerRootView>
|
|
18
33
|
</Presenter>
|
|
19
34
|
);
|
|
@@ -6,10 +6,6 @@ import { ModalContent } from "../ModalContent";
|
|
|
6
6
|
|
|
7
7
|
jest.mock("../ModalBottomSheet", () => ({ ModalBottomSheet: () => null }));
|
|
8
8
|
|
|
9
|
-
jest.mock("react-native-safe-area-context", () => ({
|
|
10
|
-
useSafeAreaInsets: () => ({ top: 59, bottom: 34, left: 0, right: 0 }),
|
|
11
|
-
}));
|
|
12
|
-
|
|
13
9
|
jest.mock(
|
|
14
10
|
"@applicaster/zapp-react-native-ui-components/Components/ScreenResolver",
|
|
15
11
|
() => ({ ScreenResolver: () => null })
|
|
@@ -18,15 +14,14 @@ jest.mock(
|
|
|
18
14
|
const flatStyle = (tree: any) => StyleSheet.flatten(tree.props.style);
|
|
19
15
|
|
|
20
16
|
describe("ModalContent", () => {
|
|
21
|
-
it("
|
|
17
|
+
it("lets a presented screen fill the modal, leaving the safe area to the screen", () => {
|
|
22
18
|
const tree = render(
|
|
23
19
|
<ModalContent modalScreenProps={{ screenId: "river-1" }} />
|
|
24
20
|
).toJSON();
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
22
|
+
// The modal provides a SafeAreaProvider instead, so the presented screen
|
|
23
|
+
// reads the real insets itself rather than being padded from the outside.
|
|
24
|
+
expect(flatStyle(tree)).toEqual({ flex: 1 });
|
|
30
25
|
});
|
|
31
26
|
|
|
32
27
|
it("leaves a bottom sheet full-bleed", () => {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Modal } from "react-native";
|
|
3
|
+
import { render } from "@testing-library/react-native";
|
|
4
|
+
|
|
5
|
+
import { ModalPresenter } from "../ModalPresenter";
|
|
6
|
+
|
|
7
|
+
describe("ModalPresenter", () => {
|
|
8
|
+
it("supports landscape so a player rotation does not abort presentation", () => {
|
|
9
|
+
const { UNSAFE_getByType } = render(
|
|
10
|
+
<ModalPresenter visible>{null}</ModalPresenter>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
expect(UNSAFE_getByType(Modal).props.supportedOrientations).toEqual(
|
|
14
|
+
expect.arrayContaining(["portrait", "landscape"])
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -11,6 +11,9 @@ import { ModalProvider } from "../";
|
|
|
11
11
|
*/
|
|
12
12
|
const mockSeenScreenData: any[] = [];
|
|
13
13
|
|
|
14
|
+
/** Records the `initialMetrics` each SafeAreaProvider the modal renders got. */
|
|
15
|
+
const mockSafeAreaProviderMetrics: any[] = [];
|
|
16
|
+
|
|
14
17
|
jest.mock(
|
|
15
18
|
"@applicaster/zapp-react-native-ui-components/Components/ScreenResolver",
|
|
16
19
|
() => {
|
|
@@ -43,6 +46,14 @@ jest.mock("../ModalBottomSheet", () => ({ ModalBottomSheet: () => null }));
|
|
|
43
46
|
|
|
44
47
|
jest.mock("react-native-safe-area-context", () => ({
|
|
45
48
|
useSafeAreaInsets: () => ({ top: 0, bottom: 0, left: 0, right: 0 }),
|
|
49
|
+
// A modal renders in its own native window, so it needs its own provider
|
|
50
|
+
// seeded with the window metrics; without them insets read as zero inside.
|
|
51
|
+
initialWindowMetrics: { insets: { top: 59, bottom: 34, left: 0, right: 0 } },
|
|
52
|
+
SafeAreaProvider: ({ children, initialMetrics }: any) => {
|
|
53
|
+
mockSafeAreaProviderMetrics.push(initialMetrics);
|
|
54
|
+
|
|
55
|
+
return children;
|
|
56
|
+
},
|
|
46
57
|
}));
|
|
47
58
|
|
|
48
59
|
const river = { id: "river-parent-lock", type: "parent_lock" } as any;
|
|
@@ -54,6 +65,7 @@ const seen = () => mockSeenScreenData[mockSeenScreenData.length - 1];
|
|
|
54
65
|
describe("ModalProvider", () => {
|
|
55
66
|
beforeEach(() => {
|
|
56
67
|
mockSeenScreenData.length = 0;
|
|
68
|
+
mockSafeAreaProviderMetrics.length = 0;
|
|
57
69
|
modalStore.getState().dismissModal();
|
|
58
70
|
});
|
|
59
71
|
|
|
@@ -72,4 +84,16 @@ describe("ModalProvider", () => {
|
|
|
72
84
|
|
|
73
85
|
expect(seen()).toMatchObject({ screen: river });
|
|
74
86
|
});
|
|
87
|
+
|
|
88
|
+
it("seeds the presented screen's safe area with the window metrics", () => {
|
|
89
|
+
const { initialWindowMetrics } = require("react-native-safe-area-context");
|
|
90
|
+
|
|
91
|
+
modalStore.getState().openModal({ item: river });
|
|
92
|
+
|
|
93
|
+
render(<ModalProvider />);
|
|
94
|
+
|
|
95
|
+
expect(mockSafeAreaProviderMetrics).toEqual(
|
|
96
|
+
expect.arrayContaining([initialWindowMetrics])
|
|
97
|
+
);
|
|
98
|
+
});
|
|
75
99
|
});
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
+
import {
|
|
4
|
+
initialWindowMetrics,
|
|
5
|
+
SafeAreaProvider,
|
|
6
|
+
} from "react-native-safe-area-context";
|
|
7
|
+
|
|
3
8
|
import { ModalPresenter } from "./ModalPresenter";
|
|
4
9
|
import { ModalContent } from "./ModalContent";
|
|
5
10
|
import { ModalChildrenWrapper } from "./ModalChildrenWrapper";
|
|
@@ -62,9 +67,11 @@ export function ModalProvider() {
|
|
|
62
67
|
{...modalState?.options}
|
|
63
68
|
statusBarTranslucent
|
|
64
69
|
>
|
|
65
|
-
<
|
|
66
|
-
<
|
|
67
|
-
|
|
70
|
+
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
|
|
71
|
+
<ModalChildrenWrapper>
|
|
72
|
+
<ModalContent modalScreenProps={modalScreenProps} />
|
|
73
|
+
</ModalChildrenWrapper>
|
|
74
|
+
</SafeAreaProvider>
|
|
68
75
|
</ModalPresenter>
|
|
69
76
|
</ScreenContextProvider>
|
|
70
77
|
</ScreenDataContext.Provider>
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
useGetScreenOrientation,
|
|
14
14
|
} from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
|
|
15
15
|
import { focusManager } from "@applicaster/zapp-react-native-utils/focusManager/FocusManager";
|
|
16
|
+
import { setXrayNavigator } from "@applicaster/zapp-react-native-utils/navigationUtils/xrayNavigator";
|
|
17
|
+
import { registerNavToolbox } from "./navToolbox";
|
|
16
18
|
|
|
17
19
|
import reducer, {
|
|
18
20
|
ACTIONS,
|
|
@@ -43,7 +45,6 @@ import {
|
|
|
43
45
|
startUpHookPluginIdentifiersSelector,
|
|
44
46
|
} from "./navigator/selectors";
|
|
45
47
|
|
|
46
|
-
import { coreAppLogger } from "../logger";
|
|
47
48
|
import {
|
|
48
49
|
getPlatform,
|
|
49
50
|
isTV,
|
|
@@ -87,8 +88,9 @@ import {
|
|
|
87
88
|
useLayoutVersion,
|
|
88
89
|
useRivers,
|
|
89
90
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
91
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
90
92
|
|
|
91
|
-
const logger =
|
|
93
|
+
const logger = subsystemLogger("ui/navigation", "Navigator");
|
|
92
94
|
|
|
93
95
|
type Props = {
|
|
94
96
|
children?: React.ReactChild;
|
|
@@ -243,6 +245,10 @@ export function NavigationProvider({ children }: Props) {
|
|
|
243
245
|
playNextOverlayState.current = state;
|
|
244
246
|
};
|
|
245
247
|
|
|
248
|
+
// The play-next overlay owns remote focus while it is visible, so key
|
|
249
|
+
// handling (InteractionManager) needs to be able to ask for it.
|
|
250
|
+
const getPlayNextOverlay = () => playNextOverlayState.current ?? null;
|
|
251
|
+
|
|
246
252
|
const setNestedScreenContent = (entry: ZappEntry, screenId: string) => {
|
|
247
253
|
const screen = rivers[screenId];
|
|
248
254
|
const parent = findParent(context, navigator.currentRoute);
|
|
@@ -349,10 +355,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
349
355
|
state: firstRoute.state,
|
|
350
356
|
};
|
|
351
357
|
|
|
352
|
-
if (
|
|
353
|
-
stateForBack?.state?.entry &&
|
|
354
|
-
"home" in stateForBack?.state?.entry
|
|
355
|
-
) {
|
|
358
|
+
if (stateForBack?.state?.entry?.home) {
|
|
356
359
|
goHome();
|
|
357
360
|
} else {
|
|
358
361
|
dispatch(back(stateForBack));
|
|
@@ -759,11 +762,11 @@ export function NavigationProvider({ children }: Props) {
|
|
|
759
762
|
const getStackForPathname = (
|
|
760
763
|
pathname: string
|
|
761
764
|
): NavigationScreenState | undefined => {
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
765
|
+
// Topmost match: the active screen if a route is on the stack twice.
|
|
766
|
+
return R.findLast(
|
|
767
|
+
({ route }) => route === pathname,
|
|
768
|
+
state?.stack?.mainStack ?? []
|
|
769
|
+
);
|
|
767
770
|
};
|
|
768
771
|
|
|
769
772
|
const navigator: QuickBrickAppNavigator = React.useMemo(
|
|
@@ -777,6 +780,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
777
780
|
replace: replaceItem,
|
|
778
781
|
setNestedScreenContent,
|
|
779
782
|
setPlayNextOverlay,
|
|
783
|
+
getPlayNextOverlay,
|
|
780
784
|
goHome,
|
|
781
785
|
canGoBack,
|
|
782
786
|
goBack,
|
|
@@ -827,6 +831,13 @@ export function NavigationProvider({ children }: Props) {
|
|
|
827
831
|
navigator.state = state;
|
|
828
832
|
}
|
|
829
833
|
|
|
834
|
+
React.useLayoutEffect(() => {
|
|
835
|
+
setXrayNavigator(navigator);
|
|
836
|
+
registerNavToolbox();
|
|
837
|
+
|
|
838
|
+
return () => setXrayNavigator(undefined);
|
|
839
|
+
}, [navigator]);
|
|
840
|
+
|
|
830
841
|
React.useLayoutEffect(() => {
|
|
831
842
|
if (pathname === "/" && appLaunched) {
|
|
832
843
|
goHome(true);
|