@applicaster/quick-brick-core 12.0.0-rc.1 → 12.0.0-rc.100
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 +4 -4
- package/App/AssetCache/__tests__/assetCache.test.ts +1 -1
- package/App/AssetCache/index.ts +17 -4
- package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/usePresentSchemeHandler.ts +3 -5
- package/App/DeepLinking/URLSchemeHandler/__tests__/URLSchemeHandler.test.tsx +3 -3
- package/App/DeepLinking/URLSchemeListener/__tests__/URLSchemeListenerTest.js +0 -2
- package/App/ModalProvider/ModalBottomSheet/index.tsx +5 -1
- package/App/ModalProvider/ModalContent.tsx +1 -1
- package/App/ModalProvider/index.tsx +3 -3
- package/App/NavigationProvider/NavigationProvider.tsx +43 -60
- package/App/NavigationProvider/__tests__/__snapshots__/navigationProvider.test.tsx.snap +4 -21
- package/App/NavigationProvider/__tests__/navigationProvider.test.tsx +137 -231
- package/App/NetworkStatusProvider/utils.ts +23 -1
- package/App/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +14 -8
- package/App/RouteManager/__tests__/routeManager.test.js +18 -7
- package/App/RouteManager/index.tsx +3 -2
- package/App/ThemeManager/index.tsx +21 -18
- package/App/__tests__/createQuickBrickApp.test.js +5 -0
- package/App/index.tsx +3 -6
- package/const/index.ts +4 -0
- package/createZappApp/__tests__/__snapshots__/createZappApp.test.js.snap +1 -1
- package/createZappApp/{index.js → index.tsx} +9 -7
- package/package.json +9 -10
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
+
import { isEqual } from "@applicaster/zapp-react-native-utils/equalUtils";
|
|
4
5
|
import { ThemeContext } from "@applicaster/zapp-react-native-utils/theme";
|
|
5
|
-
import {
|
|
6
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
6
7
|
import {
|
|
7
8
|
mapKeys,
|
|
8
9
|
partitionByKeys,
|
|
@@ -35,7 +36,7 @@ function populateTheme(plugin) {
|
|
|
35
36
|
|
|
36
37
|
const TABLET_PREFIX = "tablet_";
|
|
37
38
|
|
|
38
|
-
const prepareForTablet = (
|
|
39
|
+
const prepareForTablet = (isTablet) => (themeProps) => {
|
|
39
40
|
const [tabletThemeProps, mobileTheme] = partitionByKeys(
|
|
40
41
|
R.compose(R.startsWith(TABLET_PREFIX), R.head),
|
|
41
42
|
themeProps
|
|
@@ -62,12 +63,12 @@ const prepareForTablet = (dimensions) => (themeProps) => {
|
|
|
62
63
|
R.omit(["tablet_theme"])
|
|
63
64
|
)(tabletThemeProps);
|
|
64
65
|
|
|
65
|
-
return
|
|
66
|
+
return isTablet ? tabletTheme : mobileTheme;
|
|
66
67
|
};
|
|
67
68
|
|
|
68
|
-
const selectThemes = (
|
|
69
|
+
const selectThemes = (isTablet, plugins) =>
|
|
69
70
|
R.compose(
|
|
70
|
-
R.map(prepareForTablet(
|
|
71
|
+
R.map(prepareForTablet(isTablet)),
|
|
71
72
|
R.fromPairs,
|
|
72
73
|
R.reject(R.isNil),
|
|
73
74
|
R.map(populateTheme),
|
|
@@ -80,36 +81,38 @@ const ThemeContextProvider = ({
|
|
|
80
81
|
setSelectedThemeId,
|
|
81
82
|
children,
|
|
82
83
|
}: any) => {
|
|
83
|
-
const value =
|
|
84
|
-
() => ({ themes, selectedThemeId, setSelectedThemeId }),
|
|
85
|
-
[themes, selectedThemeId, setSelectedThemeId]
|
|
86
|
-
);
|
|
84
|
+
const value = { themes, selectedThemeId, setSelectedThemeId };
|
|
87
85
|
|
|
88
86
|
return (
|
|
89
87
|
<ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>
|
|
90
88
|
);
|
|
91
89
|
};
|
|
92
90
|
|
|
91
|
+
const MemoizedThemeContextProvider = React.memo(
|
|
92
|
+
ThemeContextProvider,
|
|
93
|
+
isEqual({
|
|
94
|
+
byValue: ["selectedThemeId", "setSelectedThemeId"],
|
|
95
|
+
byReference: ["children", "themes"],
|
|
96
|
+
})
|
|
97
|
+
);
|
|
98
|
+
|
|
93
99
|
function ThemeManagerComponent({ children, plugins }: Props) {
|
|
94
|
-
const
|
|
95
|
-
|
|
100
|
+
const isTablet = useIsTablet();
|
|
101
|
+
|
|
102
|
+
const themes = selectThemes(isTablet, plugins);
|
|
96
103
|
|
|
97
104
|
const [selectedThemeId, setSelectedThemeId] =
|
|
98
105
|
React.useState(DEFAULT_THEME_ID);
|
|
99
106
|
|
|
100
|
-
React.useEffect(() => {
|
|
101
|
-
setThemes(selectThemes(dimensions, plugins));
|
|
102
|
-
}, [plugins, dimensions]);
|
|
103
|
-
|
|
104
107
|
return (
|
|
105
|
-
<
|
|
108
|
+
<MemoizedThemeContextProvider
|
|
106
109
|
themes={themes}
|
|
107
110
|
selectedThemeId={selectedThemeId}
|
|
108
111
|
setSelectedThemeId={setSelectedThemeId}
|
|
109
112
|
>
|
|
110
113
|
{children}
|
|
111
|
-
</
|
|
114
|
+
</MemoizedThemeContextProvider>
|
|
112
115
|
);
|
|
113
116
|
}
|
|
114
117
|
|
|
115
|
-
export const ThemeManager =
|
|
118
|
+
export const ThemeManager = ThemeManagerComponent;
|
|
@@ -15,6 +15,11 @@ jest.mock(
|
|
|
15
15
|
// This is meant to silence errors with react-native-gesture-handler
|
|
16
16
|
jest.mock("../ModalProvider/ModalBottomSheet", () => () => null);
|
|
17
17
|
|
|
18
|
+
jest.mock(
|
|
19
|
+
"@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation",
|
|
20
|
+
() => () => null
|
|
21
|
+
);
|
|
22
|
+
|
|
18
23
|
jest.mock("react-native-safe-area-context", () => ({
|
|
19
24
|
SafeAreaProvider: jest.fn(
|
|
20
25
|
() =>
|
package/App/index.tsx
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
import {
|
|
4
|
-
SafeAreaProvider,
|
|
5
4
|
initialWindowMetrics,
|
|
5
|
+
SafeAreaProvider,
|
|
6
6
|
} from "react-native-safe-area-context";
|
|
7
7
|
|
|
8
|
-
import type {
|
|
9
|
-
AppComponentProps,
|
|
10
|
-
ZappApp,
|
|
11
|
-
} from "@applicaster/zapp-react-native-flow-types";
|
|
12
|
-
|
|
13
8
|
import { ErrorBoundary } from "./ErrorBoundary";
|
|
14
9
|
import { RouteManager } from "./RouteManager";
|
|
15
10
|
import { withNavigationProvider } from "./NavigationProvider";
|
|
@@ -32,6 +27,7 @@ import {
|
|
|
32
27
|
import { withURLSchemeContextProvider } from "./DeepLinking/URLSchemeListener/URLSchemeContextProvider";
|
|
33
28
|
import { appRemoteDataLoader } from "./appRemoteDataLoader";
|
|
34
29
|
import { withActionExecutor } from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutorContext";
|
|
30
|
+
import { withScreenDataContextProvider } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenDataContext";
|
|
35
31
|
|
|
36
32
|
/**
|
|
37
33
|
* @typedef {Object} AppOptions
|
|
@@ -104,6 +100,7 @@ export function createQuickBrickApp(options): ZappApp {
|
|
|
104
100
|
withURLSchemeContextProvider,
|
|
105
101
|
withNetworkStatusProvider,
|
|
106
102
|
withNavigationProvider,
|
|
103
|
+
withScreenDataContextProvider,
|
|
107
104
|
ZappPipesSearchContext.withProvider,
|
|
108
105
|
InteractionManager,
|
|
109
106
|
withActionExecutor,
|
package/const/index.ts
CHANGED
|
@@ -20,13 +20,13 @@ Object {
|
|
|
20
20
|
"isAvailable": null,
|
|
21
21
|
"nextState": null,
|
|
22
22
|
},
|
|
23
|
-
"isTransitioning": false,
|
|
24
23
|
},
|
|
25
24
|
"cellStyles": Object {},
|
|
26
25
|
"components": Object {
|
|
27
26
|
"AppContainer": [Function],
|
|
28
27
|
"ContentScreen": [Function],
|
|
29
28
|
"HookRenderer": [Function],
|
|
29
|
+
"ModalComponent": [Function],
|
|
30
30
|
"PlayerContainer": Object {
|
|
31
31
|
"$$typeof": Symbol(react.memo),
|
|
32
32
|
"WrappedComponent": Object {
|
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import * as R from "ramda";
|
|
9
9
|
import { Dimensions } from "react-native";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from "@applicaster/zapp-react-native-flow-types";
|
|
10
|
+
import {
|
|
11
|
+
isNotEmpty,
|
|
12
|
+
isNotNil,
|
|
13
|
+
} from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
15
14
|
|
|
16
15
|
import {
|
|
17
16
|
createZappReduxStore,
|
|
@@ -32,6 +31,9 @@ import { remoteDataLoader } from "../App/appRemoteDataLoader/remoteDataLoader";
|
|
|
32
31
|
import * as QuickBrickManager from "@applicaster/zapp-react-native-bridge/QuickBrick";
|
|
33
32
|
import { isAndroidPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
34
33
|
|
|
34
|
+
const isNotEmptyObject = (value: unknown) =>
|
|
35
|
+
isNotNil(value) && R.is(Object, value) && isNotEmpty(value);
|
|
36
|
+
|
|
35
37
|
/**
|
|
36
38
|
* Creates a Zapp App with the provided options
|
|
37
39
|
* @export
|
|
@@ -60,8 +62,8 @@ export function createZappApp(zappAppConfig: ZappAppConfig) {
|
|
|
60
62
|
|
|
61
63
|
const useTabletLayout =
|
|
62
64
|
isTablet({ width, height }, width > height ? "landscape" : "portrait") &&
|
|
63
|
-
tabletLayout &&
|
|
64
|
-
tabletCellStyles;
|
|
65
|
+
isNotEmptyObject(tabletLayout) &&
|
|
66
|
+
isNotEmptyObject(tabletCellStyles);
|
|
65
67
|
|
|
66
68
|
function fetchPluginConfiguration(plugin) {
|
|
67
69
|
const configuration = R.compose(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "12.0.0-rc.
|
|
3
|
+
"version": "12.0.0-rc.100",
|
|
4
4
|
"description": "Core package for Applicaster's Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@applicaster/applicaster-types": "12.0.0-rc.
|
|
34
|
-
"@applicaster/quick-brick-core-plugins": "12.0.0-rc.
|
|
35
|
-
"@applicaster/zapp-pipes-v2-client": "12.0.0-rc.
|
|
36
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.
|
|
37
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-rc.
|
|
38
|
-
"@applicaster/zapp-react-native-ui-components": "12.0.0-rc.
|
|
39
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-rc.
|
|
33
|
+
"@applicaster/applicaster-types": "12.0.0-rc.100",
|
|
34
|
+
"@applicaster/quick-brick-core-plugins": "12.0.0-rc.100",
|
|
35
|
+
"@applicaster/zapp-pipes-v2-client": "12.0.0-rc.100",
|
|
36
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.100",
|
|
37
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-rc.100",
|
|
38
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.0-rc.100",
|
|
39
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-rc.100",
|
|
40
40
|
"atob": "^2.1.2",
|
|
41
|
-
"axios": "^0.
|
|
41
|
+
"axios": "^0.28.0",
|
|
42
42
|
"btoa": "^1.2.1",
|
|
43
43
|
"camelize": "^1.0.0",
|
|
44
44
|
"md5": "^2.3.0",
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"react-native-safe-area-context": "*"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@applicaster/zapp-react-native-flow-types": "1.5.0",
|
|
62
61
|
"@types/react-native": "0.69.6",
|
|
63
62
|
"@types/tizen-tv-webapis": "^2.0.1",
|
|
64
63
|
"nock": "^10.0.0",
|