@applicaster/quick-brick-core 12.0.0-alpha.5479873042 → 12.0.0-alpha.5521005225

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.
@@ -64,6 +64,8 @@ import { ZappPipesEntryContext } from "@applicaster/zapp-react-native-ui-compone
64
64
  import { PlayNextState } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/OverlayObserver/OverlaysObserver";
65
65
  import { inflateUrl } from "@applicaster/zapp-react-native-ui-components/Components/LinkHandler/LinkHandler";
66
66
  import { useModalStore } from "@applicaster/zapp-react-native-utils/modalState";
67
+ import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
68
+ import { QBUIComponentEvents } from "@applicaster/zapp-react-native-ui-components/events";
67
69
 
68
70
  const logger = coreAppLogger.addSubsystem("Navigator");
69
71
 
@@ -130,6 +132,10 @@ export function NavigationProvider({ children }: Props) {
130
132
 
131
133
  const online = useConnectionInfo(true);
132
134
 
135
+ const replaceEvent = useSubscriberFor(
136
+ QBUIComponentEvents.navigatorReplaceItem
137
+ );
138
+
133
139
  React.useEffect(() => {
134
140
  stateRef.current = state;
135
141
  pathnameRef.current = pathname;
@@ -259,6 +265,7 @@ export function NavigationProvider({ children }: Props) {
259
265
  item?.id !==
260
266
  legacyScreenData(state?.location?.state as NavigationScreenData)?.id
261
267
  ) {
268
+ replaceEvent();
262
269
  navigateTo(item, ACTIONS.REPLACE, options);
263
270
  }
264
271
  };
@@ -407,9 +414,12 @@ export function NavigationProvider({ children }: Props) {
407
414
  }
408
415
  };
409
416
 
410
- const handleHookCancel = ({ hookPlugin }, dispose) => {
411
- if (hookPlugin?.lastHook) {
412
- dispose();
417
+ const handleHookCancel = ({ hookPlugin, callback }, dispose) => {
418
+ dispose();
419
+ setStartUpHooks(false);
420
+
421
+ if (callback && typeof callback === "function") {
422
+ callback();
413
423
  }
414
424
 
415
425
  if (hookPlugin.isModalHook()) {
@@ -475,7 +485,13 @@ export function NavigationProvider({ children }: Props) {
475
485
  return false;
476
486
  }, [pluginConfigurations, plugins, rivers]);
477
487
 
478
- const [startUpHooks, setStartUpHooks] = React.useState(checkStartUpHooks);
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
+ };
479
495
 
480
496
  const handleHookComplete =
481
497
  (navigationAction, targetRoute, { screen, options }) =>
@@ -483,7 +499,7 @@ export function NavigationProvider({ children }: Props) {
483
499
  if (hookPlugin?.lastHook) {
484
500
  dispose({ disposeAll: true });
485
501
 
486
- startUpHooks && setStartUpHooks(false);
502
+ startUpHooks.current && setStartUpHooks(false);
487
503
  }
488
504
 
489
505
  dispatch(
@@ -592,7 +608,10 @@ export function NavigationProvider({ children }: Props) {
592
608
  targetScreen: screen,
593
609
  rivers,
594
610
  plugins,
595
- startUpHooksData: { startUpHooks, setStartUpHooks },
611
+ startUpHooksData: {
612
+ startUpHooks: currentStartUpHooks.current,
613
+ setStartUpHooks,
614
+ },
596
615
  };
597
616
 
598
617
  HooksManager(hooksOptions)
@@ -665,15 +684,15 @@ export function NavigationProvider({ children }: Props) {
665
684
 
666
685
  // It will only work for the regular stack and pathname, It won't work for modals
667
686
  // TODO: integrate video/hook and regular modal into stack.
668
- const getStackForPathname = React.useCallback((pathname: string):
669
- | NavigationScreenState
670
- | undefined => {
671
- const stack = [...stateRef?.current?.stack?.mainStack];
687
+ const getStackForPathname = (
688
+ pathname: string
689
+ ): NavigationScreenState | undefined => {
690
+ const stack = [...state?.stack?.mainStack];
672
691
 
673
692
  const currentStack = stack.find(({ route }) => route === pathname);
674
693
 
675
694
  return currentStack;
676
- }, []);
695
+ };
677
696
 
678
697
  const navigator: QuickBrickAppNavigator = React.useMemo(
679
698
  () => ({
@@ -717,6 +736,7 @@ export function NavigationProvider({ children }: Props) {
717
736
  replaceTop,
718
737
  getStack,
719
738
  getStackForPathname,
739
+ mainStack: state.stack.mainStack,
720
740
  }),
721
741
  [rivers, plugins, JSON.stringify(state), appLaunched, startUpHooks]
722
742
  );
@@ -3,7 +3,10 @@ import * as R from "ramda";
3
3
 
4
4
  import { NetInfoState } from "@react-native-community/netinfo";
5
5
  import { NETWORK_HOOKS_KEYS } from "./const";
6
- import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
6
+ import {
7
+ isVizioPlatform,
8
+ platformSelect,
9
+ } from "@applicaster/zapp-react-native-utils/reactUtils";
7
10
  import { Platform } from "react-native";
8
11
 
9
12
  type ConnectionStatus = boolean;
@@ -203,6 +206,18 @@ export const subscribeToDeviceNetworkChanges = (callback: NetCb) => {
203
206
  registeredListener = webapis.network.addNetworkStateChangeListener(
204
207
  samsungNetworkChangeHandler(callback)
205
208
  );
209
+
210
+ return;
211
+ }
212
+
213
+ if (isVizioPlatform()) {
214
+ window.addEventListener("online", function () {
215
+ callback({ online: true });
216
+ });
217
+
218
+ window.addEventListener("offline", function () {
219
+ callback({ online: false });
220
+ });
206
221
  }
207
222
  };
208
223
 
@@ -214,5 +229,12 @@ export const subscribeToDeviceNetworkChanges = (callback: NetCb) => {
214
229
  export const unsubscribeToDeviceNetworkChanges = (id = registeredListener) => {
215
230
  if (hasTizenAPIs()) {
216
231
  webapis.network.removeNetworkStateChangeListener(id);
232
+
233
+ return;
234
+ }
235
+
236
+ if (isVizioPlatform()) {
237
+ window.removeEventListener("online", function () {});
238
+ window.removeEventListener("offline", function () {});
217
239
  }
218
240
  };
package/App/index.tsx CHANGED
@@ -1,8 +1,8 @@
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
8
  import { ErrorBoundary } from "./ErrorBoundary";
@@ -27,6 +27,7 @@ import {
27
27
  import { withURLSchemeContextProvider } from "./DeepLinking/URLSchemeListener/URLSchemeContextProvider";
28
28
  import { appRemoteDataLoader } from "./appRemoteDataLoader";
29
29
  import { withActionExecutor } from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutorContext";
30
+ import { withScreenDataContextProvider } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenDataContext";
30
31
 
31
32
  /**
32
33
  * @typedef {Object} AppOptions
@@ -99,6 +100,7 @@ export function createQuickBrickApp(options): ZappApp {
99
100
  withURLSchemeContextProvider,
100
101
  withNetworkStatusProvider,
101
102
  withNavigationProvider,
103
+ withScreenDataContextProvider,
102
104
  ZappPipesSearchContext.withProvider,
103
105
  InteractionManager,
104
106
  withActionExecutor,
package/const/index.ts CHANGED
@@ -34,3 +34,7 @@ export const requiredSessionKeys = [
34
34
  "userAgent",
35
35
  "version_name",
36
36
  ];
37
+
38
+ export const QUICK_BRICK_NAVBAR = "quick-brick-navbar";
39
+
40
+ export const QUICK_BRICK_CONTENT = "quick-brick-content";
@@ -20,7 +20,6 @@ Object {
20
20
  "isAvailable": null,
21
21
  "nextState": null,
22
22
  },
23
- "isTransitioning": false,
24
23
  },
25
24
  "cellStyles": Object {},
26
25
  "components": Object {
@@ -7,6 +7,10 @@
7
7
  import * as React from "react";
8
8
  import * as R from "ramda";
9
9
  import { Dimensions } from "react-native";
10
+ import {
11
+ isNotEmpty,
12
+ isNotNil,
13
+ } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
10
14
 
11
15
  import {
12
16
  createZappReduxStore,
@@ -27,6 +31,9 @@ import { remoteDataLoader } from "../App/appRemoteDataLoader/remoteDataLoader";
27
31
  import * as QuickBrickManager from "@applicaster/zapp-react-native-bridge/QuickBrick";
28
32
  import { isAndroidPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
29
33
 
34
+ const isNotEmptyObject = (value: unknown) =>
35
+ isNotNil(value) && R.is(Object, value) && isNotEmpty(value);
36
+
30
37
  /**
31
38
  * Creates a Zapp App with the provided options
32
39
  * @export
@@ -55,8 +62,8 @@ export function createZappApp(zappAppConfig: ZappAppConfig) {
55
62
 
56
63
  const useTabletLayout =
57
64
  isTablet({ width, height }, width > height ? "landscape" : "portrait") &&
58
- tabletLayout &&
59
- tabletCellStyles;
65
+ isNotEmptyObject(tabletLayout) &&
66
+ isNotEmptyObject(tabletCellStyles);
60
67
 
61
68
  function fetchPluginConfiguration(plugin) {
62
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-alpha.5479873042",
3
+ "version": "12.0.0-alpha.5521005225",
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.5479873042",
34
- "@applicaster/quick-brick-core-plugins": "12.0.0-alpha.5479873042",
35
- "@applicaster/zapp-pipes-v2-client": "12.0.0-alpha.5479873042",
36
- "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.5479873042",
37
- "@applicaster/zapp-react-native-redux": "12.0.0-alpha.5479873042",
38
- "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.5479873042",
39
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.5479873042",
33
+ "@applicaster/applicaster-types": "12.0.0-alpha.5521005225",
34
+ "@applicaster/quick-brick-core-plugins": "12.0.0-alpha.5521005225",
35
+ "@applicaster/zapp-pipes-v2-client": "12.0.0-alpha.5521005225",
36
+ "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.5521005225",
37
+ "@applicaster/zapp-react-native-redux": "12.0.0-alpha.5521005225",
38
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.5521005225",
39
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.5521005225",
40
40
  "atob": "^2.1.2",
41
41
  "axios": "^0.28.0",
42
42
  "btoa": "^1.2.1",