@applicaster/quick-brick-player 16.0.0-rc.61 → 16.0.0-rc.63
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/package.json +4 -4
- package/src/Player/AudioLayer/__tests__/playerActions.test.ts +0 -9
- package/src/Player/AudioLayer/playerActions.ts +0 -3
- package/src/Player/AudioLayer/components/SleepTimerModalHeader/SleepTimerModalHeader.tsx +0 -67
- package/src/Player/AudioLayer/components/SleepTimerModalHeader/__tests__/SleepTimerModalHeader.test.tsx +0 -53
- package/src/Player/AudioLayer/components/SleepTimerModalHeader/index.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-player",
|
|
3
|
-
"version": "16.0.0-rc.
|
|
3
|
+
"version": "16.0.0-rc.63",
|
|
4
4
|
"description": "Quick Brick Player",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@applicaster/quick-brick-mobile-transport-controls": "16.0.0-rc.60",
|
|
39
39
|
"@applicaster/quick-brick-tv-transport-controls": "16.0.0-rc.60",
|
|
40
|
-
"@applicaster/zapp-react-native-tvos-app": "16.0.0-rc.
|
|
41
|
-
"@applicaster/zapp-react-native-ui-components": "16.0.0-rc.
|
|
42
|
-
"@applicaster/zapp-react-native-utils": "16.0.0-rc.
|
|
40
|
+
"@applicaster/zapp-react-native-tvos-app": "16.0.0-rc.63",
|
|
41
|
+
"@applicaster/zapp-react-native-ui-components": "16.0.0-rc.63",
|
|
42
|
+
"@applicaster/zapp-react-native-utils": "16.0.0-rc.63",
|
|
43
43
|
"query-string": "7.1.3",
|
|
44
44
|
"shaka-player": "4.3.5",
|
|
45
45
|
"typeface-montserrat": "^0.0.54",
|
|
@@ -15,13 +15,6 @@ import {
|
|
|
15
15
|
} from "../playerActions";
|
|
16
16
|
import { SpeedController } from "../SpeedManager";
|
|
17
17
|
import { SleepTimerController } from "../SleepTimerManager";
|
|
18
|
-
import { SleepTimerModalHeader } from "../components/SleepTimerModalHeader";
|
|
19
|
-
|
|
20
|
-
jest.mock("../components/SleepTimerModalHeader", () => ({
|
|
21
|
-
SleepTimerModalHeader: function SleepTimerModalHeader() {
|
|
22
|
-
return null;
|
|
23
|
-
},
|
|
24
|
-
}));
|
|
25
18
|
|
|
26
19
|
jest.mock("../../Const/sleepTimerOptions", () => ({
|
|
27
20
|
getSleepTimerOptions: (offLabel: string, sleepTimerValue: number | null) => [
|
|
@@ -207,8 +200,6 @@ describe("playerActions", () => {
|
|
|
207
200
|
|
|
208
201
|
expect(sheet.options.replace).toBe(true);
|
|
209
202
|
expect(sheet.options.header.title).toBe("Sleep Timer");
|
|
210
|
-
expect(sheet.options.header.component).toBe(SleepTimerModalHeader);
|
|
211
|
-
expect(sheet.options.header.componentProps.timerDate).toBe(timerDate);
|
|
212
203
|
expect(sheet.options.header.subtitle).toBeUndefined();
|
|
213
204
|
expect(sheet.options.content.behavior.currentSelection).toEqual(["15"]);
|
|
214
205
|
|
|
@@ -14,7 +14,6 @@ import { getSleepTimerOptions } from "../Const/sleepTimerOptions";
|
|
|
14
14
|
import { formatSpeed } from "./utils";
|
|
15
15
|
import { SpeedController } from "./SpeedManager";
|
|
16
16
|
import { SleepTimerController, SleepTimerState } from "./SleepTimerManager";
|
|
17
|
-
import { SleepTimerModalHeader } from "./components/SleepTimerModalHeader";
|
|
18
17
|
|
|
19
18
|
export const PLAYER_ACTION_IDENTIFIERS = {
|
|
20
19
|
PLAYBACK_SPEED: "playback-speed",
|
|
@@ -137,8 +136,6 @@ export async function openSleepTimerAction(
|
|
|
137
136
|
replace: true,
|
|
138
137
|
header: {
|
|
139
138
|
title: config.playback_sleep_title || "Sleep Timer",
|
|
140
|
-
component: SleepTimerModalHeader,
|
|
141
|
-
componentProps: { timerDate: timerRemaining },
|
|
142
139
|
},
|
|
143
140
|
content: {
|
|
144
141
|
role: "collection_selector",
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ModalHeader } from "@applicaster/zapp-react-native-ui-components/Components/ModalComponent/Header";
|
|
3
|
-
|
|
4
|
-
type SleepTimerModalHeaderProps = React.ComponentProps<typeof ModalHeader> & {
|
|
5
|
-
timerDate?: number | null;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const formatTime = (milliseconds: number) => {
|
|
9
|
-
const totalSeconds = Math.floor(milliseconds / 1000);
|
|
10
|
-
const hours = Math.floor(totalSeconds / 3600);
|
|
11
|
-
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
12
|
-
const seconds = totalSeconds % 60;
|
|
13
|
-
|
|
14
|
-
if (milliseconds < 3600000) {
|
|
15
|
-
return `${minutes.toString().padStart(2, "0")}:${seconds
|
|
16
|
-
.toString()
|
|
17
|
-
.padStart(2, "0")}`;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return `${hours.toString().padStart(2, "0")}:${minutes
|
|
21
|
-
.toString()
|
|
22
|
-
.padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const SleepTimerModalHeader = ({
|
|
26
|
-
timerDate,
|
|
27
|
-
...props
|
|
28
|
-
}: SleepTimerModalHeaderProps) => {
|
|
29
|
-
const sleepTimerDate = timerDate || 0;
|
|
30
|
-
|
|
31
|
-
const [timeLeft, setTimeLeft] = React.useState(
|
|
32
|
-
sleepTimerDate !== 0 ? sleepTimerDate - Date.now() : 0
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const showCounter = React.useMemo(() => sleepTimerDate > 0, [sleepTimerDate]);
|
|
36
|
-
|
|
37
|
-
React.useLayoutEffect(() => {
|
|
38
|
-
if (showCounter && sleepTimerDate !== 0) {
|
|
39
|
-
setTimeLeft(sleepTimerDate - Date.now());
|
|
40
|
-
|
|
41
|
-
const intervalId = setInterval(() => {
|
|
42
|
-
setTimeLeft(() => {
|
|
43
|
-
const newTimeLeft = sleepTimerDate - Date.now();
|
|
44
|
-
|
|
45
|
-
if (newTimeLeft <= 0) {
|
|
46
|
-
clearInterval(intervalId);
|
|
47
|
-
|
|
48
|
-
return 0;
|
|
49
|
-
} else {
|
|
50
|
-
return newTimeLeft;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}, 1000);
|
|
54
|
-
|
|
55
|
-
return () => clearInterval(intervalId);
|
|
56
|
-
} else {
|
|
57
|
-
setTimeLeft(0);
|
|
58
|
-
}
|
|
59
|
-
}, [sleepTimerDate, showCounter]);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<ModalHeader
|
|
63
|
-
{...props}
|
|
64
|
-
summary={showCounter && timeLeft > 0 ? formatTime(timeLeft) : undefined}
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render } from "@testing-library/react-native";
|
|
3
|
-
import { ModalHeader } from "@applicaster/zapp-react-native-ui-components/Components/ModalComponent/Header";
|
|
4
|
-
import { SleepTimerModalHeader } from "../SleepTimerModalHeader";
|
|
5
|
-
|
|
6
|
-
jest.mock(
|
|
7
|
-
"@applicaster/zapp-react-native-ui-components/Components/ModalComponent/Header",
|
|
8
|
-
() => ({
|
|
9
|
-
ModalHeader: jest.fn(() => null),
|
|
10
|
-
})
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
describe("SleepTimerModalHeader", () => {
|
|
14
|
-
const headerProps = {
|
|
15
|
-
dismiss: jest.fn(),
|
|
16
|
-
configuration: {} as React.ComponentProps<
|
|
17
|
-
typeof ModalHeader
|
|
18
|
-
>["configuration"],
|
|
19
|
-
title: "Sleep Timer",
|
|
20
|
-
summary: undefined as string | undefined,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
beforeEach(() => {
|
|
24
|
-
jest.clearAllMocks();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("passes a MM:SS summary when timerDate is in the future", () => {
|
|
28
|
-
const timerDate = Date.now() + 90 * 1000;
|
|
29
|
-
|
|
30
|
-
render(<SleepTimerModalHeader timerDate={timerDate} {...headerProps} />);
|
|
31
|
-
|
|
32
|
-
expect(ModalHeader).toHaveBeenCalledWith(
|
|
33
|
-
expect.objectContaining({
|
|
34
|
-
title: "Sleep Timer",
|
|
35
|
-
summary: expect.stringMatching(/^\d{2}:\d{2}$/),
|
|
36
|
-
}),
|
|
37
|
-
expect.anything()
|
|
38
|
-
);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("does not show a 00:00 summary when timerDate is in the past", () => {
|
|
42
|
-
render(
|
|
43
|
-
<SleepTimerModalHeader timerDate={Date.now() - 1000} {...headerProps} />
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
expect(ModalHeader).toHaveBeenCalledWith(
|
|
47
|
-
expect.objectContaining({
|
|
48
|
-
summary: undefined,
|
|
49
|
-
}),
|
|
50
|
-
expect.anything()
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./SleepTimerModalHeader";
|