@applicaster/zapp-react-native-utils 13.0.0-alpha.1753452014 → 13.0.0-alpha.1756731121
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 +126 -6
- package/actionsExecutor/consts.ts +4 -0
- package/appUtils/HooksManager/Hook.ts +4 -0
- package/appUtils/HooksManager/index.ts +2 -0
- package/appUtils/__tests__/__snapshots__/localizationsHelper.test.ts.snap +151 -0
- package/appUtils/__tests__/allZappLocales.ts +79 -0
- package/appUtils/__tests__/{localizationsHelper.test.js → localizationsHelper.test.ts} +11 -0
- package/appUtils/contextKeysManager/contextResolver.ts +1 -12
- package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +2 -0
- package/appUtils/focusManager/index.ios.ts +14 -4
- package/appUtils/focusManager/index.ts +13 -0
- package/appUtils/focusManager/utils/__tests__/findChild.test.ts +35 -0
- package/appUtils/focusManager/utils/index.ts +5 -0
- package/appUtils/localizationsHelper.ts +31 -0
- package/appUtils/orientationHelper.ts +11 -12
- package/appUtils/playerManager/player.ts +24 -12
- package/appUtils/playerManager/playerHooks/usePlayerCurrentTime.tsx +11 -7
- package/appUtils/playerManager/playerNative.ts +18 -3
- package/appUtils/playerManager/usePlayerTitleSummaryOverlay.tsx +7 -1
- package/cellUtils/index.ts +9 -5
- package/componentsUtils/__tests__/isFirstComponentGallery.test.ts +33 -0
- package/componentsUtils/__tests__/isFirstComponentScreenPicker.test.ts +33 -0
- package/componentsUtils/__tests__/isGallery.test.ts +33 -0
- package/componentsUtils/__tests__/isScreenPicker.test.ts +33 -0
- package/componentsUtils/index.ts +39 -0
- package/dateUtils/index.ts +19 -0
- package/focusManager/FocusManager.ts +3 -1
- package/focusManager/index.ts +3 -21
- package/functionUtils/index.ts +25 -0
- package/index.d.ts +0 -12
- package/localizationUtils/index.ts +8 -13
- package/manifestUtils/defaultManifestConfigurations/generalContent.js +13 -0
- package/manifestUtils/defaultManifestConfigurations/player.js +10 -4
- package/manifestUtils/index.js +2 -0
- package/manifestUtils/keys.js +27 -2
- package/modalState/__tests__/index.test.ts +51 -0
- package/modalState/index.ts +32 -2
- package/navigationUtils/__tests__/__snapshots__/navigationUtils.test.js.snap +1 -0
- package/navigationUtils/index.ts +3 -1
- package/numberUtils/__tests__/toPositiveNumberWithDefault.test.ts +23 -3
- package/numberUtils/index.ts +4 -0
- package/package.json +2 -3
- package/playerUtils/configurationGenerator.ts +9 -11
- package/reactHooks/advertising/index.ts +5 -5
- package/reactHooks/feed/useBatchLoading.ts +10 -12
- package/reactHooks/feed/useFeedLoader.tsx +17 -8
- package/reactHooks/hookModal/hooks/useHookModalScreenData.ts +39 -0
- package/reactHooks/navigation/{useGetTabBarHeight.ts → getTabBarHeight.ts} +1 -1
- package/reactHooks/navigation/index.ts +5 -3
- package/reactHooks/navigation/useGetBottomTabBarHeight.ts +10 -3
- package/reactHooks/navigation/useNavigationPluginData.ts +8 -4
- package/reactHooks/navigation/useNavigationType.ts +4 -2
- package/reactHooks/navigation/useRoute.ts +4 -6
- package/reactHooks/screen/__tests__/useScreenBackgroundColor.test.tsx +69 -0
- package/reactHooks/screen/useScreenBackgroundColor.ts +3 -15
- package/reactHooks/useListenEventBusEvent.ts +1 -1
- package/reactUtils/index.ts +9 -0
- package/time/BackgroundTimer.ts +55 -0
- package/time/Timer.ts +6 -6
- package/utils/README.md +30 -0
- package/utils/chunk.ts +5 -0
- package/utils/index.ts +5 -0
- package/utils/times.ts +5 -0
- package/zappFrameworkUtils/localStorageHelper.ts +6 -0
- package/zappFrameworkUtils/loginPluginUtils.ts +6 -2
- package/zappFrameworkUtils/types.ts +11 -0
|
@@ -43,12 +43,12 @@ function getPlayerConfiguration({ platform }) {
|
|
|
43
43
|
"Enable if you want to have adaptive background gradient based on audio background image.",
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
|
-
key: "
|
|
47
|
-
label: "Audio Player Image
|
|
46
|
+
key: "audio_player_background_image_default_color",
|
|
47
|
+
label: "Audio Player Background Image Default Color",
|
|
48
48
|
initial_value: "",
|
|
49
49
|
type: "text_input",
|
|
50
50
|
label_tooltip:
|
|
51
|
-
"Set the
|
|
51
|
+
"Set the default color for the audio player background image if not image or set of gradient colors are not provided.",
|
|
52
52
|
},
|
|
53
53
|
],
|
|
54
54
|
};
|
|
@@ -2513,7 +2513,7 @@ function getPlayerConfiguration({ platform }) {
|
|
|
2513
2513
|
styles.fields.push(
|
|
2514
2514
|
fieldsGroup(
|
|
2515
2515
|
"Audio Player",
|
|
2516
|
-
"This section allows you to configure the audio player layout",
|
|
2516
|
+
"This section allows you to configure the audio player layout 2",
|
|
2517
2517
|
[
|
|
2518
2518
|
{
|
|
2519
2519
|
key: "audio_player_background_color",
|
|
@@ -2547,6 +2547,12 @@ function getPlayerConfiguration({ platform }) {
|
|
|
2547
2547
|
multiple: false,
|
|
2548
2548
|
label_tooltip: "Choose the default aspect ratio for the artwork",
|
|
2549
2549
|
},
|
|
2550
|
+
{
|
|
2551
|
+
key: "audio_player_artwork_border_radius",
|
|
2552
|
+
label: "Audio Player Artwork Corner Radius",
|
|
2553
|
+
type: "number_input",
|
|
2554
|
+
initial_value: 16,
|
|
2555
|
+
},
|
|
2550
2556
|
]
|
|
2551
2557
|
)
|
|
2552
2558
|
);
|
package/manifestUtils/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const {
|
|
|
8
8
|
|
|
9
9
|
const { tvActionButtonsContainer } = require("./tvAction/container");
|
|
10
10
|
const { tvActionButton } = require("./tvAction/button");
|
|
11
|
+
const { compact } = require("./_internals");
|
|
11
12
|
|
|
12
13
|
const { spacingKey, absolutePositionElement } = require("./containers");
|
|
13
14
|
|
|
@@ -46,4 +47,5 @@ module.exports = {
|
|
|
46
47
|
tvProgressBar,
|
|
47
48
|
secondaryImage,
|
|
48
49
|
getUpdatedSecondaryImageKeys,
|
|
50
|
+
compact,
|
|
49
51
|
};
|
package/manifestUtils/keys.js
CHANGED
|
@@ -21,7 +21,30 @@ const ZAPPIFEST_FIELDS = {
|
|
|
21
21
|
},
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const TV_PLATFORMS_FOR_FONTS = [
|
|
25
|
+
"tvOS",
|
|
26
|
+
"android",
|
|
27
|
+
"LG",
|
|
28
|
+
"samsung",
|
|
29
|
+
"roku",
|
|
30
|
+
"vizio",
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const MOBILE_PLATFORMS = [
|
|
34
|
+
"ios",
|
|
35
|
+
"ios_for_quickbrick",
|
|
36
|
+
"android",
|
|
37
|
+
"android_for_quickbrick",
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const TV_PLATFORMS = [
|
|
41
|
+
"android_tv_for_quickbrick",
|
|
42
|
+
"amazon_fire_tv_for_quickbrick",
|
|
43
|
+
"tvos_for_quickbrick",
|
|
44
|
+
"samsung_tv",
|
|
45
|
+
"lg_tv",
|
|
46
|
+
"vizio",
|
|
47
|
+
];
|
|
25
48
|
|
|
26
49
|
const FontPropsForTVPlatform = (platform) => ({
|
|
27
50
|
[`${R.toLower(platform)}FontFamily`]: {
|
|
@@ -92,7 +115,7 @@ const TV_FONT_KEY_DATA = {
|
|
|
92
115
|
name: "focused font color",
|
|
93
116
|
type: ZAPPIFEST_FIELDS.color_picker,
|
|
94
117
|
},
|
|
95
|
-
...R.reduce(addTVFontsForPlatform, {},
|
|
118
|
+
...R.reduce(addTVFontsForPlatform, {}, TV_PLATFORMS_FOR_FONTS),
|
|
96
119
|
textAlignment: {
|
|
97
120
|
name: "text alignment",
|
|
98
121
|
type: ZAPPIFEST_FIELDS.select,
|
|
@@ -2083,4 +2106,6 @@ module.exports = {
|
|
|
2083
2106
|
TV_CELL_BADGE_FIELDS,
|
|
2084
2107
|
progressBarFields,
|
|
2085
2108
|
secondaryImageFields,
|
|
2109
|
+
TV_PLATFORMS,
|
|
2110
|
+
MOBILE_PLATFORMS,
|
|
2086
2111
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { modalStore } from "../";
|
|
2
|
+
|
|
3
|
+
describe("Modal State", () => {
|
|
4
|
+
it("should have initial state", () => {
|
|
5
|
+
const state = modalStore.getState();
|
|
6
|
+
|
|
7
|
+
expect(state).toMatchObject({
|
|
8
|
+
modalState: {
|
|
9
|
+
visible: false,
|
|
10
|
+
screen: null,
|
|
11
|
+
options: {},
|
|
12
|
+
props: {},
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
expect(state.openModal).toBeDefined();
|
|
17
|
+
expect(state.dismissModal).toBeDefined();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe("opening and dismissing modal", () => {
|
|
21
|
+
it("should open modal", () => {
|
|
22
|
+
const item = { id: "test", name: "Test Modal" };
|
|
23
|
+
const options = { animated: true, animationType: "slide" };
|
|
24
|
+
const props = { customProp: "value" };
|
|
25
|
+
|
|
26
|
+
modalStore.getState().openModal({ item, options, props });
|
|
27
|
+
|
|
28
|
+
const state = modalStore.getState();
|
|
29
|
+
|
|
30
|
+
expect(state.modalState).toMatchObject({
|
|
31
|
+
visible: true,
|
|
32
|
+
screen: item,
|
|
33
|
+
options,
|
|
34
|
+
props,
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("should dismiss modal", () => {
|
|
39
|
+
modalStore.getState().dismissModal();
|
|
40
|
+
|
|
41
|
+
const state = modalStore.getState();
|
|
42
|
+
|
|
43
|
+
expect(state.modalState).toMatchObject({
|
|
44
|
+
visible: false,
|
|
45
|
+
screen: null,
|
|
46
|
+
options: {},
|
|
47
|
+
props: {},
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
package/modalState/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useStore, createStore } from "zustand";
|
|
2
2
|
|
|
3
3
|
interface ModalState {
|
|
4
4
|
visible: boolean;
|
|
@@ -25,7 +25,7 @@ const initialModalState: ModalState = {
|
|
|
25
25
|
props: {},
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
export const
|
|
28
|
+
export const modalStore = createStore<ModalStore>((set) => ({
|
|
29
29
|
modalState: initialModalState,
|
|
30
30
|
setModalState: (newState) =>
|
|
31
31
|
set((state) => ({
|
|
@@ -51,3 +51,33 @@ export const useModalStore = create<ModalStore>((set) => ({
|
|
|
51
51
|
}),
|
|
52
52
|
dismissModal: () => set(() => ({ modalState: initialModalState })),
|
|
53
53
|
}));
|
|
54
|
+
|
|
55
|
+
export const useModalStore = <T>(selector: (state: ModalStore) => T) =>
|
|
56
|
+
useStore(modalStore, selector);
|
|
57
|
+
|
|
58
|
+
export const openModal = modalStore.getInitialState().openModal;
|
|
59
|
+
|
|
60
|
+
export const dismissModal = modalStore.getInitialState().dismissModal;
|
|
61
|
+
|
|
62
|
+
export const openBottomSheetModal = ({
|
|
63
|
+
ModalBottomSheetContent,
|
|
64
|
+
modalBottomSheetContentProps,
|
|
65
|
+
props = {},
|
|
66
|
+
options = {},
|
|
67
|
+
}: OpenModalBottomSheetArgs) => {
|
|
68
|
+
openModal({
|
|
69
|
+
item: {
|
|
70
|
+
ModalBottomSheetContent,
|
|
71
|
+
modalBottomSheetContentProps,
|
|
72
|
+
},
|
|
73
|
+
props,
|
|
74
|
+
options: {
|
|
75
|
+
animationType: "none",
|
|
76
|
+
animated: false,
|
|
77
|
+
...options,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const useModalStoreState = (): ModalState =>
|
|
83
|
+
useModalStore<ModalState>((state) => state.modalState);
|
package/navigationUtils/index.ts
CHANGED
|
@@ -111,6 +111,7 @@ export function getNavigationProps({
|
|
|
111
111
|
assets: ZappNavBarAssets;
|
|
112
112
|
rules: ZappNavBarRules;
|
|
113
113
|
nav_items: NavBarItem[];
|
|
114
|
+
data: MenuItemDataProperties;
|
|
114
115
|
} | null {
|
|
115
116
|
const { activeRiver } = navigator;
|
|
116
117
|
const { navigations, id: selected, home } = activeRiver; // use useRiver hook instead
|
|
@@ -124,7 +125,7 @@ export function getNavigationProps({
|
|
|
124
125
|
return null;
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
const { styles, assets, nav_items, rules } = navigation;
|
|
128
|
+
const { styles, assets, nav_items, rules, data } = navigation;
|
|
128
129
|
|
|
129
130
|
return {
|
|
130
131
|
selected,
|
|
@@ -134,6 +135,7 @@ export function getNavigationProps({
|
|
|
134
135
|
assets: assets as ZappNavBarAssets,
|
|
135
136
|
nav_items: nav_items as any as NavBarItem[],
|
|
136
137
|
rules: rules as any as ZappNavBarRules,
|
|
138
|
+
data: data as MenuItemDataProperties,
|
|
137
139
|
};
|
|
138
140
|
}
|
|
139
141
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { toPositiveNumberWithDefault } from "..";
|
|
2
2
|
|
|
3
|
-
describe("
|
|
3
|
+
describe("toPositiveNumberWithDefault", () => {
|
|
4
4
|
const DEFAULT = 5;
|
|
5
5
|
|
|
6
6
|
it("return number if input is positive number", () => {
|
|
7
|
-
const inputs = [
|
|
7
|
+
const inputs = [1, 2, 100, 200.12, Infinity];
|
|
8
8
|
expect.assertions(inputs.length);
|
|
9
9
|
|
|
10
10
|
inputs.forEach((input) => {
|
|
@@ -14,7 +14,7 @@ describe("toNumber", () => {
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
it("return number if input is positive number as string", () => {
|
|
17
|
-
const inputs = ["
|
|
17
|
+
const inputs = ["1", "2", "100", "200.12"];
|
|
18
18
|
expect.assertions(inputs.length);
|
|
19
19
|
|
|
20
20
|
inputs.forEach((input) => {
|
|
@@ -63,4 +63,24 @@ describe("toNumber", () => {
|
|
|
63
63
|
expect(output).toBe(DEFAULT);
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
|
+
|
|
67
|
+
it("return default if input is zero number", () => {
|
|
68
|
+
const inputs = [0, -0];
|
|
69
|
+
expect.assertions(inputs.length);
|
|
70
|
+
|
|
71
|
+
inputs.forEach((input) => {
|
|
72
|
+
const output = toPositiveNumberWithDefault(DEFAULT, input);
|
|
73
|
+
expect(output).toBe(DEFAULT);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("return default if input is zero string", () => {
|
|
78
|
+
const inputs = ["0", "-0"];
|
|
79
|
+
expect.assertions(inputs.length);
|
|
80
|
+
|
|
81
|
+
inputs.forEach((input) => {
|
|
82
|
+
const output = toPositiveNumberWithDefault(DEFAULT, input);
|
|
83
|
+
expect(output).toBe(DEFAULT);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
66
86
|
});
|
package/numberUtils/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.1756731121",
|
|
4
4
|
"description": "Applicaster Zapp React Native utilities package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "jest -w=2",
|
|
9
8
|
"build": "echo skipping hybrid ts build in main packages for now"
|
|
10
9
|
},
|
|
11
10
|
"publishConfig": {
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
},
|
|
29
28
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
29
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "13.0.0-alpha.
|
|
30
|
+
"@applicaster/applicaster-types": "13.0.0-alpha.1756731121",
|
|
32
31
|
"buffer": "^5.2.1",
|
|
33
32
|
"camelize": "^1.0.0",
|
|
34
33
|
"dayjs": "^1.11.10",
|
|
@@ -40,20 +40,12 @@ function getPlayerConfiguration({ platform }) {
|
|
|
40
40
|
"Disable if you don't want the content to have a right orientation",
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
key: "
|
|
44
|
-
label: "
|
|
45
|
-
initial_value: false,
|
|
46
|
-
type: "switch",
|
|
47
|
-
label_tooltip:
|
|
48
|
-
"Enable if you want to have adaptive background gradient based on audio background image.",
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
key: "audio_player_background_image_query",
|
|
52
|
-
label: "Audio Player Image Query",
|
|
43
|
+
key: "audio_player_background_image_default_color",
|
|
44
|
+
label: "Audio Player Background Image Default Color",
|
|
53
45
|
initial_value: "",
|
|
54
46
|
type: "text_input",
|
|
55
47
|
label_tooltip:
|
|
56
|
-
"Set the
|
|
48
|
+
"Set the default color for the audio player background image if not image or set of gradient colors are not provided.",
|
|
57
49
|
},
|
|
58
50
|
],
|
|
59
51
|
};
|
|
@@ -2549,6 +2541,12 @@ function getPlayerConfiguration({ platform }) {
|
|
|
2549
2541
|
multiple: false,
|
|
2550
2542
|
label_tooltip: "Choose the default aspect ratio for the artwork",
|
|
2551
2543
|
},
|
|
2544
|
+
{
|
|
2545
|
+
key: "audio_player_artwork_border_radius",
|
|
2546
|
+
label: "Audio Player Artwork Corner Radius",
|
|
2547
|
+
type: "number_input",
|
|
2548
|
+
initial_value: 16,
|
|
2549
|
+
},
|
|
2552
2550
|
]
|
|
2553
2551
|
)
|
|
2554
2552
|
);
|
|
@@ -5,6 +5,7 @@ import * as R from "ramda";
|
|
|
5
5
|
import { useNavigation } from "../navigation";
|
|
6
6
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
7
7
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
8
|
+
import { dismissModal, openModal } from "../../modalState";
|
|
8
9
|
|
|
9
10
|
const GOOGLE_ADS_IDENTIFIER = "google-admob-ads-qb";
|
|
10
11
|
|
|
@@ -14,9 +15,8 @@ const ModalContainer = platformSelect({
|
|
|
14
15
|
});
|
|
15
16
|
|
|
16
17
|
export function useAdvertisingInterstitial() {
|
|
17
|
-
const
|
|
18
|
+
const { screenData, currentRoute } = useNavigation();
|
|
18
19
|
const { plugins } = usePickFromState();
|
|
19
|
-
const { screenData } = navigator;
|
|
20
20
|
|
|
21
21
|
return useEffect(() => {
|
|
22
22
|
// TODD: typing problem: fix any type
|
|
@@ -26,7 +26,7 @@ export function useAdvertisingInterstitial() {
|
|
|
26
26
|
plugins
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
openModal({
|
|
30
30
|
item: {},
|
|
31
31
|
options: {
|
|
32
32
|
ModalContainer,
|
|
@@ -36,11 +36,11 @@ export function useAdvertisingInterstitial() {
|
|
|
36
36
|
screenType: "hooks",
|
|
37
37
|
screenData: {
|
|
38
38
|
payload: screenData,
|
|
39
|
-
callback:
|
|
39
|
+
callback: dismissModal,
|
|
40
40
|
hookPlugin: GoogleAdsPlugin,
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
}, [
|
|
45
|
+
}, [currentRoute, screenData?.id]);
|
|
46
46
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { complement, compose, isNil, map, min, prop, take, uniq } from "ramda";
|
|
2
2
|
import { useDispatch } from "react-redux";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { useZappPipesFeeds } from "@applicaster/zapp-react-native-redux/hooks
|
|
4
|
+
import { useZappPipesFeeds } from "@applicaster/zapp-react-native-redux/hooks";
|
|
5
5
|
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
6
6
|
import { isNilOrEmpty } from "../../reactUtils/helpers";
|
|
7
7
|
import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
getInflatedDataSourceUrl,
|
|
10
10
|
getSearchContext,
|
|
11
11
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
|
+
import { isGallery } from "@applicaster/zapp-react-native-utils/componentsUtils";
|
|
12
13
|
import { useScreenContext } from "../screen/useScreenContext";
|
|
13
14
|
|
|
14
15
|
type Options = {
|
|
@@ -46,9 +47,7 @@ const filterEmptyData = (data) => {
|
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
const getData = (rawData) =>
|
|
49
|
-
rawData.
|
|
50
|
-
? rawData.ui_components[0].data
|
|
51
|
-
: rawData.data;
|
|
50
|
+
isGallery(rawData) ? rawData.ui_components[0].data : rawData.data;
|
|
52
51
|
|
|
53
52
|
const extractData = compose(uniq, map(getData));
|
|
54
53
|
|
|
@@ -70,13 +69,12 @@ export const useBatchLoading = (
|
|
|
70
69
|
const [hasEverBeenReady, setHasEverBeenReady] = React.useState(false);
|
|
71
70
|
|
|
72
71
|
// if first component is gallery-qb, take only one component for initial load
|
|
73
|
-
const takeSize =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
);
|
|
72
|
+
const takeSize = isGallery(componentsToRender?.[0])
|
|
73
|
+
? 1
|
|
74
|
+
: min(
|
|
75
|
+
options.initialBatchSize ?? DEFAULT_BATCH_SIZE,
|
|
76
|
+
componentsToRender.length
|
|
77
|
+
);
|
|
80
78
|
|
|
81
79
|
const takeBatchSize = React.useCallback(take(takeSize), [takeSize]);
|
|
82
80
|
|
|
@@ -5,7 +5,7 @@ import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
|
5
5
|
import { useZappPipesFeed } from "@applicaster/zapp-react-native-redux/hooks";
|
|
6
6
|
|
|
7
7
|
import { reactHooksLogger } from "../logger";
|
|
8
|
-
import {
|
|
8
|
+
import { shouldDispatchData, useIsInitialRender } from "../utils";
|
|
9
9
|
import { useInflatedUrl } from "./useInflatedUrl";
|
|
10
10
|
import { useRoute } from "../navigation";
|
|
11
11
|
|
|
@@ -20,6 +20,7 @@ type Props = {
|
|
|
20
20
|
silentRefresh?: boolean;
|
|
21
21
|
method?: "get" | "post";
|
|
22
22
|
bodyParams?: Record<string, unknown>;
|
|
23
|
+
skipLoading?: boolean;
|
|
23
24
|
};
|
|
24
25
|
};
|
|
25
26
|
|
|
@@ -55,7 +56,9 @@ export const useFeedLoader = ({
|
|
|
55
56
|
|
|
56
57
|
const currentFeed = useZappPipesFeed(callableFeedUrl);
|
|
57
58
|
|
|
58
|
-
const riverId =
|
|
59
|
+
const riverId =
|
|
60
|
+
(screenData as LegacyNavigationScreenData)?.targetScreen?.id ??
|
|
61
|
+
screenData?.id;
|
|
59
62
|
|
|
60
63
|
const reloadData = React.useCallback<ReloadDataFunction>(
|
|
61
64
|
(silentRefresh = true, callback) => {
|
|
@@ -93,7 +96,7 @@ export const useFeedLoader = ({
|
|
|
93
96
|
if (
|
|
94
97
|
shouldDispatchData(callableFeedUrl, currentFeed, pipesOptions.clearCache)
|
|
95
98
|
) {
|
|
96
|
-
if (callableFeedUrl) {
|
|
99
|
+
if (callableFeedUrl && !pipesOptions.skipLoading) {
|
|
97
100
|
dispatch(
|
|
98
101
|
loadPipesData(callableFeedUrl, {
|
|
99
102
|
...pipesOptions,
|
|
@@ -101,26 +104,33 @@ export const useFeedLoader = ({
|
|
|
101
104
|
riverId,
|
|
102
105
|
})
|
|
103
106
|
);
|
|
104
|
-
} else {
|
|
107
|
+
} else if (!callableFeedUrl) {
|
|
105
108
|
logger.info({
|
|
106
109
|
message:
|
|
107
110
|
"Feed is not defined or not inflated, skipping loading. \nMake sure you have correct feedUrl and mapping.",
|
|
108
111
|
jsOnly: true,
|
|
109
112
|
});
|
|
113
|
+
} else {
|
|
114
|
+
logger.info({
|
|
115
|
+
message:
|
|
116
|
+
"Loading skipped as per pipesOptions.skipLoading configuration.",
|
|
117
|
+
data: { url: callableFeedUrl },
|
|
118
|
+
jsOnly: true,
|
|
119
|
+
});
|
|
110
120
|
}
|
|
111
121
|
} else {
|
|
112
122
|
logger.info({
|
|
113
123
|
message:
|
|
114
|
-
"Feed already
|
|
124
|
+
"Feed already exists, skipping loading. \nCall reloadData() if you want to refresh data.",
|
|
115
125
|
data: { url: callableFeedUrl },
|
|
116
126
|
jsOnly: true,
|
|
117
127
|
});
|
|
118
128
|
}
|
|
119
129
|
}, []);
|
|
120
130
|
|
|
121
|
-
// Reload feed when feedUrl changes
|
|
131
|
+
// Reload feed when feedUrl changes, unless skipLoading is true
|
|
122
132
|
useEffect(() => {
|
|
123
|
-
if (!isInitialRender && callableFeedUrl) {
|
|
133
|
+
if (!isInitialRender && callableFeedUrl && !pipesOptions.skipLoading) {
|
|
124
134
|
dispatch(loadPipesData(callableFeedUrl, { ...pipesOptions, riverId }));
|
|
125
135
|
}
|
|
126
136
|
}, [callableFeedUrl]);
|
|
@@ -156,7 +166,6 @@ export const useFeedLoader = ({
|
|
|
156
166
|
currentFeed?.data,
|
|
157
167
|
currentFeed?.error,
|
|
158
168
|
currentFeed?.loading,
|
|
159
|
-
|
|
160
169
|
reloadData,
|
|
161
170
|
loadNext,
|
|
162
171
|
]);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { reactHooksLogger } from "../../logger";
|
|
2
|
+
import { useZappHooksModalState } from "@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal/hooks/useZappHooksModalState";
|
|
3
|
+
|
|
4
|
+
const logger = reactHooksLogger.addSubsystem("useHookModalScreenData");
|
|
5
|
+
|
|
6
|
+
type VariousScreenData = LegacyNavigationScreenData | ZappRiver | ZappEntry;
|
|
7
|
+
|
|
8
|
+
export const useHookModalScreenData = (): VariousScreenData | undefined => {
|
|
9
|
+
const hookModalState = useZappHooksModalState();
|
|
10
|
+
|
|
11
|
+
if (!hookModalState.state?.screenData) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const screenData = hookModalState.state.screenData?.payload;
|
|
17
|
+
const hookPlugin = hookModalState.state.screenData.hookPlugin;
|
|
18
|
+
|
|
19
|
+
if (hookPlugin?.screen_id) {
|
|
20
|
+
return {
|
|
21
|
+
...screenData,
|
|
22
|
+
targetScreen: hookPlugin,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return hookModalState.state.screenData?.payload;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
logger.error({
|
|
29
|
+
message: "Hook modal screen data creation failed",
|
|
30
|
+
data: {
|
|
31
|
+
error,
|
|
32
|
+
hookModalState,
|
|
33
|
+
},
|
|
34
|
+
jsOnly: true,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return hookModalState.state.screenData?.payload;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -3,7 +3,7 @@ import { platformSelect } from "../../reactUtils";
|
|
|
3
3
|
const TAB_BAR_HEIGHT_IOS = 49;
|
|
4
4
|
const TAB_BAR_HEIGHT_ANDROID = 56;
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const getTabBarHeight = () =>
|
|
7
7
|
platformSelect({
|
|
8
8
|
ios: TAB_BAR_HEIGHT_IOS,
|
|
9
9
|
android: TAB_BAR_HEIGHT_ANDROID,
|
|
@@ -108,9 +108,11 @@ export function isNavBarVisible(
|
|
|
108
108
|
return false;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
const showSecondaryLevel =
|
|
112
|
-
(
|
|
113
|
-
|
|
111
|
+
const showSecondaryLevel =
|
|
112
|
+
!isTV() ||
|
|
113
|
+
screenData?.navigations?.some(
|
|
114
|
+
(navigation) => navigation.styles?.show_secondary_level_menu
|
|
115
|
+
);
|
|
114
116
|
|
|
115
117
|
if (canGoBack && !showSecondaryLevel) {
|
|
116
118
|
return false;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { useGetNavBarTopBorderWidth } from "./useGetNavBarTopBorderWidth";
|
|
2
|
-
import {
|
|
2
|
+
import { getTabBarHeight } from "./getTabBarHeight";
|
|
3
|
+
import { useNavigation } from "./useNavigation";
|
|
3
4
|
import { MenuTypes, useNavigationType } from "./useNavigationType";
|
|
5
|
+
import { useNavigationPluginData } from "./useNavigationPluginData";
|
|
4
6
|
|
|
5
7
|
export const useGetBottomTabBarHeight = (): number => {
|
|
8
|
+
const { activeRiver } = useNavigation();
|
|
9
|
+
|
|
10
|
+
const navigationPluginData = useNavigationPluginData(activeRiver);
|
|
11
|
+
const navigationType = useNavigationType(navigationPluginData);
|
|
12
|
+
|
|
6
13
|
const topBorderWidth = useGetNavBarTopBorderWidth();
|
|
7
|
-
const tabBarHeight =
|
|
14
|
+
const tabBarHeight = getTabBarHeight();
|
|
8
15
|
|
|
9
|
-
const isBottomBarNavigation =
|
|
16
|
+
const isBottomBarNavigation = navigationType === MenuTypes.bottomTabBar;
|
|
10
17
|
|
|
11
18
|
return !isBottomBarNavigation ? 0 : tabBarHeight + topBorderWidth;
|
|
12
19
|
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { useRoute } from "./useRoute";
|
|
2
2
|
|
|
3
|
-
export const useNavigationPluginData = (
|
|
3
|
+
export const useNavigationPluginData = (
|
|
4
|
+
screenData?: LegacyNavigationScreenData | null
|
|
5
|
+
): ZappNavigation | undefined => {
|
|
4
6
|
const {
|
|
5
7
|
screenData: useRouteScreenData,
|
|
6
8
|
}: { screenData: QuickBrickNavigationData | null } = useRoute();
|
|
7
9
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const activeScreenData = screenData ?? useRouteScreenData;
|
|
11
|
+
|
|
12
|
+
const navigations = activeScreenData?.targetScreen
|
|
13
|
+
? (activeScreenData.targetScreen as ZappRiver).navigations
|
|
14
|
+
: (activeScreenData as ZappRiver).navigations;
|
|
11
15
|
|
|
12
16
|
const navigationMenu = navigations?.find((nav) => nav.category === "menu");
|
|
13
17
|
|
|
@@ -5,8 +5,10 @@ export enum MenuTypes {
|
|
|
5
5
|
bottomTabBar = "BOTTOM_TAB_BAR",
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export const useNavigationType = (): MenuTypes => {
|
|
9
|
-
const
|
|
8
|
+
export const useNavigationType = (navigation?: ZappNavigation): MenuTypes => {
|
|
9
|
+
const navigationPluginData = useNavigationPluginData();
|
|
10
|
+
|
|
11
|
+
const navigationMenu = navigation ?? navigationPluginData;
|
|
10
12
|
|
|
11
13
|
return !navigationMenu ||
|
|
12
14
|
navigationMenu.navigation_type === "quick_brick_side_menu"
|