@applicaster/quick-brick-player 13.0.0-rc.97 → 13.0.0-rc.98

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-player",
3
- "version": "13.0.0-rc.97",
3
+ "version": "13.0.0-rc.98",
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": "13.0.0-rc.95",
39
39
  "@applicaster/quick-brick-tv-transport-controls": "13.0.0-rc.56",
40
- "@applicaster/zapp-react-native-tvos-app": "13.0.0-rc.97",
41
- "@applicaster/zapp-react-native-ui-components": "13.0.0-rc.97",
42
- "@applicaster/zapp-react-native-utils": "13.0.0-rc.97",
40
+ "@applicaster/zapp-react-native-tvos-app": "13.0.0-rc.98",
41
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-rc.98",
42
+ "@applicaster/zapp-react-native-utils": "13.0.0-rc.98",
43
43
  "query-string": "7.1.3",
44
44
  "react-native-web-linear-gradient": "1.1.2",
45
45
  "shaka-player": "4.3.5",
@@ -48,7 +48,7 @@ import { SpeedController, PlaybackSpeed, DEFAULT_SPEED } from "./SpeedManager";
48
48
  import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
49
49
  import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
50
50
  import { openBottomSheetModal } from "@applicaster/zapp-react-native-utils/modalState";
51
- import { sleepTimerOptions } from "../Const/sleepTimerOptions";
51
+ import { getSleepTimerOptions } from "../Const/sleepTimerOptions";
52
52
  import { speedOptions } from "../Const/speedOptions";
53
53
 
54
54
  const { log_debug } = createLogger({
@@ -278,12 +278,7 @@ export const AudioPlayerWrapper: React.FC<Props> = (props: Props) => {
278
278
  const onSleepButtonPress = React.useCallback(() => {
279
279
  openBottomSheetModal({
280
280
  modalBottomSheetContentProps: {
281
- items: [
282
- {
283
- label: configuration["playback_sleep_off_label"],
284
- value: 0,
285
- },
286
- ].concat(sleepTimerOptions),
281
+ items: getSleepTimerOptions(configuration),
287
282
  current_selection: sleepTimerState.timer,
288
283
  onPress: onSleepSelect,
289
284
  title: configuration["playback_sleep_title"],
@@ -1,10 +1,39 @@
1
- export const sleepTimerOptions = [
2
- // { label: "End of episode", value: "episode" },
3
- { label: "5 minutes", value: 5 },
4
- { label: "10 minutes", value: 10 },
5
- { label: "15 minutes", value: 15 },
6
- { label: "30 minutes", value: 30 },
7
- { label: "45 minutes", value: 45 },
8
- { label: "1 hour", value: 60 },
9
- { label: "2 hours", value: 120 },
10
- ];
1
+ import { toDayJSLocaleMap } from "@applicaster/zapp-react-native-utils/appUtils/localizationsHelper";
2
+ import { dayjs } from "@applicaster/zapp-react-native-utils/dateUtils";
3
+ import { getUILanguage } from "@applicaster/zapp-react-native-utils/localizationUtils";
4
+
5
+ const createTimerOptions = (value) => {
6
+ let label = "";
7
+
8
+ const str = dayjs
9
+ .duration(value, "minute")
10
+ .locale(toDayJSLocaleMap(getUILanguage()))
11
+ .humanize();
12
+
13
+ if (value === 60) {
14
+ /** Skipping prefix "an"/"un"/"una" for 1 hour */
15
+
16
+ if (str.includes(" ")) {
17
+ label = `1 ${str.split(" ")[1]}`; // Combine "1" with second part of the string
18
+ } else {
19
+ label = `1 ${str}`; // Use dayjs provided translation
20
+ }
21
+ } else {
22
+ label = str;
23
+ }
24
+
25
+ return {
26
+ label,
27
+ value,
28
+ };
29
+ };
30
+
31
+ export const getSleepTimerOptions = (configuration) => {
32
+ return [
33
+ {
34
+ label: configuration["playback_sleep_off_label"],
35
+ value: 0,
36
+ },
37
+ ...[5, 10, 15, 30, 45, 60, 120].map(createTimerOptions),
38
+ ];
39
+ };