@applicaster/quick-brick-core 13.0.0-alpha.8490438700 → 13.0.0-alpha.8620112557
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.
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BehaviorSubject } from "rxjs";
|
|
2
|
+
|
|
3
|
+
class LoadingOverlayManager {
|
|
4
|
+
visibilitySubject: BehaviorSubject<boolean>;
|
|
5
|
+
|
|
6
|
+
constructor() {
|
|
7
|
+
this.visibilitySubject = new BehaviorSubject(false);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
show() {
|
|
11
|
+
this.visibilitySubject.next(true);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
hide() {
|
|
15
|
+
this.visibilitySubject.next(false);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
onVisibilityStateChange(cb: (value: boolean) => void) {
|
|
19
|
+
return this.visibilitySubject.subscribe(cb);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get visibility(): boolean {
|
|
23
|
+
return this.visibilitySubject.value;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const loadingOverlayManager = new LoadingOverlayManager();
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
|
|
4
|
+
import { isVizioPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
|
+
import { Spinner } from "@applicaster/zapp-react-native-ui-components/Components/Spinner";
|
|
6
|
+
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
7
|
+
|
|
8
|
+
import { useLoadingOverlayVisibility } from "./useLoadingOverlayVisibility";
|
|
9
|
+
|
|
10
|
+
export { loadingOverlayManager } from "./LoadingOverlayManager";
|
|
11
|
+
|
|
12
|
+
const styles = StyleSheet.create({
|
|
13
|
+
container: {
|
|
14
|
+
opacity: 0.5,
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
justifyContent: "center",
|
|
17
|
+
zIndex: 100,
|
|
18
|
+
flex: 1,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const LoadingOverlayComponent = () => {
|
|
23
|
+
const visible = useLoadingOverlayVisibility();
|
|
24
|
+
const theme = useTheme();
|
|
25
|
+
|
|
26
|
+
const backgroundColor = React.useMemo(() => {
|
|
27
|
+
return theme?.app_background_color || "black";
|
|
28
|
+
}, [theme?.app_background_color]);
|
|
29
|
+
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
if (visible) {
|
|
32
|
+
focusManager.disableFocus();
|
|
33
|
+
} else {
|
|
34
|
+
focusManager.enableFocus();
|
|
35
|
+
}
|
|
36
|
+
}, [visible]);
|
|
37
|
+
|
|
38
|
+
return visible ? (
|
|
39
|
+
<View
|
|
40
|
+
style={[StyleSheet.absoluteFill, styles.container, { backgroundColor }]}
|
|
41
|
+
>
|
|
42
|
+
<Spinner />
|
|
43
|
+
</View>
|
|
44
|
+
) : null;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const LoadingOverlay = isVizioPlatform()
|
|
48
|
+
? LoadingOverlayComponent
|
|
49
|
+
: () => null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { loadingOverlayManager } from "./LoadingOverlayManager";
|
|
3
|
+
|
|
4
|
+
export const useLoadingOverlayVisibility = () => {
|
|
5
|
+
const [visible, setVisible] = React.useState(
|
|
6
|
+
loadingOverlayManager.visibility
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
const listener = loadingOverlayManager.onVisibilityStateChange(setVisible);
|
|
11
|
+
|
|
12
|
+
return () => {
|
|
13
|
+
listener.unsubscribe();
|
|
14
|
+
};
|
|
15
|
+
}, []);
|
|
16
|
+
|
|
17
|
+
return visible;
|
|
18
|
+
};
|
|
@@ -49,6 +49,7 @@ import { coreAppLogger } from "../logger";
|
|
|
49
49
|
import {
|
|
50
50
|
getPlatform,
|
|
51
51
|
isTV,
|
|
52
|
+
isVizioPlatform,
|
|
52
53
|
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
53
54
|
import { useConnectionInfo } from "@applicaster/zapp-react-native-utils/reactHooks/connection";
|
|
54
55
|
import {
|
|
@@ -67,6 +68,9 @@ import { useModalStore } from "@applicaster/zapp-react-native-utils/modalState";
|
|
|
67
68
|
import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
|
|
68
69
|
import { QBUIComponentEvents } from "@applicaster/zapp-react-native-ui-components/events";
|
|
69
70
|
import { Hook } from "@applicaster/zapp-react-native-utils/appUtils/HooksManager/Hook";
|
|
71
|
+
import { URLSchemeContext } from "../DeepLinking/URLSchemeListener/URLSchemeContextProvider";
|
|
72
|
+
|
|
73
|
+
import { loadingOverlayManager } from "../LoadingOverlay";
|
|
70
74
|
|
|
71
75
|
const logger = coreAppLogger.addSubsystem("Navigator");
|
|
72
76
|
|
|
@@ -86,6 +90,8 @@ const navigationActions = {
|
|
|
86
90
|
const platform = getPlatform();
|
|
87
91
|
|
|
88
92
|
export function NavigationProvider({ children }: Props) {
|
|
93
|
+
const { url: deepLinkURL } = React.useContext(URLSchemeContext);
|
|
94
|
+
|
|
89
95
|
const {
|
|
90
96
|
appData: { layoutVersion },
|
|
91
97
|
rivers,
|
|
@@ -393,6 +399,8 @@ export function NavigationProvider({ children }: Props) {
|
|
|
393
399
|
} else {
|
|
394
400
|
dispatch(push(route, { entry: payload, screen: hookPlugin }));
|
|
395
401
|
}
|
|
402
|
+
|
|
403
|
+
closeLoadingOverlay();
|
|
396
404
|
};
|
|
397
405
|
|
|
398
406
|
const handleHookError = ({ error, hookPlugin, callback }, dispose) => {
|
|
@@ -411,6 +419,8 @@ export function NavigationProvider({ children }: Props) {
|
|
|
411
419
|
if (callback && typeof callback === "function") {
|
|
412
420
|
callback();
|
|
413
421
|
}
|
|
422
|
+
|
|
423
|
+
closeLoadingOverlay();
|
|
414
424
|
};
|
|
415
425
|
|
|
416
426
|
const handleHookCancel = ({ hookPlugin, callback }, dispose) => {
|
|
@@ -426,6 +436,8 @@ export function NavigationProvider({ children }: Props) {
|
|
|
426
436
|
} else {
|
|
427
437
|
goBack(true, true);
|
|
428
438
|
}
|
|
439
|
+
|
|
440
|
+
closeLoadingOverlay();
|
|
429
441
|
};
|
|
430
442
|
|
|
431
443
|
const handleHookSuccess = ({ hookPlugin, callback }) => {
|
|
@@ -436,6 +448,10 @@ export function NavigationProvider({ children }: Props) {
|
|
|
436
448
|
}
|
|
437
449
|
};
|
|
438
450
|
|
|
451
|
+
const handleBackgroundHook = () => {
|
|
452
|
+
openLoadingOverlay();
|
|
453
|
+
};
|
|
454
|
+
|
|
439
455
|
const checkStartUpHooks = React.useMemo(() => {
|
|
440
456
|
if (!pluginConfigurations) return false;
|
|
441
457
|
|
|
@@ -505,6 +521,8 @@ export function NavigationProvider({ children }: Props) {
|
|
|
505
521
|
);
|
|
506
522
|
|
|
507
523
|
callback?.();
|
|
524
|
+
|
|
525
|
+
closeLoadingOverlay();
|
|
508
526
|
};
|
|
509
527
|
|
|
510
528
|
const offlinePlugin = React.useMemo(() => {
|
|
@@ -619,6 +637,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
619
637
|
.on(HOOKS_EVENTS.ERROR, handleHookError)
|
|
620
638
|
.on(HOOKS_EVENTS.CANCEL, handleHookCancel)
|
|
621
639
|
.on(HOOKS_EVENTS.SUCCESS, handleHookSuccess)
|
|
640
|
+
.on(HOOKS_EVENTS.START_BACKGROUND_HOOK, handleBackgroundHook)
|
|
622
641
|
.on(
|
|
623
642
|
HOOKS_EVENTS.COMPLETE,
|
|
624
643
|
handleHookComplete(navigationAction, targetRoute, {
|
|
@@ -634,6 +653,14 @@ export function NavigationProvider({ children }: Props) {
|
|
|
634
653
|
},
|
|
635
654
|
});
|
|
636
655
|
|
|
656
|
+
const openLoadingOverlay = React.useCallback(() => {
|
|
657
|
+
deepLinkURL && isVizioPlatform() && loadingOverlayManager.show();
|
|
658
|
+
}, [deepLinkURL]);
|
|
659
|
+
|
|
660
|
+
const closeLoadingOverlay = React.useCallback(() => {
|
|
661
|
+
loadingOverlayManager.hide();
|
|
662
|
+
}, []);
|
|
663
|
+
|
|
637
664
|
const openPiP = React.useCallback(() => {
|
|
638
665
|
dispatch(setVideoPiP());
|
|
639
666
|
}, []);
|
package/App/index.tsx
CHANGED
|
@@ -29,6 +29,7 @@ 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
31
|
import { LogicAggregatorContainer } from "./LogicAggregatorContainer";
|
|
32
|
+
import { LoadingOverlay } from "./LoadingOverlay";
|
|
32
33
|
|
|
33
34
|
interface AppOptions {
|
|
34
35
|
Layout: React.ComponentType;
|
|
@@ -74,6 +75,7 @@ const App = ({
|
|
|
74
75
|
<LogicAggregatorContainer
|
|
75
76
|
components={[InteractionManager, ApplyScreenHooks]}
|
|
76
77
|
/>
|
|
78
|
+
<LoadingOverlay />
|
|
77
79
|
</ErrorBoundary>
|
|
78
80
|
</AppContainer>
|
|
79
81
|
</SafeAreaProvider>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.8620112557",
|
|
4
4
|
"description": "Core package for Applicaster's Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@applicaster/applicaster-types": "13.0.0-alpha.
|
|
33
|
-
"@applicaster/quick-brick-core-plugins": "13.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-pipes-v2-client": "13.0.0-alpha.
|
|
35
|
-
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.
|
|
32
|
+
"@applicaster/applicaster-types": "13.0.0-alpha.8620112557",
|
|
33
|
+
"@applicaster/quick-brick-core-plugins": "13.0.0-alpha.8620112557",
|
|
34
|
+
"@applicaster/zapp-pipes-v2-client": "13.0.0-alpha.8620112557",
|
|
35
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.8620112557",
|
|
36
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.8620112557",
|
|
37
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.8620112557",
|
|
38
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.8620112557",
|
|
39
39
|
"atob": "^2.1.2",
|
|
40
40
|
"axios": "^0.28.0",
|
|
41
41
|
"btoa": "^1.2.1",
|