@applicaster/quick-brick-core 12.0.0-alpha.4462655310 → 12.0.0-alpha.4484269996
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/DeepLinking/URLSchemeListener/index.tsx +3 -7
- package/App/LogicAggregatorContainer/index.tsx +5 -0
- package/App/NavigationProvider/NavigationProvider.tsx +18 -6
- package/App/NavigationProvider/ScreenHooks/ApplyScreenHooks.tsx +2 -8
- package/App/ThemeManager/index.tsx +1 -9
- package/App/index.tsx +30 -25
- package/createZappApp/__tests__/__snapshots__/createZappApp.test.js.snap +0 -1
- package/package.json +8 -8
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback, useContext } from "react";
|
|
2
2
|
|
|
3
3
|
import { URLSchemeHandler } from "../URLSchemeHandler";
|
|
4
4
|
import { URLSchemeContext } from "./URLSchemeContextProvider";
|
|
5
5
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
6
6
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
children: ReactChild;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export function URLSchemeListener(props: Props) {
|
|
8
|
+
export function URLSchemeListener({ children }) {
|
|
13
9
|
const { url, done } = useContext(URLSchemeContext);
|
|
14
10
|
|
|
15
11
|
const navigator = useNavigation();
|
|
@@ -33,5 +29,5 @@ export function URLSchemeListener(props: Props) {
|
|
|
33
29
|
return <URLSchemeHandler url={url} onFinish={onFinish} />;
|
|
34
30
|
}
|
|
35
31
|
|
|
36
|
-
return
|
|
32
|
+
return children;
|
|
37
33
|
}
|
|
@@ -414,9 +414,12 @@ export function NavigationProvider({ children }: Props) {
|
|
|
414
414
|
}
|
|
415
415
|
};
|
|
416
416
|
|
|
417
|
-
const handleHookCancel = ({ hookPlugin }, dispose) => {
|
|
418
|
-
|
|
419
|
-
|
|
417
|
+
const handleHookCancel = ({ hookPlugin, callback }, dispose) => {
|
|
418
|
+
dispose();
|
|
419
|
+
setStartUpHooks(false);
|
|
420
|
+
|
|
421
|
+
if (callback && typeof callback === "function") {
|
|
422
|
+
callback();
|
|
420
423
|
}
|
|
421
424
|
|
|
422
425
|
if (hookPlugin.isModalHook()) {
|
|
@@ -482,7 +485,13 @@ export function NavigationProvider({ children }: Props) {
|
|
|
482
485
|
return false;
|
|
483
486
|
}, [pluginConfigurations, plugins, rivers]);
|
|
484
487
|
|
|
485
|
-
const [startUpHooks,
|
|
488
|
+
const [startUpHooks, _setStartUpHooks] = React.useState(checkStartUpHooks);
|
|
489
|
+
const currentStartUpHooks = React.useRef(checkStartUpHooks);
|
|
490
|
+
|
|
491
|
+
const setStartUpHooks = (value) => {
|
|
492
|
+
_setStartUpHooks(value);
|
|
493
|
+
currentStartUpHooks.current = value;
|
|
494
|
+
};
|
|
486
495
|
|
|
487
496
|
const handleHookComplete =
|
|
488
497
|
(navigationAction, targetRoute, { screen, options }) =>
|
|
@@ -490,7 +499,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
490
499
|
if (hookPlugin?.lastHook) {
|
|
491
500
|
dispose({ disposeAll: true });
|
|
492
501
|
|
|
493
|
-
startUpHooks && setStartUpHooks(false);
|
|
502
|
+
startUpHooks.current && setStartUpHooks(false);
|
|
494
503
|
}
|
|
495
504
|
|
|
496
505
|
dispatch(
|
|
@@ -599,7 +608,10 @@ export function NavigationProvider({ children }: Props) {
|
|
|
599
608
|
targetScreen: screen,
|
|
600
609
|
rivers,
|
|
601
610
|
plugins,
|
|
602
|
-
startUpHooksData: {
|
|
611
|
+
startUpHooksData: {
|
|
612
|
+
startUpHooks: currentStartUpHooks.current,
|
|
613
|
+
setStartUpHooks,
|
|
614
|
+
},
|
|
603
615
|
};
|
|
604
616
|
|
|
605
617
|
HooksManager(hooksOptions)
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
2
|
-
import * as React from "react";
|
|
3
2
|
import { usePluginScreenHooks } from "./usePluginScreenHooks";
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
pathname: string;
|
|
7
|
-
children: React.ReactChildren;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function ApplyScreenHooks({ children }: Props) {
|
|
4
|
+
export function ApplyScreenHooks() {
|
|
11
5
|
const { currentRoute } = useNavigation();
|
|
12
6
|
usePluginScreenHooks(currentRoute);
|
|
13
7
|
|
|
14
|
-
return
|
|
8
|
+
return null;
|
|
15
9
|
}
|
|
@@ -9,17 +9,9 @@ import {
|
|
|
9
9
|
partitionByKeys,
|
|
10
10
|
} from "@applicaster/zapp-react-native-utils/objectUtils";
|
|
11
11
|
|
|
12
|
-
type Plugin = {
|
|
13
|
-
name: string;
|
|
14
|
-
identifier: string;
|
|
15
|
-
module: any;
|
|
16
|
-
type: string;
|
|
17
|
-
configuration: { [key: string]: any };
|
|
18
|
-
};
|
|
19
|
-
|
|
20
12
|
type Props = {
|
|
21
13
|
children: React.ReactNode;
|
|
22
|
-
plugins:
|
|
14
|
+
plugins: QuickBrickPlugin[];
|
|
23
15
|
};
|
|
24
16
|
|
|
25
17
|
const DEFAULT_THEME_ID = "base-theme";
|
package/App/index.tsx
CHANGED
|
@@ -28,16 +28,14 @@ import { withURLSchemeContextProvider } from "./DeepLinking/URLSchemeListener/UR
|
|
|
28
28
|
import { appRemoteDataLoader } from "./appRemoteDataLoader";
|
|
29
29
|
import { withActionExecutor } from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutorContext";
|
|
30
30
|
import { withScreenDataContextProvider } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenDataContext";
|
|
31
|
+
import { LogicAggregatorContainer } from "./LogicAggregatorContainer";
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* @param {Function} QuickBrickManager.sendQuickBrickEvent function invoked to pass events to the native side
|
|
39
|
-
* @param {[Function]} ContextProviders array of context providers to pass to the app
|
|
40
|
-
*/
|
|
33
|
+
interface AppOptions {
|
|
34
|
+
Layout: React.ComponentType;
|
|
35
|
+
OfflineHandler: React.ComponentType;
|
|
36
|
+
SplashLoader: React.ComponentType;
|
|
37
|
+
InteractionManager: React.ComponentType;
|
|
38
|
+
}
|
|
41
39
|
|
|
42
40
|
/**
|
|
43
41
|
* Creates a QuickBrick app with the provided options
|
|
@@ -45,12 +43,19 @@ import { withScreenDataContextProvider } from "@applicaster/zapp-react-native-ui
|
|
|
45
43
|
* @param {AppOptions} options
|
|
46
44
|
* @returns {ReactComponent}
|
|
47
45
|
*/
|
|
48
|
-
const App = ({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
const App = ({
|
|
47
|
+
Layout,
|
|
48
|
+
OfflineHandler,
|
|
49
|
+
SplashLoader,
|
|
50
|
+
InteractionManager,
|
|
51
|
+
}: AppOptions): ZappApp =>
|
|
52
|
+
React.memo(function ZappApp(props: AppComponentProps) {
|
|
53
|
+
const {
|
|
54
|
+
styles,
|
|
55
|
+
components: { AppContainer },
|
|
56
|
+
plugins,
|
|
57
|
+
} = props;
|
|
58
|
+
|
|
54
59
|
return (
|
|
55
60
|
<ThemeManager plugins={plugins}>
|
|
56
61
|
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
|
|
@@ -59,15 +64,16 @@ const App = ({ Layout, OfflineHandler, SplashLoader }): ZappApp =>
|
|
|
59
64
|
<URLSchemeListener>
|
|
60
65
|
<SplashLoader>
|
|
61
66
|
<OfflineHandler>
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
</Layout>
|
|
66
|
-
</ApplyScreenHooks>
|
|
67
|
+
<Layout>
|
|
68
|
+
<RouteManager />
|
|
69
|
+
</Layout>
|
|
67
70
|
</OfflineHandler>
|
|
68
71
|
</SplashLoader>
|
|
69
72
|
<ModalProvider />
|
|
70
73
|
</URLSchemeListener>
|
|
74
|
+
<LogicAggregatorContainer
|
|
75
|
+
components={[InteractionManager, ApplyScreenHooks]}
|
|
76
|
+
/>
|
|
71
77
|
</ErrorBoundary>
|
|
72
78
|
</AppContainer>
|
|
73
79
|
</SafeAreaProvider>
|
|
@@ -77,7 +83,7 @@ const App = ({ Layout, OfflineHandler, SplashLoader }): ZappApp =>
|
|
|
77
83
|
|
|
78
84
|
export function createQuickBrickApp(options): ZappApp {
|
|
79
85
|
const {
|
|
80
|
-
InteractionManager =
|
|
86
|
+
InteractionManager = () => null,
|
|
81
87
|
Layout,
|
|
82
88
|
QuickBrickManager,
|
|
83
89
|
OfflineHandler = R.prop("children"),
|
|
@@ -95,16 +101,15 @@ export function createQuickBrickApp(options): ZappApp {
|
|
|
95
101
|
storeConnector, // storeConnector should be first, as it disregards other props
|
|
96
102
|
...ContextProviders, // contexts consumers are only working below this point
|
|
97
103
|
appRemoteDataLoader,
|
|
98
|
-
withAppManager, // provides handlers when the app is going in the background, or comes out of it
|
|
104
|
+
withAppManager, // provides handlers when the app is going in the background, or comes out of it, can be moved to LogicAggregatorContainer
|
|
99
105
|
ZappPipesEntryContext.withProvider,
|
|
100
106
|
withURLSchemeContextProvider,
|
|
101
107
|
withNetworkStatusProvider,
|
|
102
108
|
withNavigationProvider,
|
|
103
109
|
withScreenDataContextProvider,
|
|
104
110
|
ZappPipesSearchContext.withProvider,
|
|
105
|
-
InteractionManager,
|
|
106
111
|
withActionExecutor,
|
|
107
112
|
withActionsProvider,
|
|
108
|
-
appLifeCycleManager(appLoader, QuickBrickManager)
|
|
109
|
-
)(App({ Layout, OfflineHandler, SplashLoader }));
|
|
113
|
+
appLifeCycleManager(appLoader, QuickBrickManager) // can be moved to LogicAggregatorContainer
|
|
114
|
+
)(App({ Layout, OfflineHandler, SplashLoader, InteractionManager }));
|
|
110
115
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.4484269996",
|
|
4
4
|
"description": "Core package for Applicaster's Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@applicaster/applicaster-types": "12.0.0-alpha.
|
|
34
|
-
"@applicaster/quick-brick-core-plugins": "12.0.0-alpha.
|
|
35
|
-
"@applicaster/zapp-pipes-v2-client": "12.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.
|
|
39
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.
|
|
33
|
+
"@applicaster/applicaster-types": "12.0.0-alpha.4484269996",
|
|
34
|
+
"@applicaster/quick-brick-core-plugins": "12.0.0-alpha.4484269996",
|
|
35
|
+
"@applicaster/zapp-pipes-v2-client": "12.0.0-alpha.4484269996",
|
|
36
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.4484269996",
|
|
37
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.4484269996",
|
|
38
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.4484269996",
|
|
39
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.4484269996",
|
|
40
40
|
"atob": "^2.1.2",
|
|
41
41
|
"axios": "^0.28.0",
|
|
42
42
|
"btoa": "^1.2.1",
|