@applicaster/zapp-react-native-utils 14.0.0-rc.1 → 14.0.0-rc.11
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.
|
@@ -3,6 +3,7 @@ import { accessibilityManagerLogger as logger } from "./logger";
|
|
|
3
3
|
import { TTSManager } from "../platform/platformUtils";
|
|
4
4
|
import { BUTTON_ACCESSIBILITY_KEYS } from "./const";
|
|
5
5
|
import { AccessibilityRole } from "react-native";
|
|
6
|
+
import _ from "lodash";
|
|
6
7
|
|
|
7
8
|
export class AccessibilityManager {
|
|
8
9
|
private static _instance: AccessibilityManager | null = null;
|
|
@@ -135,7 +136,9 @@ export class AccessibilityManager {
|
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
138
|
|
|
138
|
-
public getButtonAccessibilityProps(
|
|
139
|
+
public getButtonAccessibilityProps(name: string): AccessibilityProps {
|
|
140
|
+
const buttonName = _.toString(name);
|
|
141
|
+
|
|
139
142
|
const buttonConfig = BUTTON_ACCESSIBILITY_KEYS[buttonName];
|
|
140
143
|
|
|
141
144
|
if (!buttonConfig) {
|
|
@@ -8,7 +8,6 @@ const {
|
|
|
8
8
|
conditional_horizontal_type,
|
|
9
9
|
conditional_vertical_type,
|
|
10
10
|
conditional_horizontal_type_item_fixed,
|
|
11
|
-
conditional_horizontal_type_item_dynamic,
|
|
12
11
|
conditional_horizontal_asset_on,
|
|
13
12
|
conditional_horizontal_display_type_fixed,
|
|
14
13
|
} = require("./utils");
|
|
@@ -48,7 +47,7 @@ const componentConfigurationFields = [
|
|
|
48
47
|
{ text: "Right", value: "right" },
|
|
49
48
|
{ text: "Center", value: "center" },
|
|
50
49
|
],
|
|
51
|
-
...
|
|
50
|
+
...conditional_horizontal_type,
|
|
52
51
|
},
|
|
53
52
|
{
|
|
54
53
|
type: "select",
|
|
@@ -319,68 +319,3 @@ describe("getRiverFromRoute", () => {
|
|
|
319
319
|
expect(getRiverFromRoute({ route, rivers })).toEqual(river);
|
|
320
320
|
});
|
|
321
321
|
});
|
|
322
|
-
|
|
323
|
-
describe("isPreviousRouteHook", () => {
|
|
324
|
-
const { isPreviousRouteHook } = navigationUtils;
|
|
325
|
-
|
|
326
|
-
const history = {
|
|
327
|
-
entries: [],
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
it("returns false if it's a root route", () => {
|
|
331
|
-
history.entries.push({ pathname: "/river/root" });
|
|
332
|
-
const currentResult = isPreviousRouteHook(history.entries);
|
|
333
|
-
expect(currentResult).toBe(false);
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
it("returns false if previous root is not a hook", () => {
|
|
337
|
-
history.entries.push({ pathname: "/almostHooks/secondLevel" });
|
|
338
|
-
const currentResult = isPreviousRouteHook(history.entries);
|
|
339
|
-
expect(currentResult).toBe(false);
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
it("returns true if previous root is a hook", () => {
|
|
343
|
-
history.entries.push({ pathname: "/hooks/ThirdLevel" });
|
|
344
|
-
history.entries.push({ pathname: "/almostHooks/forthLevel" });
|
|
345
|
-
const currentResult = isPreviousRouteHook(history.entries);
|
|
346
|
-
expect(currentResult).toBe(true);
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
describe("getPreviousHooksCount", () => {
|
|
351
|
-
const { getPreviousHooksCount } = navigationUtils;
|
|
352
|
-
|
|
353
|
-
const history = {
|
|
354
|
-
entries: [],
|
|
355
|
-
};
|
|
356
|
-
|
|
357
|
-
it("returns 0 if it's a root route", () => {
|
|
358
|
-
history.entries.push({ pathname: "/river/root" });
|
|
359
|
-
const currentResult = getPreviousHooksCount(history);
|
|
360
|
-
expect(currentResult).toBe(0);
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
it("returns 0 if previous root is not a hook", () => {
|
|
364
|
-
history.entries.push({ pathname: "/almostHooks/secondLevel" });
|
|
365
|
-
const currentResult = getPreviousHooksCount(history);
|
|
366
|
-
expect(currentResult).toBe(0);
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
it("returns 1 if previous root is a hook", () => {
|
|
370
|
-
history.entries = [];
|
|
371
|
-
history.entries.push({ pathname: "/hooks/ThirdLevel" });
|
|
372
|
-
history.entries.push({ pathname: "/almostHooks/forthLevel" });
|
|
373
|
-
const currentResult = getPreviousHooksCount(history);
|
|
374
|
-
expect(currentResult).toBe(1);
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
it("returns 2 if 2 previous routes are a hooks", () => {
|
|
378
|
-
history.entries = [];
|
|
379
|
-
history.entries.push({ pathname: "/almostHooks/forthLevel" });
|
|
380
|
-
history.entries.push({ pathname: "/hooks/myHook" });
|
|
381
|
-
history.entries.push({ pathname: "/hooks/myHook" });
|
|
382
|
-
history.entries.push({ pathname: "/almostHooks/forthLevel" });
|
|
383
|
-
const currentResult = getPreviousHooksCount(history);
|
|
384
|
-
expect(currentResult).toBe(2);
|
|
385
|
-
});
|
|
386
|
-
});
|
package/navigationUtils/index.ts
CHANGED
|
@@ -363,37 +363,6 @@ export function getRiverFromRoute({
|
|
|
363
363
|
return screenType && screenId ? { screenType, screenId } : null;
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
-
/**
|
|
367
|
-
* Function returns true if the previous route (in the react-router history) is a hook plugin
|
|
368
|
-
* @param {*} entries - React-Router History Object
|
|
369
|
-
* @return boolean
|
|
370
|
-
*/
|
|
371
|
-
export function isPreviousRouteHook(entries: [{ pathname: string }]): boolean {
|
|
372
|
-
const previousRoute = entries[entries.length - 2];
|
|
373
|
-
if (!previousRoute) return false;
|
|
374
|
-
|
|
375
|
-
return R.test(/\/hooks\/.*/g, previousRoute.pathname);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* Function returns number of consecutive hooks that are behind the current route
|
|
380
|
-
* @param {*} history - React-Router History Object
|
|
381
|
-
* @return true
|
|
382
|
-
*/
|
|
383
|
-
export function getPreviousHooksCount(history: {
|
|
384
|
-
entries: [{ pathname: string }];
|
|
385
|
-
}): number {
|
|
386
|
-
let hooksCount = 0;
|
|
387
|
-
let entries = R.clone(history.entries);
|
|
388
|
-
|
|
389
|
-
while (isPreviousRouteHook(entries)) {
|
|
390
|
-
hooksCount++;
|
|
391
|
-
entries = R.init(entries);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
return hooksCount;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
366
|
export const usesVideoModal = (
|
|
398
367
|
item: ZappEntry,
|
|
399
368
|
rivers: Record<string, ZappRiver>,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "14.0.0-rc.
|
|
3
|
+
"version": "14.0.0-rc.11",
|
|
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": "14.0.0-rc.
|
|
30
|
+
"@applicaster/applicaster-types": "14.0.0-rc.11",
|
|
31
31
|
"buffer": "^5.2.1",
|
|
32
32
|
"camelize": "^1.0.0",
|
|
33
33
|
"dayjs": "^1.11.10",
|
package/playerUtils/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
|
|
3
3
|
import { isString } from "@applicaster/zapp-react-native-utils/typeGuards";
|
|
4
|
+
import { isFilledArray } from "@applicaster/zapp-react-native-utils/arrayUtils";
|
|
5
|
+
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
4
6
|
|
|
5
7
|
import { getBoolFromConfigValue } from "../configurationUtils";
|
|
6
8
|
|
|
@@ -89,3 +91,7 @@ export const isAudioItem = (item: Option<ZappEntry>) => {
|
|
|
89
91
|
|
|
90
92
|
return false;
|
|
91
93
|
};
|
|
94
|
+
|
|
95
|
+
export const isInlineTV = (screenData) => {
|
|
96
|
+
return isTV() && isFilledArray(screenData?.ui_components);
|
|
97
|
+
};
|