@applicaster/zapp-react-native-ui-components 14.0.0-alpha.3038031102 → 14.0.0-alpha.3140225604
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/Components/Cell/Cell.tsx +8 -3
- package/Components/Cell/index.js +1 -1
- package/Components/ComponentResolver/index.ts +1 -1
- package/Components/FeedLoader/index.js +1 -1
- package/Components/Focusable/Focusable.tsx +5 -3
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +59 -42
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +8 -12
- package/Components/Layout/TV/LayoutBackground.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/Button.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -27
- package/Components/OfflineHandler/__tests__/index.test.tsx +22 -20
- package/Components/PlayerContainer/ErrorDisplay/index.ts +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +15 -6
- package/Components/PlayerContainer/ProgramInfo/index.tsx +1 -1
- package/Components/PlayerContainer/index.ts +1 -1
- package/Components/River/RefreshControl.tsx +4 -6
- package/Components/River/index.tsx +1 -1
- package/Components/Screen/__tests__/Screen.test.tsx +12 -23
- package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +13 -0
- package/Components/TextInputTv/index.tsx +11 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +9 -1
- package/Components/VideoModal/PlayerDetails.tsx +24 -2
- package/Components/VideoModal/PlayerWrapper.tsx +26 -142
- package/Components/VideoModal/VideoModal.tsx +3 -17
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -240
- package/Components/VideoModal/hooks/index.ts +0 -2
- package/Components/VideoModal/hooks/useModalSize.ts +18 -2
- package/Components/VideoModal/utils.ts +6 -0
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +6 -3
- package/package.json +5 -8
- package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
package/Components/Cell/Cell.tsx
CHANGED
|
@@ -70,6 +70,8 @@ type State = {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
export class CellComponent extends React.Component<Props, State> {
|
|
73
|
+
accessibilityManager: AccessibilityManager;
|
|
74
|
+
|
|
73
75
|
constructor(props) {
|
|
74
76
|
super(props);
|
|
75
77
|
this.onPress = this.onPress.bind(this);
|
|
@@ -83,6 +85,8 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
83
85
|
this.state = {
|
|
84
86
|
hasFocusableInside: props.CellRenderer.hasFocusableInside?.(props.item),
|
|
85
87
|
};
|
|
88
|
+
|
|
89
|
+
this.accessibilityManager = AccessibilityManager.getInstance();
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
setScreenLayout(componentAnchorPointY, screenLayout) {
|
|
@@ -257,20 +261,21 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
257
261
|
style={styles.baseCell}
|
|
258
262
|
isFocusable={isFocusable}
|
|
259
263
|
skipFocusManagerRegistration={skipFocusManagerRegistration}
|
|
264
|
+
{...this.accessibilityManager.getButtonAccessibilityProps(
|
|
265
|
+
item?.extensions?.accessibility?.label || item?.title
|
|
266
|
+
)}
|
|
260
267
|
>
|
|
261
268
|
{(focused, event) => {
|
|
262
269
|
const isFocused = this.isCellFocused(focused);
|
|
263
270
|
|
|
264
271
|
if (isFocused) {
|
|
265
|
-
const accessibilityManager = AccessibilityManager.getInstance();
|
|
266
|
-
|
|
267
272
|
const accessibilityTitle =
|
|
268
273
|
item?.extensions?.accessibility?.label || item?.title || "";
|
|
269
274
|
|
|
270
275
|
const accessibilityHint =
|
|
271
276
|
item?.extensions?.accessibility?.hint || "";
|
|
272
277
|
|
|
273
|
-
accessibilityManager.readText({
|
|
278
|
+
this.accessibilityManager.readText({
|
|
274
279
|
text: `${accessibilityTitle} ${accessibilityHint}`,
|
|
275
280
|
});
|
|
276
281
|
}
|
package/Components/Cell/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
|
|
3
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux
|
|
3
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
4
4
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
5
|
|
|
6
6
|
import {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
|
|
3
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux
|
|
3
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
4
4
|
|
|
5
5
|
import { ComponentResolverComponent } from "./ComponentResolver";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
|
|
3
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux
|
|
3
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
4
4
|
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
5
5
|
|
|
6
6
|
import { FeedLoaderComponent } from "./FeedLoader";
|
|
@@ -5,6 +5,7 @@ import { BaseFocusable } from "../BaseFocusable";
|
|
|
5
5
|
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
|
|
6
6
|
import { LONG_KEY_PRESS_TIMEOUT } from "@applicaster/quick-brick-core/const";
|
|
7
7
|
import { withFocusableContext } from "../../Contexts/FocusableGroupContext/withFocusableContext";
|
|
8
|
+
import { StyleSheet, ViewStyle } from "react-native";
|
|
8
9
|
|
|
9
10
|
type Props = {
|
|
10
11
|
initialFocus?: boolean;
|
|
@@ -21,7 +22,7 @@ type Props = {
|
|
|
21
22
|
handleFocus?: ({ mouse }: { mouse: boolean }) => void;
|
|
22
23
|
children: (boolean, string) => React.ComponentType<any>;
|
|
23
24
|
selected?: boolean;
|
|
24
|
-
style?:
|
|
25
|
+
style?: ViewStyle[] | ViewStyle;
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
class Focusable extends BaseFocusable<Props> {
|
|
@@ -122,7 +123,7 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
render() {
|
|
125
|
-
const { children, style } = this.props;
|
|
126
|
+
const { children, style, ...otherProps } = this.props;
|
|
126
127
|
const { focused } = this.state;
|
|
127
128
|
|
|
128
129
|
const id = this.getId();
|
|
@@ -139,7 +140,8 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
139
140
|
onMouseUp={this.pressOut}
|
|
140
141
|
data-testid={focusableId}
|
|
141
142
|
focused-teststate={focused ? "focused" : "default"}
|
|
142
|
-
style={style}
|
|
143
|
+
style={StyleSheet.flatten(style) as any as React.CSSProperties}
|
|
144
|
+
{...otherProps}
|
|
143
145
|
>
|
|
144
146
|
{children(focused, { mouse: this.mouse })}
|
|
145
147
|
</div>
|
|
@@ -8,10 +8,13 @@ import {
|
|
|
8
8
|
useCurationAPI,
|
|
9
9
|
} from "../useCurationAPI";
|
|
10
10
|
import * as redux from "react-redux";
|
|
11
|
+
import * as layoutPresets from "@applicaster/zapp-react-native-redux/hooks/useLayoutPresets";
|
|
12
|
+
import * as pipesFeeds from "@applicaster/zapp-react-native-redux/hooks/useZappPipesFeeds";
|
|
11
13
|
import { NavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/NavigationContext";
|
|
12
14
|
import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
|
|
13
15
|
|
|
14
|
-
import {
|
|
16
|
+
import { Provider } from "react-redux";
|
|
17
|
+
import configureStore from "redux-mock-store";
|
|
15
18
|
|
|
16
19
|
jest.mock(
|
|
17
20
|
"@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute",
|
|
@@ -39,20 +42,19 @@ const mainStackNavigator = {
|
|
|
39
42
|
},
|
|
40
43
|
};
|
|
41
44
|
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
);
|
|
45
|
+
const store = configureStore()({});
|
|
46
|
+
|
|
47
|
+
const wrapper = ({ children }) => (
|
|
48
|
+
<Provider store={store}>
|
|
49
|
+
<NavigationContext.Provider
|
|
50
|
+
value={{ ...mainStackNavigator, currentRoute: homeStack.route }}
|
|
51
|
+
>
|
|
52
|
+
<PathnameContext.Provider value={homeStack.route}>
|
|
53
|
+
{children}
|
|
54
|
+
</PathnameContext.Provider>
|
|
55
|
+
</NavigationContext.Provider>
|
|
56
|
+
</Provider>
|
|
57
|
+
);
|
|
56
58
|
|
|
57
59
|
describe("getTransformedPreset should return the passed components if smartComponents is empty", () => {
|
|
58
60
|
describe("getTransformedPreset function", () => {
|
|
@@ -310,10 +312,19 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
310
312
|
{ id: "02", component_type: "not_smart_another" },
|
|
311
313
|
];
|
|
312
314
|
|
|
315
|
+
// mock the hooks
|
|
316
|
+
const mockUseZappPipesFeeds = jest.spyOn(pipesFeeds, "useZappPipesFeeds");
|
|
317
|
+
mockUseZappPipesFeeds.mockReturnValue({});
|
|
318
|
+
|
|
319
|
+
const mockUseLayoutPresets = jest.spyOn(
|
|
320
|
+
layoutPresets,
|
|
321
|
+
"useLayoutPresets"
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
mockUseLayoutPresets.mockReturnValue({});
|
|
325
|
+
|
|
313
326
|
const { result } = renderHook(() => useCurationAPI(mockComponents), {
|
|
314
|
-
wrapper
|
|
315
|
-
zappPipes: {},
|
|
316
|
-
}),
|
|
327
|
+
wrapper,
|
|
317
328
|
});
|
|
318
329
|
|
|
319
330
|
// if there are no smart components, it should return the original array
|
|
@@ -355,15 +366,18 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
355
366
|
"http://curation": { loading: false, data: { entry: mockPresetEntry } },
|
|
356
367
|
};
|
|
357
368
|
|
|
369
|
+
const mockUseZappPipesFeeds = jest.spyOn(pipesFeeds, "useZappPipesFeeds");
|
|
370
|
+
mockUseZappPipesFeeds.mockReturnValue(mockFeeds);
|
|
371
|
+
|
|
372
|
+
const mockUseLayoutPresets = jest.spyOn(
|
|
373
|
+
layoutPresets,
|
|
374
|
+
"useLayoutPresets"
|
|
375
|
+
);
|
|
376
|
+
|
|
377
|
+
mockUseLayoutPresets.mockReturnValue(mockLayoutPresets);
|
|
378
|
+
|
|
358
379
|
const { result } = renderHook(() => useCurationAPI(mockComponents), {
|
|
359
|
-
wrapper
|
|
360
|
-
zappPipes: mockFeeds,
|
|
361
|
-
presetsMapping: {
|
|
362
|
-
presets_mappings: {
|
|
363
|
-
...mockLayoutPresets,
|
|
364
|
-
},
|
|
365
|
-
},
|
|
366
|
-
}),
|
|
380
|
+
wrapper,
|
|
367
381
|
});
|
|
368
382
|
|
|
369
383
|
expect(result.current).toEqual(mockTransformedComponents);
|
|
@@ -423,15 +437,19 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
423
437
|
},
|
|
424
438
|
};
|
|
425
439
|
|
|
440
|
+
// mock the hooks
|
|
441
|
+
const mockUseZappPipesFeeds = jest.spyOn(pipesFeeds, "useZappPipesFeeds");
|
|
442
|
+
mockUseZappPipesFeeds.mockReturnValue(mockFeeds);
|
|
443
|
+
|
|
444
|
+
const mockUseLayoutPresets = jest.spyOn(
|
|
445
|
+
layoutPresets,
|
|
446
|
+
"useLayoutPresets"
|
|
447
|
+
);
|
|
448
|
+
|
|
449
|
+
mockUseLayoutPresets.mockReturnValue(mockLayoutPresets);
|
|
450
|
+
|
|
426
451
|
const { result } = renderHook(() => useCurationAPI(mockComponents), {
|
|
427
|
-
wrapper
|
|
428
|
-
zappPipes: mockFeeds,
|
|
429
|
-
presetsMapping: {
|
|
430
|
-
presets_mappings: {
|
|
431
|
-
...mockLayoutPresets,
|
|
432
|
-
},
|
|
433
|
-
},
|
|
434
|
-
}),
|
|
452
|
+
wrapper,
|
|
435
453
|
});
|
|
436
454
|
|
|
437
455
|
expect(result.current).toEqual(mockTransformedComponents);
|
|
@@ -477,15 +495,14 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
477
495
|
"http://curation": { loading: false, data: { entry: mockPresetEntry } },
|
|
478
496
|
};
|
|
479
497
|
|
|
498
|
+
// mock the hooks
|
|
499
|
+
const mockUseZappPipesFeeds = jest.spyOn(pipesFeeds, "useZappPipesFeeds");
|
|
500
|
+
mockUseZappPipesFeeds.mockReturnValue(mockFeeds);
|
|
501
|
+
const mockUseLayoutPresets = jest.spyOn(layoutPresets, "useLayoutPresets");
|
|
502
|
+
mockUseLayoutPresets.mockReturnValue(mockLayoutPresets);
|
|
503
|
+
|
|
480
504
|
const { result } = renderHook(() => useCurationAPI(mockComponents), {
|
|
481
|
-
wrapper
|
|
482
|
-
zappPipes: mockFeeds,
|
|
483
|
-
presetsMapping: {
|
|
484
|
-
presets_mappings: {
|
|
485
|
-
...mockLayoutPresets,
|
|
486
|
-
},
|
|
487
|
-
},
|
|
488
|
-
}),
|
|
505
|
+
wrapper,
|
|
489
506
|
});
|
|
490
507
|
|
|
491
508
|
expect(result.current).toEqual(mockTransformedComponents);
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { all, equals, path, prop, isEmpty, pluck, values } from "ramda";
|
|
2
2
|
|
|
3
3
|
import { useEffect, useMemo } from "react";
|
|
4
|
+
import { useDispatch } from "react-redux";
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
|
-
ZappPipes,
|
|
7
|
-
useAppDispatch,
|
|
8
7
|
useLayoutPresets,
|
|
9
|
-
|
|
10
|
-
} from "@applicaster/zapp-react-native-redux";
|
|
8
|
+
useZappPipesFeeds,
|
|
9
|
+
} from "@applicaster/zapp-react-native-redux/hooks";
|
|
10
|
+
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
11
11
|
import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
12
12
|
import { Categories } from "./logger";
|
|
13
13
|
import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
14
14
|
import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute";
|
|
15
|
-
|
|
16
15
|
import {
|
|
17
16
|
ZappPipesEntryContext,
|
|
18
17
|
ZappPipesScreenContext,
|
|
@@ -27,10 +26,7 @@ import {
|
|
|
27
26
|
import { produce } from "immer";
|
|
28
27
|
// types reference
|
|
29
28
|
|
|
30
|
-
declare
|
|
31
|
-
preset_name: string;
|
|
32
|
-
feed_url: string;
|
|
33
|
-
}
|
|
29
|
+
declare type CurationEntry = { preset_name: string; feed_url: string };
|
|
34
30
|
|
|
35
31
|
type Feeds = Record<string, ZappPipesData>;
|
|
36
32
|
|
|
@@ -126,7 +122,7 @@ export const getFinalComponents = (
|
|
|
126
122
|
export const useCurationAPI = (
|
|
127
123
|
components: Array<ZappUIComponent>
|
|
128
124
|
): ZappUIComponent[] => {
|
|
129
|
-
const dispatch =
|
|
125
|
+
const dispatch = useDispatch();
|
|
130
126
|
|
|
131
127
|
const smartComponents = useMemo(
|
|
132
128
|
() => components?.filter?.(isSmartComponent) ?? [],
|
|
@@ -166,7 +162,7 @@ export const useCurationAPI = (
|
|
|
166
162
|
useEffect(() => {
|
|
167
163
|
urls.forEach((url, index) => {
|
|
168
164
|
if (url) {
|
|
169
|
-
dispatch(
|
|
165
|
+
dispatch(loadPipesData(url, { clearCache: false }));
|
|
170
166
|
} else {
|
|
171
167
|
logger.log_error("Curation url is empty", {
|
|
172
168
|
componentId: smartComponents?.[index]?.id,
|
|
@@ -175,7 +171,7 @@ export const useCurationAPI = (
|
|
|
175
171
|
});
|
|
176
172
|
}, [urls]);
|
|
177
173
|
|
|
178
|
-
const feeds =
|
|
174
|
+
const feeds = useZappPipesFeeds(urls);
|
|
179
175
|
const layoutPresets = useLayoutPresets();
|
|
180
176
|
|
|
181
177
|
const enrichedComponents = useMemo(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
2
|
+
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks/usePickFromState";
|
|
3
3
|
import { getBackgroundImageUrl } from "../utils";
|
|
4
4
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
5
5
|
|
|
@@ -4,7 +4,7 @@ import * as R from "ramda";
|
|
|
4
4
|
import { TouchableOpacity } from "react-native";
|
|
5
5
|
// import { SvgUri } from "react-native-svg";
|
|
6
6
|
|
|
7
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux
|
|
7
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
8
8
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
9
9
|
|
|
10
10
|
import Image from "./Image";
|
|
@@ -2,7 +2,6 @@ import React, { useMemo } from "react";
|
|
|
2
2
|
import { ImageStyle } from "react-native";
|
|
3
3
|
import { Focusable } from "@applicaster/zapp-react-native-ui-components/Components/Focusable";
|
|
4
4
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
5
|
-
import * as R from "ramda";
|
|
6
5
|
import { getXray } from "@applicaster/zapp-react-native-utils/logger";
|
|
7
6
|
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
8
7
|
import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
@@ -67,32 +66,10 @@ export function FocusableView({ style, children, item, ...otherProps }: Props) {
|
|
|
67
66
|
const handleFocus = (focusable) => {
|
|
68
67
|
const focusedButtonId = getFocusedButtonId(focusable);
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const right = left + width;
|
|
75
|
-
|
|
76
|
-
const boundingRect = {
|
|
77
|
-
x,
|
|
78
|
-
y,
|
|
79
|
-
pageX,
|
|
80
|
-
pageY,
|
|
81
|
-
width,
|
|
82
|
-
height,
|
|
83
|
-
top,
|
|
84
|
-
bottom,
|
|
85
|
-
left,
|
|
86
|
-
right,
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
otherProps?.onToggleFocus?.({
|
|
90
|
-
focusable: {
|
|
91
|
-
getRect: R.always(boundingRect),
|
|
92
|
-
},
|
|
93
|
-
focusedButtonId,
|
|
94
|
-
mouse: focusable.mouse,
|
|
95
|
-
});
|
|
69
|
+
otherProps?.onToggleFocus?.({
|
|
70
|
+
focusable: wrapperRef.current,
|
|
71
|
+
focusedButtonId,
|
|
72
|
+
mouse: focusable.mouse,
|
|
96
73
|
});
|
|
97
74
|
|
|
98
75
|
if (ttsLabel) {
|
|
@@ -19,27 +19,29 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/utils", () => {
|
|
|
19
19
|
};
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
jest.mock(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
jest.mock(
|
|
23
|
+
"@applicaster/zapp-react-native-redux/hooks/usePickFromState",
|
|
24
|
+
() => ({
|
|
25
|
+
usePickFromState: () => ({
|
|
26
|
+
plugins: [
|
|
27
|
+
{
|
|
28
|
+
name: "offline experience",
|
|
29
|
+
identifier: "offline-experience",
|
|
30
|
+
type: "general",
|
|
31
|
+
module: {
|
|
32
|
+
useOfflineExperienceConfiguration: () => ({
|
|
33
|
+
configurationFields: {},
|
|
34
|
+
localizations: {
|
|
35
|
+
offline_toast_message: "No internet connection",
|
|
36
|
+
online_toast_message: "You are back online",
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
38
40
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
42
|
-
|
|
41
|
+
],
|
|
42
|
+
}),
|
|
43
|
+
})
|
|
44
|
+
);
|
|
43
45
|
|
|
44
46
|
jest.mock("react-native-safe-area-context", () => ({
|
|
45
47
|
useSafeAreaInsets: () => ({ top: 44 }),
|
|
@@ -88,7 +88,7 @@ export const VideoModalMode = {
|
|
|
88
88
|
MAXIMIZED: "MAXIMIZED",
|
|
89
89
|
MINIMIZED: "MINIMIZED",
|
|
90
90
|
FULLSCREEN: "FULLSCREEN",
|
|
91
|
-
};
|
|
91
|
+
} as const;
|
|
92
92
|
|
|
93
93
|
export type PlayNextData = {
|
|
94
94
|
state: PlayNextState;
|
|
@@ -127,7 +127,7 @@ const webStyles = {
|
|
|
127
127
|
playerScreen: {
|
|
128
128
|
flex: 1,
|
|
129
129
|
height: "100vh",
|
|
130
|
-
|
|
130
|
+
backgroundColor: "black",
|
|
131
131
|
},
|
|
132
132
|
playerWrapper: {
|
|
133
133
|
height: "100%",
|
|
@@ -145,7 +145,6 @@ const nativeStyles = {
|
|
|
145
145
|
},
|
|
146
146
|
playerScreen: {
|
|
147
147
|
flex: 1,
|
|
148
|
-
backgroundColor: "black",
|
|
149
148
|
overflow: "hidden",
|
|
150
149
|
},
|
|
151
150
|
playerWrapper: {
|
|
@@ -565,8 +564,9 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
565
564
|
const isInlineTV = isInlineTVUtil(screenData);
|
|
566
565
|
|
|
567
566
|
const inline =
|
|
568
|
-
[VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(
|
|
569
|
-
|
|
567
|
+
[VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(
|
|
568
|
+
mode as any
|
|
569
|
+
) || isInlineTV;
|
|
570
570
|
|
|
571
571
|
const value = React.useMemo(
|
|
572
572
|
() => ({ playerId: state.playerId }),
|
|
@@ -587,7 +587,11 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
587
587
|
);
|
|
588
588
|
}
|
|
589
589
|
|
|
590
|
-
if (
|
|
590
|
+
if (
|
|
591
|
+
screen_background_color &&
|
|
592
|
+
mode !== VideoModalMode.FULLSCREEN &&
|
|
593
|
+
isTV()
|
|
594
|
+
) {
|
|
591
595
|
updatedStyles.playerScreen.backgroundColor = screen_background_color;
|
|
592
596
|
}
|
|
593
597
|
|
|
@@ -617,6 +621,8 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
617
621
|
playNextData,
|
|
618
622
|
};
|
|
619
623
|
|
|
624
|
+
const pointerEventsProp = mode === "MINIMIZED" ? "box-none" : "auto";
|
|
625
|
+
|
|
620
626
|
return (
|
|
621
627
|
<PlayerStateContext.Provider value={value}>
|
|
622
628
|
<PlayerContainerContextProvider
|
|
@@ -637,14 +643,17 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
637
643
|
preferredFocus
|
|
638
644
|
shouldUsePreferredFocus
|
|
639
645
|
groupId={groupId}
|
|
646
|
+
pointerEvents={pointerEventsProp}
|
|
640
647
|
>
|
|
641
648
|
{/* Video player and components */}
|
|
642
649
|
<View
|
|
643
650
|
style={styles.playerScreen}
|
|
644
651
|
testID={"player-screen-container"}
|
|
652
|
+
pointerEvents={pointerEventsProp}
|
|
645
653
|
>
|
|
646
654
|
{/* Player container */}
|
|
647
655
|
<View
|
|
656
|
+
pointerEvents={pointerEventsProp}
|
|
648
657
|
style={[
|
|
649
658
|
styles.playerWrapper,
|
|
650
659
|
// eslint-disable-next-line react-native/no-inline-styles, react-native/no-color-literals
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux
|
|
1
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
2
2
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
3
3
|
import { styleKeys } from "@applicaster/zapp-react-native-utils/styleKeysUtils";
|
|
4
4
|
import { transformColorCode as fixColorHexCode } from "@applicaster/zapp-react-native-utils/transform";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
|
|
3
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux
|
|
3
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
4
4
|
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
5
5
|
|
|
6
6
|
import { PlayerContainer as PlayerContainerComponent } from "./PlayerContainer";
|
|
@@ -10,13 +10,11 @@ import { useLocalizedStrings } from "@applicaster/zapp-react-native-utils/locali
|
|
|
10
10
|
import { useAnalytics } from "@applicaster/zapp-react-native-utils/analyticsUtils";
|
|
11
11
|
import { useSendAnalyticsEventWithFunction } from "@applicaster/zapp-react-native-utils/analyticsUtils/helpers/hooks";
|
|
12
12
|
import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useCurrentScreenData";
|
|
13
|
+
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
14
|
+
import { useDispatch } from "react-redux";
|
|
13
15
|
import { useShallow } from "zustand/react/shallow";
|
|
14
16
|
import { useScreenContextV2 } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
15
17
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
16
|
-
import {
|
|
17
|
-
ZappPipes,
|
|
18
|
-
useAppDispatch,
|
|
19
|
-
} from "@applicaster/zapp-react-native-redux";
|
|
20
18
|
|
|
21
19
|
const BRIGHTNESS_THRESHOLD = 160;
|
|
22
20
|
const ABOVE_DEFAULT_COLOR = "gray";
|
|
@@ -63,7 +61,7 @@ export const usePullToRefresh = (
|
|
|
63
61
|
) => {
|
|
64
62
|
const isPipesV1 = !!pullToRefreshPipesV1RefreshingStateUpdater;
|
|
65
63
|
|
|
66
|
-
const dispatch =
|
|
64
|
+
const dispatch = useDispatch();
|
|
67
65
|
|
|
68
66
|
const [refreshing, setRefreshing] = React.useState(false);
|
|
69
67
|
|
|
@@ -83,7 +81,7 @@ export const usePullToRefresh = (
|
|
|
83
81
|
if (refreshing && !isPipesV1) {
|
|
84
82
|
feeds.forEach((feed) => {
|
|
85
83
|
dispatch(
|
|
86
|
-
|
|
84
|
+
loadPipesData(feed, {
|
|
87
85
|
silentRefresh: true,
|
|
88
86
|
clearCache: true,
|
|
89
87
|
callback: () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux
|
|
2
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
3
3
|
|
|
4
4
|
import { withRiver } from "../../Decorators/RiverResolver";
|
|
5
5
|
import { withNavigator } from "../../Decorators/Navigator";
|
|
@@ -68,33 +68,12 @@ jest.mock(
|
|
|
68
68
|
})
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
-
jest.mock(
|
|
72
|
-
"@applicaster/zapp-react-native-utils/reactHooks/state/useRivers",
|
|
73
|
-
() => ({
|
|
74
|
-
useRivers: jest.fn(() => ({
|
|
75
|
-
rivers: [{ id: "testId", name: "Test River" }],
|
|
76
|
-
})),
|
|
77
|
-
})
|
|
78
|
-
);
|
|
79
|
-
|
|
80
71
|
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
|
|
81
72
|
isNavBarVisible: mockIsNavBarVisible,
|
|
82
73
|
useIsScreenActive: jest.fn().mockReturnValue(true),
|
|
83
|
-
useNavigation: jest.fn(() => ({
|
|
84
|
-
canGoBack: () => false,
|
|
85
|
-
currentRoute: "/river/testId",
|
|
86
|
-
activeRiver: { id: "testId" },
|
|
87
|
-
screenData: { id: "testId" },
|
|
88
|
-
data: { screen: { id: "testId" } },
|
|
89
|
-
})),
|
|
90
|
-
useRoute: jest.fn(() => ({
|
|
91
|
-
pathname: "/river/testId",
|
|
92
|
-
screenData: { id: "testId" },
|
|
93
|
-
})),
|
|
94
74
|
}));
|
|
95
75
|
|
|
96
76
|
jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
|
|
97
|
-
...jest.requireActual("@applicaster/zapp-react-native-utils/reactHooks"),
|
|
98
77
|
useCurrentScreenData: jest.fn(() => ({
|
|
99
78
|
id: "testId",
|
|
100
79
|
})),
|
|
@@ -105,6 +84,17 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
|
|
|
105
84
|
id: "testId",
|
|
106
85
|
navigations: [{ id: "testId", category: "nav_bar" }],
|
|
107
86
|
})),
|
|
87
|
+
useNavigation: jest.fn(() => ({
|
|
88
|
+
canGoBack: () => false,
|
|
89
|
+
currentRoute: "/river/testId",
|
|
90
|
+
activeRiver: { id: "testId" },
|
|
91
|
+
screenData: { id: "testId" },
|
|
92
|
+
data: { screen: { id: "testId" } },
|
|
93
|
+
})),
|
|
94
|
+
useRoute: jest.fn(() => ({
|
|
95
|
+
pathname: "/river/testId",
|
|
96
|
+
screenData: { id: "testId" },
|
|
97
|
+
})),
|
|
108
98
|
useDimensions: jest.fn(() => ({
|
|
109
99
|
width: 1920,
|
|
110
100
|
height: 1080,
|
|
@@ -112,11 +102,10 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
|
|
|
112
102
|
useIsTablet: jest.fn(() => false),
|
|
113
103
|
}));
|
|
114
104
|
|
|
115
|
-
jest.mock("@applicaster/zapp-react-native-redux/hooks", () => {
|
|
105
|
+
jest.mock("@applicaster/zapp-react-native-redux/hooks/usePickFromState", () => {
|
|
116
106
|
const View = jest.requireActual("react-native").View;
|
|
117
107
|
|
|
118
108
|
return {
|
|
119
|
-
...jest.requireActual("@applicaster/zapp-react-native-redux/hooks"),
|
|
120
109
|
usePickFromState: () => ({
|
|
121
110
|
plugins: [
|
|
122
111
|
{
|
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`<TextInputTv /> renders 1`] = `
|
|
4
4
|
<input
|
|
5
|
+
accessibilityProps={
|
|
6
|
+
{
|
|
7
|
+
"accessibilityHint": "Enter text into Search",
|
|
8
|
+
"accessibilityLabel": "Search",
|
|
9
|
+
"accessibilityRole": "textbox",
|
|
10
|
+
"accessible": true,
|
|
11
|
+
"aria-description": "Enter text into Search",
|
|
12
|
+
"aria-label": "Search",
|
|
13
|
+
"aria-role": "textbox",
|
|
14
|
+
"role": "textbox",
|
|
15
|
+
"tabindex": 0,
|
|
16
|
+
}
|
|
17
|
+
}
|
|
5
18
|
testID="TextInput-tv"
|
|
6
19
|
/>
|
|
7
20
|
`;
|