@applicaster/zapp-react-native-utils 15.0.0-rc.4 → 15.0.0-rc.40
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/analyticsUtils/AnalyticPlayerListener.ts +5 -2
- package/appUtils/accessibilityManager/const.ts +4 -0
- package/appUtils/accessibilityManager/hooks.ts +20 -13
- package/appUtils/accessibilityManager/index.ts +28 -1
- package/appUtils/accessibilityManager/utils.ts +36 -5
- package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +1 -0
- package/appUtils/focusManager/index.ios.ts +18 -1
- package/appUtils/focusManagerAux/utils/index.ts +18 -0
- package/appUtils/focusManagerAux/utils/utils.ios.ts +35 -0
- package/appUtils/platform/platformUtils.ts +116 -17
- package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +94 -4
- package/appUtils/playerManager/OverlayObserver/utils.ts +32 -20
- package/appUtils/playerManager/conts.ts +21 -0
- package/appUtils/playerManager/player.ts +4 -0
- package/appUtils/playerManager/usePlayerState.tsx +14 -2
- package/arrayUtils/__tests__/allTruthy.test.ts +24 -0
- package/arrayUtils/__tests__/anyThruthy.test.ts +24 -0
- package/arrayUtils/index.ts +5 -0
- package/cellUtils/index.ts +32 -0
- package/manifestUtils/defaultManifestConfigurations/player.js +59 -1
- package/manifestUtils/keys.js +21 -0
- package/manifestUtils/sharedConfiguration/screenPicker/utils.js +1 -0
- package/navigationUtils/index.ts +19 -16
- package/package.json +2 -2
- package/playerUtils/usePlayerTTS.ts +8 -3
- package/reactHooks/feed/useBatchLoading.ts +7 -1
- package/reactHooks/feed/usePipesCacheReset.ts +3 -1
- package/reactHooks/layout/index.ts +1 -1
- package/reactHooks/player/TVSeekControlller/TVSeekController.ts +27 -10
- package/utils/__tests__/mapAccum.test.ts +73 -0
- package/utils/index.ts +7 -0
- package/utils/mapAccum.ts +23 -0
- package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +15 -1
|
@@ -92,22 +92,26 @@ export const prefetchImage = (playableItem: ZappEntry, config: any = {}) => {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Loads a feed entry from the given feed URL using the provided Zapp entry as context.
|
|
97
|
+
*
|
|
98
|
+
* @param {string} feedUrl - The URL of the feed to load the entry from.
|
|
99
|
+
* @param {ZappEntry} entry - The Zapp entry to use as context for the request.
|
|
100
|
+
* @returns {Promise<ZappEntry>} A promise that resolves to the loaded Zapp entry.
|
|
101
|
+
* @throws {Error} If the feed loading fails or no entry is found in the response.
|
|
102
|
+
*/
|
|
103
|
+
export const loadFeedEntry = async (feedUrl: string, entry: ZappEntry) => {
|
|
100
104
|
const requestBuilder = new RequestBuilder()
|
|
101
105
|
.setEntryContext(entry)
|
|
102
106
|
.setScreenContext({} as ZappRiver)
|
|
103
|
-
.setUrl(
|
|
107
|
+
.setUrl(feedUrl);
|
|
104
108
|
|
|
105
109
|
const responseObject = await requestBuilder.call<ZappEntry>();
|
|
106
110
|
const responseHelper = new PipesClientResponseHelper(responseObject);
|
|
107
111
|
|
|
108
112
|
if (responseHelper.error) {
|
|
109
113
|
log_error(
|
|
110
|
-
`
|
|
114
|
+
`loadFeedEntry: loading failed with error: ${responseHelper.error.message}. Observer will not be executed`,
|
|
111
115
|
{
|
|
112
116
|
response: responseHelper.getLogsData(),
|
|
113
117
|
}
|
|
@@ -116,29 +120,37 @@ export const loadFeedAndPrefetchThumbnailImage = async (
|
|
|
116
120
|
throw responseHelper.error;
|
|
117
121
|
} else {
|
|
118
122
|
log_info(
|
|
119
|
-
`
|
|
123
|
+
`loadFeedEntry: Feed was successfully loaded for url: ${feedUrl}`,
|
|
120
124
|
responseHelper.getLogsData()
|
|
121
125
|
);
|
|
122
126
|
|
|
123
|
-
const
|
|
127
|
+
const entry = responseHelper.responseData?.entry[0];
|
|
124
128
|
|
|
125
|
-
if (!
|
|
126
|
-
|
|
127
|
-
"
|
|
128
|
-
responseHelper.getLogsData()
|
|
129
|
-
);
|
|
129
|
+
if (!entry) {
|
|
130
|
+
const error =
|
|
131
|
+
"loadFeedEntry: Can not retrieve entry, feed was loaded but no entry was found";
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
"Can not retrieve play next entry, feed was loaded but no entry was found"
|
|
133
|
-
);
|
|
134
|
-
}
|
|
133
|
+
log_error(error, responseHelper.getLogsData());
|
|
135
134
|
|
|
136
|
-
|
|
135
|
+
throw new Error(error);
|
|
136
|
+
}
|
|
137
137
|
|
|
138
|
-
return
|
|
138
|
+
return entry;
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
+
export const loadFeedAndPrefetchThumbnailImage = async (
|
|
143
|
+
playNextFeedUrl: string,
|
|
144
|
+
entry: ZappEntry,
|
|
145
|
+
playNextPlugin
|
|
146
|
+
) => {
|
|
147
|
+
const playNextEntry = await loadFeedEntry(playNextFeedUrl, entry);
|
|
148
|
+
|
|
149
|
+
prefetchImage(playNextEntry, playNextPlugin?.configuration);
|
|
150
|
+
|
|
151
|
+
return playNextEntry;
|
|
152
|
+
};
|
|
153
|
+
|
|
142
154
|
export const findPluginByIdentifier = (
|
|
143
155
|
identifier: string,
|
|
144
156
|
plugins: ZappPlugin[]
|
|
@@ -2,6 +2,27 @@ export const userPreferencesNamespace = "user_preferences";
|
|
|
2
2
|
|
|
3
3
|
export const skipActionType = "show_skip";
|
|
4
4
|
|
|
5
|
+
export class PlayerError
|
|
6
|
+
extends Error
|
|
7
|
+
implements QuickBrickPlayer.PlayerErrorI
|
|
8
|
+
{
|
|
9
|
+
description: string;
|
|
10
|
+
|
|
11
|
+
constructor(message: string, description: string) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.description = description;
|
|
14
|
+
|
|
15
|
+
Object.setPrototypeOf(this, PlayerError.prototype);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
toObject() {
|
|
19
|
+
return {
|
|
20
|
+
error: this.message,
|
|
21
|
+
message: this.description,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
5
26
|
export enum SharedPlayerCallBacksKeys {
|
|
6
27
|
OnPlayerResume = "onPlayerResume",
|
|
7
28
|
OnPlayerPause = "onPlayerPause",
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { Player } from "./player";
|
|
3
3
|
import { usePlayer } from "./usePlayer";
|
|
4
4
|
|
|
5
|
-
type PlayerState = {
|
|
5
|
+
export type PlayerState = {
|
|
6
6
|
currentTime: number;
|
|
7
7
|
duration: number;
|
|
8
8
|
seekableDuration: number;
|
|
@@ -10,6 +10,8 @@ type PlayerState = {
|
|
|
10
10
|
isPaused: boolean;
|
|
11
11
|
isBuffering: boolean;
|
|
12
12
|
isReadyToPlay: boolean;
|
|
13
|
+
trackState?: QuickBrickPlayer.TracksState;
|
|
14
|
+
isAd: boolean;
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
export const usePlayerState = (
|
|
@@ -24,6 +26,8 @@ export const usePlayerState = (
|
|
|
24
26
|
isPaused: null,
|
|
25
27
|
isBuffering: false,
|
|
26
28
|
isReadyToPlay: false,
|
|
29
|
+
trackState: null,
|
|
30
|
+
isAd: false,
|
|
27
31
|
});
|
|
28
32
|
|
|
29
33
|
const player: Player = usePlayer(playerId);
|
|
@@ -37,6 +41,8 @@ export const usePlayerState = (
|
|
|
37
41
|
isPaused: player.isPaused(),
|
|
38
42
|
isBuffering: player.isBuffering(),
|
|
39
43
|
isReadyToPlay: player.isReadyToPlay(),
|
|
44
|
+
trackState: player.getTracksState(),
|
|
45
|
+
isAd: player.isAd(),
|
|
40
46
|
});
|
|
41
47
|
}, [player]);
|
|
42
48
|
|
|
@@ -54,10 +60,16 @@ export const usePlayerState = (
|
|
|
54
60
|
onPlayerPause: onPlayerChangeState,
|
|
55
61
|
onPlayerResume: onPlayerChangeState,
|
|
56
62
|
onPlayerSeekComplete: onPlayerChangeState,
|
|
63
|
+
onTracksChanged: onPlayerChangeState,
|
|
64
|
+
onAdBreakBegin: onPlayerChangeState,
|
|
65
|
+
onAdBreakEnd: onPlayerChangeState,
|
|
66
|
+
onAdBegin: onPlayerChangeState,
|
|
67
|
+
onAdEnd: onPlayerChangeState,
|
|
68
|
+
onAdError: onPlayerChangeState,
|
|
57
69
|
},
|
|
58
70
|
});
|
|
59
71
|
}
|
|
60
|
-
}, [player]);
|
|
72
|
+
}, [listenerId, onPlayerChangeState, player]);
|
|
61
73
|
|
|
62
74
|
return state;
|
|
63
75
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { allTruthy } from "..";
|
|
2
|
+
|
|
3
|
+
describe("allTruthy", () => {
|
|
4
|
+
it("should return true when all values are true", () => {
|
|
5
|
+
expect(allTruthy([true, true, true])).toBe(true);
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it("should return false when at least one value is false", () => {
|
|
9
|
+
expect(allTruthy([true, false, true])).toBe(false);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should return false when all values are false", () => {
|
|
13
|
+
expect(allTruthy([false, false, false])).toBe(false);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should return false for an empty array", () => {
|
|
17
|
+
expect(allTruthy([])).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should handle single-element arrays correctly", () => {
|
|
21
|
+
expect(allTruthy([true])).toBe(true);
|
|
22
|
+
expect(allTruthy([false])).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { anyTruthy } from "..";
|
|
2
|
+
|
|
3
|
+
describe("anyTruthy", () => {
|
|
4
|
+
it("should return true when at least one value is true", () => {
|
|
5
|
+
expect(anyTruthy([false, true, false])).toBe(true);
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it("should return false when all values are false", () => {
|
|
9
|
+
expect(anyTruthy([false, false, false])).toBe(false);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should return true when all values are true", () => {
|
|
13
|
+
expect(anyTruthy([true, true, true])).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should return false for an empty array", () => {
|
|
17
|
+
expect(anyTruthy([])).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should handle single-element arrays correctly", () => {
|
|
21
|
+
expect(anyTruthy([true])).toBe(true);
|
|
22
|
+
expect(anyTruthy([false])).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
});
|
package/arrayUtils/index.ts
CHANGED
package/cellUtils/index.ts
CHANGED
|
@@ -505,3 +505,35 @@ export const getImageContainerMarginStyles = ({ value }: { value: any }) => {
|
|
|
505
505
|
marginRight: value("image_margin_right"),
|
|
506
506
|
};
|
|
507
507
|
};
|
|
508
|
+
|
|
509
|
+
export const isTextLabel = (key: string): boolean =>
|
|
510
|
+
key.includes("text_label_") && key.endsWith("_switch");
|
|
511
|
+
|
|
512
|
+
export const hasTextLabelsEnabled = (
|
|
513
|
+
configuration: Record<string, any>
|
|
514
|
+
): boolean => {
|
|
515
|
+
const textLabelsKeys = Object.keys(configuration).filter(isTextLabel);
|
|
516
|
+
|
|
517
|
+
const picked = textLabelsKeys.reduce(
|
|
518
|
+
(acc, key) => {
|
|
519
|
+
acc[key] = configuration[key];
|
|
520
|
+
|
|
521
|
+
return acc;
|
|
522
|
+
},
|
|
523
|
+
{} as Record<string, any>
|
|
524
|
+
);
|
|
525
|
+
|
|
526
|
+
const pickedValues = Object.values(picked);
|
|
527
|
+
|
|
528
|
+
return pickedValues.some((value) => {
|
|
529
|
+
if (typeof value === "boolean") {
|
|
530
|
+
return value === true;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (typeof value === "string") {
|
|
534
|
+
return value !== "" && value.toLowerCase() !== "false";
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
return Boolean(value);
|
|
538
|
+
});
|
|
539
|
+
};
|
|
@@ -335,6 +335,20 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
335
335
|
};
|
|
336
336
|
|
|
337
337
|
if (isTV(platform)) {
|
|
338
|
+
localizations.fields.push({
|
|
339
|
+
key: "back_to_live_label",
|
|
340
|
+
label: "Back to live label",
|
|
341
|
+
initial_value: "Back To Live",
|
|
342
|
+
type: "text_input",
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
localizations.fields.push({
|
|
346
|
+
key: "start_over_label",
|
|
347
|
+
label: "Start over label",
|
|
348
|
+
initial_value: "Start Over",
|
|
349
|
+
type: "text_input",
|
|
350
|
+
});
|
|
351
|
+
|
|
338
352
|
styles.fields.push(
|
|
339
353
|
fieldsGroup("Always Show Scrub Bar & Timestamp", "", [
|
|
340
354
|
{
|
|
@@ -447,7 +461,7 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
447
461
|
),
|
|
448
462
|
fieldsGroup(
|
|
449
463
|
"Skip Button",
|
|
450
|
-
"This section allows you to configure the skip button
|
|
464
|
+
"This section allows you to configure the skip button behaviour",
|
|
451
465
|
[
|
|
452
466
|
{
|
|
453
467
|
type: "switch",
|
|
@@ -464,6 +478,12 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
464
478
|
label: "Persistent Button Toggle",
|
|
465
479
|
initial_value: true,
|
|
466
480
|
},
|
|
481
|
+
]
|
|
482
|
+
),
|
|
483
|
+
fieldsGroup(
|
|
484
|
+
"Labeled Button Style",
|
|
485
|
+
"This section allows you to configure the labeled button styles",
|
|
486
|
+
[
|
|
467
487
|
{
|
|
468
488
|
type: "color_picker_rgba",
|
|
469
489
|
label_tooltip: "",
|
|
@@ -619,6 +639,44 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
619
639
|
);
|
|
620
640
|
}
|
|
621
641
|
|
|
642
|
+
if (isTV(platform)) {
|
|
643
|
+
general.fields.push(
|
|
644
|
+
{
|
|
645
|
+
key: "liveSeekingEnabled",
|
|
646
|
+
label: "Live Seeking Enabled",
|
|
647
|
+
initial_value: false,
|
|
648
|
+
type: "switch",
|
|
649
|
+
label_tooltip: "Enable Live Seek",
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
key: "minimumAllowedSeekableDurationInSeconds",
|
|
653
|
+
label: "Minimum allowed seekable duration in seconds",
|
|
654
|
+
initial_value: 300,
|
|
655
|
+
type: "number_input",
|
|
656
|
+
label_tooltip:
|
|
657
|
+
"If duration less than this value, player will disable 'liveSeekingEnabled' value",
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
key: "live_image",
|
|
661
|
+
label: "Live badge",
|
|
662
|
+
type: "uploader",
|
|
663
|
+
label_tooltip: "Override default live badge / icon",
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
key: "live_width",
|
|
667
|
+
label: "Live badge width",
|
|
668
|
+
type: "number_input",
|
|
669
|
+
initial_value: 85,
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
key: "live_height",
|
|
673
|
+
label: "Live badge height",
|
|
674
|
+
type: "number_input",
|
|
675
|
+
initial_value: 50,
|
|
676
|
+
}
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
|
|
622
680
|
if (isMobile(platform)) {
|
|
623
681
|
general.fields.push(
|
|
624
682
|
{
|
package/manifestUtils/keys.js
CHANGED
|
@@ -959,6 +959,27 @@ const TV_CELL_LABEL_FIELDS = [
|
|
|
959
959
|
rules: "conditional",
|
|
960
960
|
conditions: [{ key: "switch", section: "styles", value: true }],
|
|
961
961
|
},
|
|
962
|
+
{
|
|
963
|
+
type: ZAPPIFEST_FIELDS.font_selector.roku,
|
|
964
|
+
suffix: "roku font family",
|
|
965
|
+
tooltip: "",
|
|
966
|
+
rules: "conditional",
|
|
967
|
+
conditions: [{ key: "switch", section: "styles", value: true }],
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
971
|
+
suffix: "roku font size",
|
|
972
|
+
tooltip: "",
|
|
973
|
+
rules: "conditional",
|
|
974
|
+
conditions: [{ key: "switch", section: "styles", value: true }],
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
978
|
+
suffix: "roku line height",
|
|
979
|
+
tooltip: "",
|
|
980
|
+
rules: "conditional",
|
|
981
|
+
conditions: [{ key: "switch", section: "styles", value: true }],
|
|
982
|
+
},
|
|
962
983
|
{
|
|
963
984
|
type: ZAPPIFEST_FIELDS.select,
|
|
964
985
|
suffix: "text alignment",
|
package/navigationUtils/index.ts
CHANGED
|
@@ -575,24 +575,27 @@ export function routeIsPlayerScreen(currentRoute) {
|
|
|
575
575
|
return currentRoute?.includes("/playable");
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
-
export const getNavBarProps =
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
578
|
+
export const getNavBarProps = (
|
|
579
|
+
currentRiver: ZappRiver,
|
|
580
|
+
pathname: string,
|
|
581
|
+
title: string
|
|
582
|
+
) => {
|
|
583
|
+
const props = getNavigationPropsV2({
|
|
584
|
+
currentRiver,
|
|
585
|
+
title,
|
|
586
|
+
category: "nav_bar",
|
|
587
|
+
});
|
|
585
588
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
589
|
+
if (props) {
|
|
590
|
+
return {
|
|
591
|
+
...props,
|
|
592
|
+
id: pathname,
|
|
593
|
+
pathname: pathname,
|
|
594
|
+
};
|
|
595
|
+
}
|
|
593
596
|
|
|
594
|
-
|
|
595
|
-
|
|
597
|
+
return null;
|
|
598
|
+
};
|
|
596
599
|
|
|
597
600
|
export const findMenuPlugin = (
|
|
598
601
|
navigations: ZappNavigation[],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "15.0.0-rc.
|
|
3
|
+
"version": "15.0.0-rc.40",
|
|
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.0.0-rc.
|
|
30
|
+
"@applicaster/applicaster-types": "15.0.0-rc.40",
|
|
31
31
|
"buffer": "^5.2.1",
|
|
32
32
|
"camelize": "^1.0.0",
|
|
33
33
|
"dayjs": "^1.11.10",
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useAccessibilityManager,
|
|
5
|
+
useAccessibilityState,
|
|
6
|
+
} from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
4
7
|
import { PlayerTTS } from "@applicaster/zapp-react-native-utils/playerUtils/PlayerTTS";
|
|
5
8
|
|
|
6
9
|
export const usePlayerTTS = () => {
|
|
7
10
|
const player = usePlayer();
|
|
8
11
|
const accessibilityManager = useAccessibilityManager({});
|
|
12
|
+
const accessibilityState = useAccessibilityState();
|
|
13
|
+
const isScreenReaderEnabled = accessibilityState.screenReaderEnabled;
|
|
9
14
|
|
|
10
15
|
React.useEffect(() => {
|
|
11
|
-
if (player && accessibilityManager) {
|
|
16
|
+
if (player && accessibilityManager && isScreenReaderEnabled) {
|
|
12
17
|
const playerTTS = new PlayerTTS(player, accessibilityManager);
|
|
13
18
|
const unsubscribe = playerTTS.init();
|
|
14
19
|
|
|
@@ -17,5 +22,5 @@ export const usePlayerTTS = () => {
|
|
|
17
22
|
playerTTS.destroy();
|
|
18
23
|
};
|
|
19
24
|
}
|
|
20
|
-
}, [player, accessibilityManager]);
|
|
25
|
+
}, [player, accessibilityManager, isScreenReaderEnabled]);
|
|
21
26
|
};
|
|
@@ -151,7 +151,13 @@ export const useBatchLoading = (
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
|
-
}, [
|
|
154
|
+
}, [
|
|
155
|
+
batchComponents,
|
|
156
|
+
feeds,
|
|
157
|
+
getUrl,
|
|
158
|
+
loadPipesDataDispatcher,
|
|
159
|
+
options.riverId,
|
|
160
|
+
]);
|
|
155
161
|
|
|
156
162
|
React.useEffect(() => {
|
|
157
163
|
runBatchLoading();
|
|
@@ -147,17 +147,34 @@ export class TVSeekController
|
|
|
147
147
|
|
|
148
148
|
let targetPos = currentPos;
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
const isLive = this.playerController.isLive();
|
|
151
|
+
|
|
152
|
+
if (isLive) {
|
|
153
|
+
if (this.currentSeekType === SEEK_TYPE.REWIND) {
|
|
154
|
+
targetPos = Math.min(
|
|
155
|
+
currentPos + offset,
|
|
156
|
+
this.playerController.getSeekableDuration()
|
|
157
|
+
);
|
|
158
|
+
} else if (this.currentSeekType === SEEK_TYPE.FORWARD) {
|
|
159
|
+
targetPos = Math.max(0, currentPos - offset);
|
|
160
|
+
} else {
|
|
161
|
+
log_warning(
|
|
162
|
+
`TVSeekController: handleDelayedSeek - invalid seek type: ${this.currentSeekType}`
|
|
163
|
+
);
|
|
164
|
+
}
|
|
157
165
|
} else {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
166
|
+
if (this.currentSeekType === SEEK_TYPE.FORWARD) {
|
|
167
|
+
targetPos = Math.min(
|
|
168
|
+
currentPos + offset,
|
|
169
|
+
this.playerController.getSeekableDuration()
|
|
170
|
+
);
|
|
171
|
+
} else if (this.currentSeekType === SEEK_TYPE.REWIND) {
|
|
172
|
+
targetPos = Math.max(0, currentPos - offset);
|
|
173
|
+
} else {
|
|
174
|
+
log_warning(
|
|
175
|
+
`TVSeekController: handleDelayedSeek - invalid seek type: ${this.currentSeekType}`
|
|
176
|
+
);
|
|
177
|
+
}
|
|
161
178
|
}
|
|
162
179
|
|
|
163
180
|
log_debug(
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { mapAccum } from "../mapAccum";
|
|
2
|
+
|
|
3
|
+
describe("mapAccum", () => {
|
|
4
|
+
it("using standard ramda test", () => {
|
|
5
|
+
const digits = ["1", "2", "3", "4"];
|
|
6
|
+
const appender = (a, b) => [a + b, a + b];
|
|
7
|
+
|
|
8
|
+
const [acc, result] = mapAccum(appender, 0, digits); //= > ['01234', ['01', '012', '0123', '01234']]
|
|
9
|
+
expect(acc).toBe("01234");
|
|
10
|
+
expect(result).toEqual(["01", "012", "0123", "01234"]);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("maps and accumulates over an array", () => {
|
|
14
|
+
const fn = (acc, x) => [acc + x, x * 2];
|
|
15
|
+
const [acc, result] = mapAccum(fn, 0, [1, 2, 3]);
|
|
16
|
+
|
|
17
|
+
expect(acc).toBe(6); // final accumulator (0 + 1 + 2 + 3)
|
|
18
|
+
expect(result).toEqual([2, 4, 6]); // mapped values (acc + x*2 at each step)
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("returns initial accumulator for empty array", () => {
|
|
22
|
+
const fn = (acc, x) => [acc + x, acc * x];
|
|
23
|
+
const [acc, result] = mapAccum(fn, 10, []);
|
|
24
|
+
|
|
25
|
+
expect(acc).toBe(10);
|
|
26
|
+
expect(result).toEqual([]);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("accumulates strings correctly", () => {
|
|
30
|
+
const fn = (acc, x) => [acc + x, acc + x];
|
|
31
|
+
const [acc, result] = mapAccum(fn, "A", ["B", "C", "D"]);
|
|
32
|
+
|
|
33
|
+
expect(acc).toBe("ABCD");
|
|
34
|
+
expect(result).toEqual(["AB", "ABC", "ABCD"]);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("works with objects as accumulator", () => {
|
|
38
|
+
const fn = (acc, x) => {
|
|
39
|
+
const newAcc = { sum: acc.sum + x };
|
|
40
|
+
|
|
41
|
+
return [newAcc, newAcc.sum];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const [acc, result] = mapAccum(fn, { sum: 0 }, [1, 2, 3]);
|
|
45
|
+
|
|
46
|
+
expect(acc).toEqual({ sum: 6 });
|
|
47
|
+
expect(result).toEqual([1, 3, 6]);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("is curried", () => {
|
|
51
|
+
const fn = (acc, x) => [acc + x, x * 2];
|
|
52
|
+
const mapWithFn = mapAccum(fn);
|
|
53
|
+
const withInit = mapWithFn(2);
|
|
54
|
+
const [acc, result] = withInit([1, 2, 3]);
|
|
55
|
+
|
|
56
|
+
expect(acc).toBe(8);
|
|
57
|
+
expect(result).toEqual([2, 4, 6]);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("does not mutate the original array", () => {
|
|
61
|
+
const arr = [1, 2, 3];
|
|
62
|
+
mapAccum((acc, x) => [acc + x, acc + x], 0, arr);
|
|
63
|
+
expect(arr).toEqual([1, 2, 3]);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("handles mixed types in accumulator and result", () => {
|
|
67
|
+
const fn = (acc, x) => [acc + x.length, acc + "-" + x];
|
|
68
|
+
const [acc, result] = mapAccum(fn, 0, ["a", "bb", "ccc"]);
|
|
69
|
+
|
|
70
|
+
expect(acc).toBe(6);
|
|
71
|
+
expect(result).toEqual(["0-a", "1-bb", "3-ccc"]);
|
|
72
|
+
});
|
|
73
|
+
});
|
package/utils/index.ts
CHANGED
|
@@ -16,6 +16,8 @@ export { endsWith } from "./endsWith";
|
|
|
16
16
|
|
|
17
17
|
export { take } from "./take";
|
|
18
18
|
|
|
19
|
+
export { mapAccum } from "./mapAccum";
|
|
20
|
+
|
|
19
21
|
export {
|
|
20
22
|
cloneDeep as clone,
|
|
21
23
|
flatten,
|
|
@@ -34,4 +36,9 @@ export {
|
|
|
34
36
|
last,
|
|
35
37
|
toLower,
|
|
36
38
|
isEqual as equals,
|
|
39
|
+
uniq,
|
|
40
|
+
uniqWith,
|
|
41
|
+
flowRight as compose,
|
|
42
|
+
partial,
|
|
43
|
+
reverse,
|
|
37
44
|
} from "lodash";
|