@applicaster/zapp-react-native-ui-components 15.0.0-alpha.8621453569 → 15.0.0-alpha.9300744523
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/Components/BaseFocusable/index.ios.ts +12 -2
- package/Components/Cell/FocusableWrapper.tsx +3 -0
- package/Components/Cell/TvOSCellComponent.tsx +17 -5
- package/Components/Focusable/Focusable.tsx +4 -2
- package/Components/Focusable/FocusableTvOS.tsx +18 -1
- package/Components/Focusable/__tests__/__snapshots__/FocusableTvOS.test.tsx.snap +1 -0
- package/Components/FocusableGroup/FocusableTvOS.tsx +32 -1
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +14 -3
- package/Components/HandlePlayable/HandlePlayable.tsx +10 -7
- package/Components/Layout/TV/LayoutBackground.tsx +5 -2
- package/Components/Layout/TV/ScreenContainer.tsx +2 -6
- package/Components/Layout/TV/index.tsx +3 -4
- package/Components/Layout/TV/index.web.tsx +3 -4
- package/Components/LinkHandler/LinkHandler.tsx +2 -2
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -4
- package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +11 -3
- package/Components/MasterCell/DefaultComponents/Image/Image.web.tsx +9 -1
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +15 -14
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +10 -6
- package/Components/MasterCell/utils/__tests__/resolveColor.test.js +82 -3
- package/Components/MasterCell/utils/index.ts +61 -31
- package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +102 -87
- package/Components/MeasurmentsPortal/__tests__/MeasurementsPortal.test.tsx +355 -0
- package/Components/OfflineHandler/NotificationView/NotificationView.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +17 -18
- package/Components/OfflineHandler/__tests__/index.test.tsx +27 -18
- package/Components/PlayerContainer/PlayerContainer.tsx +51 -40
- package/Components/PlayerContainer/useRestrictMobilePlayback.tsx +101 -0
- package/Components/River/TV/River.tsx +31 -14
- package/Components/River/TV/index.tsx +8 -4
- package/Components/River/TV/utils/__tests__/toStringOrEmpty.test.ts +30 -0
- package/Components/River/TV/utils/index.ts +4 -0
- package/Components/River/TV/withFocusableGroupForContent.tsx +71 -0
- package/Components/Screen/TV/index.web.tsx +4 -2
- package/Components/Screen/__tests__/Screen.test.tsx +65 -42
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +68 -44
- package/Components/Screen/hooks.ts +2 -3
- package/Components/Screen/index.tsx +2 -3
- package/Components/Screen/navigationHandler.ts +49 -24
- package/Components/Screen/orientationHandler.ts +3 -3
- package/Components/ScreenResolver/index.tsx +13 -7
- package/Components/ScreenRevealManager/ScreenRevealManager.ts +40 -8
- package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +86 -69
- package/Components/Transitioner/Scene.tsx +15 -2
- package/Components/Transitioner/index.js +3 -3
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +13 -9
- package/Components/VideoModal/utils.ts +12 -9
- package/Decorators/Analytics/index.tsx +6 -5
- package/Decorators/ConfigurationWrapper/__tests__/__snapshots__/withConfigurationProvider.test.tsx.snap +1 -0
- package/Decorators/ConfigurationWrapper/const.ts +1 -0
- package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +1 -1
- package/Decorators/ZappPipesDataConnector/index.tsx +2 -2
- package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +1 -1
- package/Helpers/DataSourceHelper/__tests__/itemLimitForData.test.ts +80 -0
- package/Helpers/DataSourceHelper/index.ts +19 -0
- package/package.json +6 -5
- package/Components/River/TV/withTVEventHandler.tsx +0 -27
- package/Helpers/DataSourceHelper/index.js +0 -19
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="@applicaster/applicaster-types" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { AccessibilityInfo, findNodeHandle, View } from "react-native";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
|
|
6
5
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
7
6
|
import { getComponentModule } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
8
7
|
import {
|
|
@@ -41,7 +40,7 @@ type Props = {
|
|
|
41
40
|
export function Screen(_props: Props) {
|
|
42
41
|
const theme = useTheme<BaseThemePropertiesMobile>();
|
|
43
42
|
const navigation = useNavigation();
|
|
44
|
-
const
|
|
43
|
+
const plugins = usePlugins();
|
|
45
44
|
|
|
46
45
|
// Gets the data for the current screen configuration
|
|
47
46
|
const currentScreenData = useCurrentScreenData();
|
|
@@ -1,35 +1,19 @@
|
|
|
1
1
|
import { resolveNavigationPlugin } from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
* - playable screens
|
|
11
|
-
* - qb_search_screen
|
|
12
|
-
* - screen hooks that specify showNavBar or presentFullScreen
|
|
13
|
-
* - screens or nested screens that have allow_screen_plugin_presentation set to true
|
|
14
|
-
*
|
|
15
|
-
* @param {String} route current route of the screen
|
|
16
|
-
* @param {Object} screenData payload associated with the currently presented screen
|
|
17
|
-
* @returns {Boolean}
|
|
18
|
-
*/
|
|
19
|
-
export function isMenuVisible(route, screenData, plugins) {
|
|
20
|
-
const plugin = resolveNavigationPlugin({
|
|
3
|
+
export const BOTTOM_TABS_PLUGIN_ID = "quick-brick-bottom-tabs";
|
|
4
|
+
|
|
5
|
+
export const SIDE_MENU_PLUGIN_ID = "quick_brick_side_menu";
|
|
6
|
+
|
|
7
|
+
export function getMenuPlugin(screenData, plugins) {
|
|
8
|
+
return resolveNavigationPlugin({
|
|
21
9
|
category: "menu",
|
|
22
10
|
navigations:
|
|
23
11
|
screenData?.navigations || screenData?.targetScreen?.navigations,
|
|
24
12
|
plugins,
|
|
25
13
|
});
|
|
14
|
+
}
|
|
26
15
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!isBottomTabsPlugin) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
|
|
16
|
+
function shouldShowNavigation(route, screenData) {
|
|
33
17
|
if (route.includes("playable")) {
|
|
34
18
|
return false;
|
|
35
19
|
}
|
|
@@ -56,3 +40,44 @@ export function isMenuVisible(route, screenData, plugins) {
|
|
|
56
40
|
|
|
57
41
|
return true;
|
|
58
42
|
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* This function helps to decide whether the menu should be presented on the screen
|
|
46
|
+
* based on route and / or screen Data
|
|
47
|
+
*
|
|
48
|
+
* is similar to the navbar, except that it covers scenarios where only the navbar (and not)
|
|
49
|
+
* the menu will be hidden
|
|
50
|
+
*
|
|
51
|
+
* - playable screens
|
|
52
|
+
* - qb_search_screen
|
|
53
|
+
* - screen hooks that specify showNavBar or presentFullScreen
|
|
54
|
+
* - screens or nested screens that have allow_screen_plugin_presentation set to true
|
|
55
|
+
*
|
|
56
|
+
* @param {String} route current route of the screen
|
|
57
|
+
* @param {Object} screenData payload associated with the currently presented screen
|
|
58
|
+
* @returns {Boolean}
|
|
59
|
+
*/
|
|
60
|
+
export function isMenuVisible(route, screenData, plugins) {
|
|
61
|
+
const plugin = getMenuPlugin(screenData, plugins);
|
|
62
|
+
|
|
63
|
+
const isBottomTabsPlugin = plugin?.identifier === BOTTOM_TABS_PLUGIN_ID;
|
|
64
|
+
const isSideMenuPlugin = plugin?.identifier === SIDE_MENU_PLUGIN_ID;
|
|
65
|
+
|
|
66
|
+
if (!isBottomTabsPlugin && !isSideMenuPlugin) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return shouldShowNavigation(route, screenData);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function isBottomTabVisible(route, screenData, plugins) {
|
|
74
|
+
const plugin = getMenuPlugin(screenData, plugins);
|
|
75
|
+
|
|
76
|
+
const isBottomTabsPlugin = plugin?.identifier === BOTTOM_TABS_PLUGIN_ID;
|
|
77
|
+
|
|
78
|
+
if (!isBottomTabsPlugin) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return shouldShowNavigation(route, screenData);
|
|
83
|
+
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
useGetScreenOrientation,
|
|
8
8
|
} from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
|
|
9
9
|
import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
|
|
10
|
-
import {
|
|
10
|
+
import { usePlugins, useAppData } from "@applicaster/zapp-react-native-redux";
|
|
11
11
|
import { findPluginByType } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
12
12
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
13
13
|
|
|
@@ -65,8 +65,8 @@ export function useNewOrientationForScreenData({
|
|
|
65
65
|
}: OrientationHookArgs) {
|
|
66
66
|
const isTablet = useIsTablet();
|
|
67
67
|
|
|
68
|
-
const
|
|
69
|
-
const isTabletPortrait =
|
|
68
|
+
const plugins = usePlugins();
|
|
69
|
+
const { isTabletPortrait } = useAppData();
|
|
70
70
|
const isLandscapeTablet = isTablet && !isTabletPortrait;
|
|
71
71
|
|
|
72
72
|
const screenOrientation = useGetScreenOrientation(screenData);
|
|
@@ -11,12 +11,19 @@ import { LinkHandler } from "../LinkHandler";
|
|
|
11
11
|
import { Favorites } from "../Favorites";
|
|
12
12
|
import { ZappPipesScreenContext } from "../../Contexts";
|
|
13
13
|
import { componentsLogger } from "../../Helpers/logger";
|
|
14
|
-
import {
|
|
15
|
-
|
|
14
|
+
import {
|
|
15
|
+
useAppSelector,
|
|
16
|
+
usePlugins,
|
|
17
|
+
} from "@applicaster/zapp-react-native-redux/hooks";
|
|
18
|
+
import {
|
|
19
|
+
useNavigation,
|
|
20
|
+
useRivers,
|
|
21
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
16
22
|
import { useScreenAnalytics } from "@applicaster/zapp-react-native-utils/analyticsUtils/helpers/hooks";
|
|
17
23
|
|
|
18
24
|
import { useCallbackActions } from "@applicaster/zapp-react-native-utils/zappFrameworkUtils/HookCallback/useCallbackActions";
|
|
19
25
|
import { ScreenResultCallback } from "@applicaster/zapp-react-native-utils/zappFrameworkUtils/HookCallback/callbackNavigationAction";
|
|
26
|
+
import { selectComponents } from "@applicaster/zapp-react-native-redux";
|
|
20
27
|
|
|
21
28
|
const logger = componentsLogger.addSubsystem("ScreenResolver");
|
|
22
29
|
|
|
@@ -49,11 +56,10 @@ export function ScreenResolverComponent(props: Props) {
|
|
|
49
56
|
|
|
50
57
|
const { hookPlugin } = screenData || {};
|
|
51
58
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
]);
|
|
59
|
+
const plugins = usePlugins();
|
|
60
|
+
const rivers = useRivers();
|
|
61
|
+
|
|
62
|
+
const components = useAppSelector(selectComponents);
|
|
57
63
|
|
|
58
64
|
const {
|
|
59
65
|
videoModalState: { mode },
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { makeListOf } from "@applicaster/zapp-react-native-utils/arrayUtils";
|
|
2
2
|
import { isFirstComponentGallery } from "@applicaster/zapp-react-native-utils/componentsUtils";
|
|
3
|
-
import {
|
|
3
|
+
import { race, Subject, Subscription } from "rxjs";
|
|
4
|
+
import { first } from "rxjs/operators";
|
|
5
|
+
|
|
6
|
+
import { withTimeout$ } from "@applicaster/zapp-react-native-utils/idleUtils";
|
|
7
|
+
|
|
8
|
+
const MAX_TIMEOUT_TO_WAIT_COMPONENTS_TO_LOAD = 2000; // 2 seconds
|
|
4
9
|
|
|
5
10
|
const INITIAL_NUMBER_TO_LOAD = 3;
|
|
6
11
|
|
|
@@ -34,7 +39,8 @@ const getNumberOfComponentsWaitToLoadBeforePresent = (
|
|
|
34
39
|
export class ScreenRevealManager {
|
|
35
40
|
public numberOfComponentsWaitToLoadBeforePresent: number;
|
|
36
41
|
private renderingState: Array<ComponentLoadingState>;
|
|
37
|
-
private
|
|
42
|
+
private subject$ = new Subject<void>();
|
|
43
|
+
private subscription: Subscription;
|
|
38
44
|
|
|
39
45
|
constructor(componentsToRender: ZappUIComponent[], callback: Callback) {
|
|
40
46
|
this.numberOfComponentsWaitToLoadBeforePresent =
|
|
@@ -45,32 +51,58 @@ export class ScreenRevealManager {
|
|
|
45
51
|
this.numberOfComponentsWaitToLoadBeforePresent
|
|
46
52
|
);
|
|
47
53
|
|
|
48
|
-
this.
|
|
54
|
+
this.subscription = race(
|
|
55
|
+
withTimeout$(MAX_TIMEOUT_TO_WAIT_COMPONENTS_TO_LOAD),
|
|
56
|
+
this.subject$
|
|
57
|
+
)
|
|
58
|
+
.pipe(first())
|
|
59
|
+
.subscribe(callback);
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
onLoadFinished = (index: number): void => {
|
|
63
|
+
const currentState = this.renderingState[index];
|
|
64
|
+
|
|
65
|
+
if (
|
|
66
|
+
COMPONENT_LOADING_STATE.LOADED_WITH_SUCCESS === currentState ||
|
|
67
|
+
COMPONENT_LOADING_STATE.LOADED_WITH_FAILURE === currentState
|
|
68
|
+
) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
52
72
|
this.renderingState[index] = COMPONENT_LOADING_STATE.LOADED_WITH_SUCCESS;
|
|
53
73
|
|
|
54
74
|
if (
|
|
55
75
|
getNumberOfLoaded(this.renderingState) >=
|
|
56
76
|
this.numberOfComponentsWaitToLoadBeforePresent
|
|
57
77
|
) {
|
|
58
|
-
this.
|
|
78
|
+
this.subject$.next();
|
|
79
|
+
this.subject$.complete();
|
|
59
80
|
}
|
|
60
81
|
};
|
|
61
82
|
|
|
62
83
|
onLoadFailed = (index: number): void => {
|
|
84
|
+
const currentState = this.renderingState[index];
|
|
85
|
+
|
|
86
|
+
if (
|
|
87
|
+
COMPONENT_LOADING_STATE.LOADED_WITH_SUCCESS === currentState ||
|
|
88
|
+
COMPONENT_LOADING_STATE.LOADED_WITH_FAILURE === currentState
|
|
89
|
+
) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
63
93
|
this.renderingState[index] = COMPONENT_LOADING_STATE.LOADED_WITH_FAILURE;
|
|
64
94
|
|
|
65
95
|
if (
|
|
66
96
|
getNumberOfLoaded(this.renderingState) >=
|
|
67
97
|
this.numberOfComponentsWaitToLoadBeforePresent
|
|
68
98
|
) {
|
|
69
|
-
this.
|
|
99
|
+
this.subject$.next();
|
|
100
|
+
this.subject$.complete();
|
|
70
101
|
}
|
|
71
102
|
};
|
|
72
103
|
|
|
73
|
-
|
|
74
|
-
this.
|
|
75
|
-
|
|
104
|
+
dispose(): void {
|
|
105
|
+
this.subscription?.unsubscribe();
|
|
106
|
+
this.subject$.complete();
|
|
107
|
+
}
|
|
76
108
|
}
|
|
@@ -2,106 +2,123 @@ import {
|
|
|
2
2
|
ScreenRevealManager,
|
|
3
3
|
COMPONENT_LOADING_STATE,
|
|
4
4
|
} from "../ScreenRevealManager";
|
|
5
|
+
import { Subject } from "rxjs";
|
|
6
|
+
|
|
7
|
+
jest.mock("@applicaster/zapp-react-native-utils/arrayUtils", () => ({
|
|
8
|
+
makeListOf: jest.fn((value: any, length: number) =>
|
|
9
|
+
Array(length).fill(value)
|
|
10
|
+
),
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
jest.mock("@applicaster/zapp-react-native-utils/componentsUtils", () => ({
|
|
14
|
+
isFirstComponentGallery: jest.fn(),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
jest.mock("@applicaster/zapp-react-native-utils/idleUtils", () => ({
|
|
18
|
+
withTimeout$: jest.fn(),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
import { makeListOf } from "@applicaster/zapp-react-native-utils/arrayUtils";
|
|
22
|
+
import { isFirstComponentGallery } from "@applicaster/zapp-react-native-utils/componentsUtils";
|
|
23
|
+
import { withTimeout$ } from "@applicaster/zapp-react-native-utils/idleUtils";
|
|
5
24
|
|
|
6
25
|
describe("ScreenRevealManager", () => {
|
|
7
|
-
|
|
26
|
+
let mockCallback: jest.Mock;
|
|
27
|
+
let timeout$: Subject<void>;
|
|
8
28
|
|
|
9
29
|
beforeEach(() => {
|
|
10
|
-
jest.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
it("should initialize with the correct number of components to wait for", () => {
|
|
14
|
-
const componentsToRender: ZappUIComponent[] = [
|
|
15
|
-
{ component_type: "component1" },
|
|
16
|
-
{ component_type: "component2" },
|
|
17
|
-
{ component_type: "component3" },
|
|
18
|
-
];
|
|
30
|
+
jest.useFakeTimers();
|
|
31
|
+
mockCallback = jest.fn();
|
|
32
|
+
timeout$ = new Subject();
|
|
19
33
|
|
|
20
|
-
|
|
34
|
+
(withTimeout$ as jest.Mock).mockReturnValue(timeout$);
|
|
35
|
+
(isFirstComponentGallery as jest.Mock).mockReturnValue(false);
|
|
21
36
|
|
|
22
|
-
|
|
37
|
+
(makeListOf as jest.Mock).mockImplementation((value, length) =>
|
|
38
|
+
Array(length).fill(value)
|
|
39
|
+
);
|
|
40
|
+
});
|
|
23
41
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
]);
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
jest.clearAllTimers();
|
|
44
|
+
jest.useRealTimers();
|
|
45
|
+
jest.resetAllMocks();
|
|
29
46
|
});
|
|
30
47
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{ component_type: "component3" },
|
|
36
|
-
];
|
|
48
|
+
// ────────────────────────────────────────────────
|
|
49
|
+
it("should initialize with correct number of components and UNKNOWN state", () => {
|
|
50
|
+
const components = new Array(5).fill({});
|
|
51
|
+
const mgr = new ScreenRevealManager(components, mockCallback);
|
|
37
52
|
|
|
38
|
-
|
|
53
|
+
expect(mgr.numberOfComponentsWaitToLoadBeforePresent).toBe(3);
|
|
54
|
+
expect(makeListOf).toHaveBeenCalledWith(COMPONENT_LOADING_STATE.UNKNOWN, 3);
|
|
55
|
+
});
|
|
39
56
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
57
|
+
// ────────────────────────────────────────────────
|
|
58
|
+
it("should set numberOfComponentsWaitToLoadBeforePresent to 1 if first component is gallery", () => {
|
|
59
|
+
(isFirstComponentGallery as jest.Mock).mockReturnValue(true);
|
|
43
60
|
|
|
44
|
-
|
|
61
|
+
const components = new Array(5).fill({});
|
|
62
|
+
const mgr = new ScreenRevealManager(components, mockCallback);
|
|
63
|
+
|
|
64
|
+
expect(mgr.numberOfComponentsWaitToLoadBeforePresent).toBe(1);
|
|
45
65
|
});
|
|
46
66
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{ component_type: "component3" },
|
|
52
|
-
];
|
|
67
|
+
// ────────────────────────────────────────────────
|
|
68
|
+
it("should trigger callback after all components load successfully", () => {
|
|
69
|
+
const components = new Array(3).fill({});
|
|
70
|
+
const mgr = new ScreenRevealManager(components, mockCallback);
|
|
53
71
|
|
|
54
|
-
|
|
72
|
+
mgr.onLoadFinished(0);
|
|
73
|
+
expect(mockCallback).not.toHaveBeenCalled();
|
|
55
74
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
manager.onLoadFailed(2);
|
|
75
|
+
mgr.onLoadFinished(1);
|
|
76
|
+
expect(mockCallback).not.toHaveBeenCalled();
|
|
59
77
|
|
|
78
|
+
mgr.onLoadFinished(2);
|
|
60
79
|
expect(mockCallback).toHaveBeenCalledTimes(1);
|
|
61
80
|
});
|
|
62
81
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
{ component_type: "component3" },
|
|
68
|
-
];
|
|
69
|
-
|
|
70
|
-
const manager = new ScreenRevealManager(componentsToRender, mockCallback);
|
|
82
|
+
// ────────────────────────────────────────────────
|
|
83
|
+
it("should trigger callback after some components fail to load but all finished", () => {
|
|
84
|
+
const components = new Array(3).fill({});
|
|
85
|
+
const mgr = new ScreenRevealManager(components, mockCallback);
|
|
71
86
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
mgr.onLoadFinished(0);
|
|
88
|
+
mgr.onLoadFailed(1);
|
|
89
|
+
mgr.onLoadFailed(2);
|
|
75
90
|
|
|
76
91
|
expect(mockCallback).toHaveBeenCalledTimes(1);
|
|
77
92
|
});
|
|
78
93
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{ component_type: "component3" },
|
|
84
|
-
];
|
|
85
|
-
|
|
86
|
-
const manager = new ScreenRevealManager(componentsToRender, mockCallback);
|
|
94
|
+
// ────────────────────────────────────────────────
|
|
95
|
+
it("should not trigger callback twice when same component finishes twice", () => {
|
|
96
|
+
const components = new Array(3).fill({});
|
|
97
|
+
const mgr = new ScreenRevealManager(components, mockCallback);
|
|
87
98
|
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
mgr.onLoadFinished(0);
|
|
100
|
+
mgr.onLoadFinished(0); // duplicate
|
|
101
|
+
mgr.onLoadFinished(1);
|
|
102
|
+
mgr.onLoadFinished(2);
|
|
90
103
|
|
|
91
|
-
expect(mockCallback).
|
|
104
|
+
expect(mockCallback).toHaveBeenCalledTimes(1);
|
|
92
105
|
});
|
|
93
106
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
{ component_type: "component3" },
|
|
99
|
-
];
|
|
107
|
+
// ────────────────────────────────────────────────
|
|
108
|
+
it("should trigger callback when timeout$ emits before all loaded", () => {
|
|
109
|
+
const components = new Array(3).fill({});
|
|
110
|
+
new ScreenRevealManager(components, mockCallback);
|
|
100
111
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
manager.onLoadFinished(0);
|
|
112
|
+
timeout$.next(); // simulate timeout event from withTimeout$
|
|
104
113
|
|
|
105
114
|
expect(mockCallback).toHaveBeenCalledTimes(1);
|
|
106
115
|
});
|
|
116
|
+
|
|
117
|
+
// ────────────────────────────────────────────────
|
|
118
|
+
it("should not call callback if nothing loads and no timeout emitted", () => {
|
|
119
|
+
const components = new Array(3).fill({});
|
|
120
|
+
new ScreenRevealManager(components, mockCallback);
|
|
121
|
+
|
|
122
|
+
expect(mockCallback).not.toHaveBeenCalled();
|
|
123
|
+
});
|
|
107
124
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
2
|
import { equals } from "ramda";
|
|
3
3
|
import { Animated, ViewProps, ViewStyle } from "react-native";
|
|
4
4
|
import { useSafeAreaFrame } from "react-native-safe-area-context";
|
|
@@ -95,9 +95,22 @@ function SceneComponent({
|
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
const frame = useSafeAreaFrame();
|
|
98
|
+
|
|
99
|
+
const [memoFrame, setMemoFrame] = React.useState(frame);
|
|
100
|
+
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (isActive) {
|
|
103
|
+
setMemoFrame((oldFrame) =>
|
|
104
|
+
oldFrame.width === frame.width && oldFrame.height === frame.height
|
|
105
|
+
? oldFrame
|
|
106
|
+
: frame
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}, [isActive, frame.width, frame.height]);
|
|
110
|
+
|
|
98
111
|
const isAnimating = animating && overlayStyle;
|
|
99
112
|
|
|
100
|
-
const dimensions = isAnimating ? fullWidthDimensions :
|
|
113
|
+
const dimensions = isAnimating ? fullWidthDimensions : memoFrame;
|
|
101
114
|
|
|
102
115
|
return (
|
|
103
116
|
<Animated.View
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
3
3
|
import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks/layout";
|
|
4
|
-
import {
|
|
4
|
+
import { useAppData } from "@applicaster/zapp-react-native-redux";
|
|
5
|
+
|
|
5
6
|
import { TransitionerComponent } from "./Transitioner";
|
|
6
7
|
|
|
7
8
|
export const Transitioner = (props) => {
|
|
@@ -16,8 +17,7 @@ export const Transitioner = (props) => {
|
|
|
16
17
|
deviceInfo: true,
|
|
17
18
|
});
|
|
18
19
|
|
|
19
|
-
const {
|
|
20
|
-
const isTabletPortrait = appData?.isTabletPortrait;
|
|
20
|
+
const { isTabletPortrait } = useAppData();
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<TransitionerComponent
|
|
@@ -4,8 +4,11 @@ import { Animated, Dimensions } from "react-native";
|
|
|
4
4
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
|
|
5
5
|
|
|
6
6
|
import { useConfiguration } from "../utils";
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
useAppData,
|
|
9
|
+
usePlugins,
|
|
10
|
+
} from "@applicaster/zapp-react-native-redux/hooks";
|
|
11
|
+
import { isBottomTabVisible } from "../../Screen/navigationHandler";
|
|
9
12
|
|
|
10
13
|
import {
|
|
11
14
|
useSafeAreaFrame,
|
|
@@ -18,7 +21,6 @@ import {
|
|
|
18
21
|
import { getTabBarHeight } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/getTabBarHeight";
|
|
19
22
|
import { PROGRESS_BAR_HEIGHT } from "./utils";
|
|
20
23
|
import { useIsTablet as getIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
21
|
-
import { useAppSelector } from "@applicaster/zapp-react-native-redux";
|
|
22
24
|
|
|
23
25
|
export type ModalAnimationContextT = {
|
|
24
26
|
yTranslate: React.MutableRefObject<Animated.AnimatedInterpolation<number>>;
|
|
@@ -64,13 +66,15 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
64
66
|
screenData,
|
|
65
67
|
} = useNavigation();
|
|
66
68
|
|
|
67
|
-
const isTabletPortrait =
|
|
68
|
-
(state) => state.appData.isTabletPortrait
|
|
69
|
-
);
|
|
69
|
+
const { isTabletPortrait } = useAppData();
|
|
70
70
|
|
|
71
71
|
const plugins = usePlugins();
|
|
72
72
|
|
|
73
|
-
const
|
|
73
|
+
const bottomTabsVisible = isBottomTabVisible(
|
|
74
|
+
currentRoute,
|
|
75
|
+
screenData,
|
|
76
|
+
plugins
|
|
77
|
+
);
|
|
74
78
|
|
|
75
79
|
const frame = useSafeAreaFrame();
|
|
76
80
|
const insets = useSafeAreaInsets();
|
|
@@ -115,7 +119,7 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
115
119
|
React.useEffect(() => {
|
|
116
120
|
const collapsedHeight =
|
|
117
121
|
minimisedHeight +
|
|
118
|
-
(
|
|
122
|
+
(bottomTabsVisible ? bottomTabBarHeight : 0) +
|
|
119
123
|
(isOldAndroidDevice ? 0 : insets.bottom) + // insets.bottom is added to properly display docked modal
|
|
120
124
|
PROGRESS_BAR_HEIGHT;
|
|
121
125
|
|
|
@@ -136,7 +140,7 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
136
140
|
setHeightAboveMinimised(heightAboveMinimised);
|
|
137
141
|
offset.current = heightAboveMinimised;
|
|
138
142
|
}
|
|
139
|
-
}, [frame.height, insets.bottom,
|
|
143
|
+
}, [frame.height, insets.bottom, bottomTabsVisible, minimisedHeight]);
|
|
140
144
|
|
|
141
145
|
return (
|
|
142
146
|
<ReactContext.Provider
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import { mergeRight } from "ramda";
|
|
2
2
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useAppSelector,
|
|
5
|
+
useContentTypes,
|
|
6
|
+
} from "@applicaster/zapp-react-native-redux/hooks";
|
|
4
7
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
|
|
5
8
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device/useIsTablet";
|
|
6
9
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
7
10
|
import { create } from "zustand";
|
|
11
|
+
import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
|
+
import { selectPluginConfigurationsByPluginId } from "@applicaster/zapp-react-native-redux";
|
|
8
13
|
|
|
9
14
|
export const useConfiguration = () => {
|
|
10
15
|
const {
|
|
11
16
|
videoModalState: { item },
|
|
12
17
|
} = useNavigation();
|
|
13
18
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
"contentTypes",
|
|
17
|
-
"pluginConfigurations",
|
|
18
|
-
]);
|
|
19
|
+
const rivers = useRivers();
|
|
20
|
+
const contentTypes = useContentTypes();
|
|
19
21
|
|
|
20
22
|
const targetScreenId = contentTypes?.[item?.type?.value]?.screen_id;
|
|
21
23
|
const targetScreenConfiguration = rivers?.[targetScreenId];
|
|
22
24
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
+
const { configuration_json } = useAppSelector((state) =>
|
|
26
|
+
selectPluginConfigurationsByPluginId(state, targetScreenConfiguration?.type)
|
|
27
|
+
);
|
|
25
28
|
|
|
26
29
|
const playerPluginConfig = playerManager.getPluginConfiguration();
|
|
27
30
|
|
|
28
31
|
const config = mergeRight(playerPluginConfig, {
|
|
29
|
-
...
|
|
32
|
+
...configuration_json,
|
|
30
33
|
...targetScreenConfiguration?.general,
|
|
31
34
|
...targetScreenConfiguration?.styles,
|
|
32
35
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { getAnalyticsFunctions } from "@applicaster/zapp-react-native-utils/analyticsUtils";
|
|
4
|
-
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
5
4
|
|
|
6
5
|
type ComponentProps = {
|
|
7
6
|
component: {
|
|
@@ -21,11 +20,13 @@ type ComponentProps = {
|
|
|
21
20
|
|
|
22
21
|
function withAnalytics(Component) {
|
|
23
22
|
return function WithAnalytics(props: ComponentProps) {
|
|
24
|
-
const { appData } = usePickFromState(["appData"]);
|
|
25
|
-
|
|
26
23
|
const analyticsFunctions = React.useMemo(
|
|
27
|
-
() =>
|
|
28
|
-
|
|
24
|
+
() =>
|
|
25
|
+
getAnalyticsFunctions({
|
|
26
|
+
component: props.component,
|
|
27
|
+
zappPipesData: props.zappPipesData,
|
|
28
|
+
} as any),
|
|
29
|
+
[props.component, props.zappPipesData]
|
|
29
30
|
);
|
|
30
31
|
|
|
31
32
|
return (
|
|
@@ -88,6 +88,7 @@ exports[`withConfigurationProvider correctly passes all the configuration keys c
|
|
|
88
88
|
tab_cell_padding_right={10}
|
|
89
89
|
tab_cell_padding_top={14}
|
|
90
90
|
tablet_theme={false}
|
|
91
|
+
tabs_screen_background_color="transparent"
|
|
91
92
|
target={false}
|
|
92
93
|
target_screen_switch={false}
|
|
93
94
|
text_label_active_font_color="rgba(239, 239, 239, 0.5)"
|
|
@@ -208,4 +208,5 @@ export const keysMap: Record<string, Function> = {
|
|
|
208
208
|
tab_bar_item_margin_right: castOrDefaultValue(Number, 0),
|
|
209
209
|
tab_bar_item_margin_bottom: castOrDefaultValue(Number, 0),
|
|
210
210
|
tab_bar_item_margin_left: castOrDefaultValue(Number, 0),
|
|
211
|
+
tabs_screen_background_color: castOrDefaultValue(R.identity, "transparent"),
|
|
211
212
|
};
|
|
@@ -3,7 +3,7 @@ import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUt
|
|
|
3
3
|
|
|
4
4
|
import * as zappPipesRedux from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
5
5
|
import configureStore from "redux-mock-store";
|
|
6
|
-
import thunk from "redux-thunk";
|
|
6
|
+
import { thunk } from "redux-thunk";
|
|
7
7
|
|
|
8
8
|
import { zappPipesDataConnector } from "../index";
|
|
9
9
|
|