@applicaster/zapp-react-native-utils 15.1.3 → 15.1.4-alpha.1402385444

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.
@@ -723,21 +723,6 @@ function getPlayerConfiguration({ platform, version }) {
723
723
  }
724
724
  );
725
725
 
726
- if (
727
- platform.includes("android") ||
728
- platform.includes("amazon") ||
729
- platform.includes("ios") ||
730
- platform.includes("tvos")
731
- ) {
732
- general.fields.push({
733
- key: "user_agent",
734
- label: "User agent",
735
- initial_value: "",
736
- type: "text_input",
737
- label_tooltip: "Override default user agent string",
738
- });
739
- }
740
-
741
726
  if (platform === "android_for_quickbrick") {
742
727
  general.fields.push({
743
728
  key: "stop_playback_on_task_removal",
@@ -2357,6 +2342,21 @@ function getPlayerConfiguration({ platform, version }) {
2357
2342
  );
2358
2343
  }
2359
2344
 
2345
+ if (
2346
+ platform.includes("android") ||
2347
+ platform.includes("amazon") ||
2348
+ platform.includes("ios") ||
2349
+ platform.includes("tvos")
2350
+ ) {
2351
+ general.fields.push({
2352
+ key: "user_agent",
2353
+ label: "User agent",
2354
+ initial_value: "",
2355
+ type: "text_input",
2356
+ label_tooltip: "Override default user agent string",
2357
+ });
2358
+ }
2359
+
2360
2360
  compact([
2361
2361
  {
2362
2362
  key: "liveCatchUpEnabled",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "15.1.3",
3
+ "version": "15.1.4-alpha.1402385444",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/applicaster-types": "15.1.3",
30
+ "@applicaster/applicaster-types": "15.1.4-alpha.1402385444",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",
@@ -38,3 +38,7 @@ export const useNavigationPluginData = jest.fn().mockReturnValue(mockMenu);
38
38
  export const useIsNavBarVisible = jest.fn().mockReturnValue(true);
39
39
 
40
40
  export const useIsScreenActive = jest.fn().mockReturnValue(true);
41
+
42
+ export const isScreenActiveForRoute = jest.fn(
43
+ (route, currentRoute) => route === currentRoute
44
+ );
@@ -0,0 +1,42 @@
1
+ import { isScreenActiveForRoute } from "../useIsScreenActive";
2
+
3
+ describe("isScreenActiveForRoute", () => {
4
+ const route = "/river/home/river/tabs";
5
+ const currentRoute = "/river/home/river/tabs";
6
+
7
+ it("returns false when route does not match", () => {
8
+ expect(
9
+ isScreenActiveForRoute(route, "/river/home", { visible: false })
10
+ ).toBe(false);
11
+ });
12
+
13
+ it("keeps underlying screen active when video modal is docked", () => {
14
+ expect(
15
+ isScreenActiveForRoute(route, currentRoute, {
16
+ visible: true,
17
+ mode: "MINIMIZED",
18
+ })
19
+ ).toBe(true);
20
+ });
21
+
22
+ it.each(["FULLSCREEN", "MAXIMIZED", "PIP"])(
23
+ "deactivates underlying screen when video modal is visible",
24
+ (mode) => {
25
+ expect(
26
+ isScreenActiveForRoute(route, currentRoute, {
27
+ visible: true,
28
+ mode,
29
+ })
30
+ ).toBe(false);
31
+ }
32
+ );
33
+
34
+ it("keeps video-modal route active when video modal is open", () => {
35
+ expect(
36
+ isScreenActiveForRoute("video-modal/123", currentRoute, {
37
+ visible: true,
38
+ mode: "FULLSCREEN",
39
+ })
40
+ ).toBe(true);
41
+ });
42
+ });
@@ -30,7 +30,7 @@ export { useNavigationType } from "./useNavigationType";
30
30
 
31
31
  export { useGetBottomTabBarHeight } from "./useGetBottomTabBarHeight";
32
32
 
33
- export { useIsScreenActive } from "./useIsScreenActive";
33
+ export { useIsScreenActive, isScreenActiveForRoute } from "./useIsScreenActive";
34
34
 
35
35
  export { useProfilerLogging } from "./useProfilerLogging";
36
36
 
@@ -2,20 +2,41 @@ import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtil
2
2
  import { useNavigation } from "./useNavigation";
3
3
  import { usePathname } from "./usePathname";
4
4
 
5
- // If current screen is active/focused (visible to the user)
6
- export const useIsScreenActive = () => {
7
- const pathname = usePathname();
8
- const { currentRoute, videoModalState } = useNavigation();
5
+ type VideoModalState = {
6
+ visible?: boolean;
7
+ mode?: string;
8
+ } | null;
9
9
 
10
- if (videoModalState.visible) {
11
- if (pathname.includes(ROUTE_TYPES.VIDEO_MODAL)) {
10
+ /**
11
+ * Whether a navigation route should be treated as the active/focused screen.
12
+ * Docked (MINIMIZED) video modal does not deactivate the underlying screen —
13
+ * only FULLSCREEN / MAXIMIZED / PIP do.
14
+ */
15
+ export function isScreenActiveForRoute(
16
+ route: string,
17
+ currentRoute: string,
18
+ videoModalState: VideoModalState
19
+ ) {
20
+ if (videoModalState?.visible) {
21
+ if (route.includes(ROUTE_TYPES.VIDEO_MODAL)) {
12
22
  return true;
13
23
  }
14
24
 
15
- if (["FULLSCREEN", "MAXIMIZED", "PIP"].includes(videoModalState.mode)) {
25
+ if (
26
+ ["FULLSCREEN", "MAXIMIZED", "PIP"].includes(videoModalState.mode ?? "")
27
+ ) {
16
28
  return false;
17
29
  }
30
+ // MINIMIZED (docked): fall through — underlying screen stays active
18
31
  }
19
32
 
20
- return pathname === currentRoute;
33
+ return route === currentRoute;
34
+ }
35
+
36
+ // If current screen is active/focused (visible to the user)
37
+ export const useIsScreenActive = () => {
38
+ const pathname = usePathname();
39
+ const { currentRoute, videoModalState } = useNavigation();
40
+
41
+ return isScreenActiveForRoute(pathname, currentRoute, videoModalState);
21
42
  };