@ledvance/group-ui-biz-bundle 1.0.37 → 1.0.39

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.
Files changed (124) hide show
  1. package/package.json +1 -1
  2. package/src/modules/biorhythm/BiorhythmActions.ts +216 -0
  3. package/src/modules/biorhythm/BiorhythmBean.ts +230 -0
  4. package/src/modules/biorhythm/BiorhythmDetailPage.tsx +261 -0
  5. package/src/modules/biorhythm/BiorhythmPage.tsx +706 -0
  6. package/src/modules/biorhythm/IconSelect.tsx +84 -0
  7. package/src/modules/biorhythm/circular/ItemIcon.d.ts +22 -0
  8. package/src/modules/biorhythm/circular/ItemIcon.tsx +173 -0
  9. package/src/modules/biorhythm/circular/Progress.d.ts +24 -0
  10. package/src/modules/biorhythm/circular/Progress.tsx +412 -0
  11. package/src/modules/biorhythm/circular/TimeCircular.d.ts +11 -0
  12. package/src/modules/biorhythm/circular/TimeCircular.tsx +70 -0
  13. package/src/modules/biorhythm/circular/biorhythm_plantimer.png +0 -0
  14. package/src/modules/biorhythm/circular/rhythm_icon.png +0 -0
  15. package/src/modules/biorhythm/iconListData.ts +30 -0
  16. package/src/modules/biorhythm/pIdList.ts +36 -0
  17. package/src/modules/biorhythm/res/BiologicalRes.d.ts +43 -0
  18. package/src/modules/biorhythm/res/BiologicalRes.ts +42 -0
  19. package/src/modules/biorhythm/res/Biological_Rhythm.png +0 -0
  20. package/src/modules/biorhythm/res/Biological_Rhythm_12.png +0 -0
  21. package/src/modules/biorhythm/res/Biological_Rhythm_new.png +0 -0
  22. package/src/modules/biorhythm/res/Biological_Rhythm_new_12.png +0 -0
  23. package/src/modules/biorhythm/res/iconsMaterialOutlinedAccountGroups.png +0 -0
  24. package/src/modules/biorhythm/res/iconsMaterialOutlinedAccountGroups@2x.png +0 -0
  25. package/src/modules/biorhythm/res/iconsMaterialOutlinedAccountGroups@3x.png +0 -0
  26. package/src/modules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd.png +0 -0
  27. package/src/modules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd@2x.png +0 -0
  28. package/src/modules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd@3x.png +0 -0
  29. package/src/modules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos.png +0 -0
  30. package/src/modules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@2x.png +0 -0
  31. package/src/modules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@3x.png +0 -0
  32. package/src/modules/biorhythm/res/iconsMaterialOutlinedBuildingsHome.png +0 -0
  33. package/src/modules/biorhythm/res/iconsMaterialOutlinedBuildingsHome@2x.png +0 -0
  34. package/src/modules/biorhythm/res/iconsMaterialOutlinedBuildingsHome@3x.png +0 -0
  35. package/src/modules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder.png +0 -0
  36. package/src/modules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder@2x.png +0 -0
  37. package/src/modules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder@3x.png +0 -0
  38. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherBed.png +0 -0
  39. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherBed@2x.png +0 -0
  40. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherBed@3x.png +0 -0
  41. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter.png +0 -0
  42. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter@2x.png +0 -0
  43. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter@3x.png +0 -0
  44. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherChair.png +0 -0
  45. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherChair@2x.png +0 -0
  46. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherChair@3x.png +0 -0
  47. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherCoffee.png +0 -0
  48. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherCoffee@2x.png +0 -0
  49. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherCoffee@3x.png +0 -0
  50. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar.png +0 -0
  51. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar@2x.png +0 -0
  52. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar@3x.png +0 -0
  53. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter.png +0 -0
  54. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter@2x.png +0 -0
  55. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter@3x.png +0 -0
  56. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones.png +0 -0
  57. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones@2x.png +0 -0
  58. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones@3x.png +0 -0
  59. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook.png +0 -0
  60. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook@2x.png +0 -0
  61. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook@3x.png +0 -0
  62. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote.png +0 -0
  63. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote@2x.png +0 -0
  64. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote@3x.png +0 -0
  65. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone.png +0 -0
  66. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone@2x.png +0 -0
  67. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone@3x.png +0 -0
  68. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant.png +0 -0
  69. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant@2x.png +0 -0
  70. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant@3x.png +0 -0
  71. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant.png +0 -0
  72. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant@2x.png +0 -0
  73. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant@3x.png +0 -0
  74. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied.png +0 -0
  75. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied@2x.png +0 -0
  76. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied@3x.png +0 -0
  77. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports.png +0 -0
  78. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports@2x.png +0 -0
  79. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports@3x.png +0 -0
  80. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherTv.png +0 -0
  81. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherTv@2x.png +0 -0
  82. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherTv@3x.png +0 -0
  83. package/src/modules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm.png +0 -0
  84. package/src/modules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm@2x.png +0 -0
  85. package/src/modules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm@3x.png +0 -0
  86. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime.png +0 -0
  87. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime@2x.png +0 -0
  88. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime@3x.png +0 -0
  89. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay.png +0 -0
  90. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay@2x.png +0 -0
  91. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay@3x.png +0 -0
  92. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline.png +0 -0
  93. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline@2x.png +0 -0
  94. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline@3x.png +0 -0
  95. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny.png +0 -0
  96. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny@2x.png +0 -0
  97. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny@3x.png +0 -0
  98. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight.png +0 -0
  99. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight@2x.png +0 -0
  100. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight@3x.png +0 -0
  101. package/src/modules/music/MusicActions.ts +61 -0
  102. package/src/modules/music/MusicDataBean.ts +292 -0
  103. package/src/modules/music/MusicManager.ts +206 -0
  104. package/src/modules/music/MusicPage.tsx +206 -0
  105. package/src/modules/music/res/app_music_ball@2x.png +0 -0
  106. package/src/modules/music/res/app_music_ball@3x.png +0 -0
  107. package/src/modules/music/res/app_music_game@2x.png +0 -0
  108. package/src/modules/music/res/app_music_game@3x.png +0 -0
  109. package/src/modules/music/res/app_music_music@2x.png +0 -0
  110. package/src/modules/music/res/app_music_music@3x.png +0 -0
  111. package/src/modules/music/res/app_music_romantic@2x.png +0 -0
  112. package/src/modules/music/res/app_music_romantic@3x.png +0 -0
  113. package/src/modules/music/res/iconsMaterialOutlinedArrowsNavCheck.png +0 -0
  114. package/src/modules/music/res/iconsMaterialOutlinedArrowsNavCheck@2x.png +0 -0
  115. package/src/modules/music/res/iconsMaterialOutlinedArrowsNavCheck@3x.png +0 -0
  116. package/src/modules/music/res/illustrationsFeaturesMusic.png +0 -0
  117. package/src/modules/music/res/illustrationsFeaturesMusic@2x.png +0 -0
  118. package/src/modules/music/res/illustrationsFeaturesMusic@3x.png +0 -0
  119. package/src/modules/music/res/illustrationsFeaturesMusicDisabled.png +0 -0
  120. package/src/modules/music/res/illustrationsFeaturesMusicDisabled@2x.png +0 -0
  121. package/src/modules/music/res/illustrationsFeaturesMusicDisabled@3x.png +0 -0
  122. package/src/modules/music/res/index.d.ts +10 -0
  123. package/src/modules/music/res/index.ts +9 -0
  124. package/src/navigation/Routers.ts +46 -0
@@ -0,0 +1,206 @@
1
+ /* eslint-disable consistent-return */
2
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
3
+ /* eslint-disable @typescript-eslint/ban-types */
4
+ // @ts-nocheck
5
+ import { NativeModules } from 'react-native';
6
+ import { TYSdk } from 'tuya-panel-kit';
7
+ import _ from 'lodash';
8
+ import { ColorUtils } from '@tuya/tuya-panel-lamp-sdk/lib/utils';
9
+ import { AppleMusicDataType, AppMusicListItemType } from './MusicDataBean';
10
+
11
+ interface OpenMusicOptions {
12
+ isColourExist?: boolean;
13
+ isTempExist?: boolean;
14
+ }
15
+ type MusicCallback = (data: AppleMusicDataType, i: number) => void;
16
+ type Type = 'checking' | 'failure' | 'success' | 'close';
17
+
18
+ const { native: TYNative, DeviceEventEmitter: DeviceEvent } = TYSdk;
19
+ const { TYRCTMusicManager: TYPublicNative } = NativeModules;
20
+ let isListening = false;
21
+ let isSendEnabled = true;
22
+ let timeOutTimer: number;
23
+ const listeners: {
24
+ checking?: Function[];
25
+ failure?: Function[];
26
+ success?: Function[];
27
+ close?: Function[];
28
+ } = {};
29
+
30
+ const startVoice = async () =>
31
+ new Promise((resolve, reject) => {
32
+ TYPublicNative.startVoice(d => {
33
+ TYNative.screenAlwaysOn(true);
34
+ resolve(d);
35
+ }, reject);
36
+ });
37
+
38
+ const stopVoice = async () =>
39
+ new Promise((resolve, reject) => {
40
+ TYPublicNative.stopVoice(d => {
41
+ TYNative.screenAlwaysOn(false);
42
+ resolve(d);
43
+ }, reject);
44
+ });
45
+
46
+ const fireEvent = (type: Type) => {
47
+ listeners[type]?.forEach((cb: Function) => {
48
+ cb?.();
49
+ });
50
+ };
51
+
52
+ const handleTimeOut = () => {
53
+ return setTimeout(() => {
54
+ // If there is no audio input within 10 seconds, call the detection event
55
+ fireEvent('checking');
56
+ // If there is no audio input within 30 seconds, call the missing event and actively stop monitoring
57
+ timeOutTimer = setTimeout(() => {
58
+ close(false);
59
+ fireEvent('failure');
60
+ }, 30000);
61
+ }, 10000);
62
+ };
63
+
64
+ const handleSuccess = _.throttle(() => {
65
+ fireEvent('success');
66
+ }, 1000);
67
+
68
+ export const addListener = (type: Type, cb: Function) => {
69
+ if (!listeners[type]) {
70
+ listeners[type] = [];
71
+ }
72
+ listeners[type].push(cb);
73
+ };
74
+ export const removeListener = (type: Type, cb: Function) => {
75
+ if (listeners[type]) {
76
+ const index = listeners[type].indexOf(cb);
77
+ if (index >= 0) {
78
+ listeners[type].splice(index, 1);
79
+ }
80
+ }
81
+ };
82
+
83
+ export const handleAudioRgbChange = _.throttle(
84
+ (
85
+ { R, G, B, C: temp, L: bright, index }: any,
86
+ musicOption: AppMusicListItemType,
87
+ musicCallback: MusicCallback,
88
+ onMusicDataPut: (data: AppleMusicDataType) => void,
89
+ options: OpenMusicOptions
90
+ ) => {
91
+ if (!isListening) return;
92
+ const { isColourExist, isTempExist } = options;
93
+
94
+ clearTimeout(timeOutTimer);
95
+ timeOutTimer = handleTimeOut();
96
+ handleSuccess();
97
+ let hue = 0;
98
+ let saturation = 0;
99
+ let value = 0;
100
+ let brightness = 0;
101
+ let temperature = 0;
102
+
103
+ const { mode, colorArea } = musicOption;
104
+ if (isColourExist) {
105
+ [hue, saturation, value] = ColorUtils.rgb2hsb(R, G, B).map((v, i) => (i > 0 ? v * 10 : v));
106
+ } else {
107
+ // 是否支持白光音乐功能
108
+ if (typeof bright === 'undefined' || typeof temp === 'undefined') return;
109
+
110
+ brightness = bright * 10;
111
+ temperature = temp * 10;
112
+ if (!isTempExist) temperature = 1000;
113
+ }
114
+
115
+ if (colorArea) {
116
+ colorArea.forEach(({ area, hue: h, saturation: s, value: v }) => {
117
+ const [left, right] = area;
118
+ if (index >= left && index <= right) {
119
+ hue = h;
120
+ saturation = s;
121
+ value = v;
122
+ }
123
+ });
124
+ }
125
+
126
+ const musicData: AppleMusicDataType = {
127
+ mode,
128
+ hue: Math.round(hue),
129
+ saturation: Math.round(saturation),
130
+ value: Math.round(value),
131
+ brightness,
132
+ temperature,
133
+ };
134
+
135
+ musicCallback(musicData, index || 5);
136
+
137
+ if (isListening && isSendEnabled) onMusicDataPut?.(musicData);
138
+ },
139
+ 300
140
+ );
141
+
142
+ /**
143
+ * Turn on the microphone and start monitoring
144
+ */
145
+ export const open = async (
146
+ musicOption: AppMusicListItemType,
147
+ musicCallback: MusicCallback,
148
+ onMusicDataPut: (data: AppleMusicDataType) => void,
149
+ options: OpenMusicOptions
150
+ ) => {
151
+ if (isListening) return Promise.resolve();
152
+
153
+ if (!isSendEnabled) {
154
+ resume();
155
+ } else {
156
+ try {
157
+ DeviceEvent.addListener('audioRgbChange', (musicData: any) => {
158
+ handleAudioRgbChange(musicData, musicOption, musicCallback, onMusicDataPut, options);
159
+ });
160
+ // Turn on the microphone
161
+ await startVoice();
162
+ isListening = true;
163
+ isSendEnabled = true;
164
+ } catch (e) {
165
+ return Promise.reject(e);
166
+ }
167
+ }
168
+ };
169
+
170
+ /**
171
+ * Turn off the microphone
172
+ */
173
+ export const close = async (needFire = true) => {
174
+ if (!isListening) return Promise.resolve();
175
+
176
+ handleSuccess.cancel();
177
+ clearTimeout(timeOutTimer);
178
+ needFire && fireEvent('close');
179
+ isListening = false;
180
+ isSendEnabled = true;
181
+ try {
182
+ DeviceEvent.removeAllListeners('audioRgbChange');
183
+
184
+ // Turn off the microphone
185
+ await stopVoice();
186
+ // Turn off keep screen
187
+ TYNative.screenAlwaysOn(false);
188
+ } catch (e) {
189
+ return Promise.reject(e);
190
+ }
191
+ };
192
+
193
+ /**
194
+ * Suspend sending
195
+ */
196
+ export const pause = () => {
197
+ handleSuccess.cancel();
198
+ isSendEnabled = false;
199
+ };
200
+
201
+ /**
202
+ * Continue to send
203
+ */
204
+ export const resume = () => {
205
+ isSendEnabled = true;
206
+ };
@@ -0,0 +1,206 @@
1
+ import React from 'react'
2
+ import { StyleSheet, View, Text, Image } from 'react-native'
3
+ import { useNavigation } from '@react-navigation/core'
4
+ import Page from '@ledvance/base/src/components/Page'
5
+ import { useDeviceInfo, useGroupConfig } from '@ledvance/base/src/models/modules/NativePropsSlice'
6
+ import I18n from '@ledvance/base/src/i18n'
7
+ import Img from './res'
8
+ import { useDreamMusicData, useMusciData } from './MusicActions'
9
+ import { useReactive, useUpdateEffect } from 'ahooks'
10
+ import { musicTabs } from './MusicDataBean'
11
+ import { SwitchButton, TabBar, Utils } from 'tuya-panel-kit'
12
+ import * as MusicManager from './MusicManager'
13
+ import Spacer from '@ledvance/base/src/components/Spacer'
14
+ import LdvSlider from '@ledvance/base/src/components/ldvSlider'
15
+ import TextFieldStyleButton from '@ledvance/base/src/components/TextFieldStyleButton'
16
+ import { SelectPageParams } from '@ledvance/group-ui-biz-bundle/src/modules/select/SelectPage'
17
+ import { ui_biz_routerKey } from '../../navigation/Routers'
18
+ import { cloneDeep } from 'lodash'
19
+ import { useParams } from '@ledvance/base/src/hooks/Hooks'
20
+ import { ColorParser } from '@ledvance/base/src/utils/ColorParser'
21
+ import { WorkMode } from '@ledvance/base/src/utils/interface'
22
+ const { convertX: cx } = Utils.RatioUtils
23
+
24
+ export interface MusicPageParams {
25
+ switchLedDp: string
26
+ workModeDp: string
27
+ musicDataDp: string
28
+ dreamMusicDp?: string
29
+ isMixLight?: boolean
30
+ }
31
+
32
+ const MusicPage = () => {
33
+ const deviceInfo = useDeviceInfo()
34
+ const parmas = useParams<MusicPageParams>()
35
+ const navigation = useNavigation()
36
+ const [musicData, setMusicData] = useDreamMusicData(parmas)
37
+ const [, setMusic] = useMusciData()
38
+ const [config] = useGroupConfig<any>()
39
+ const state = useReactive({
40
+ musicData: cloneDeep(musicData),
41
+ })
42
+
43
+ useUpdateEffect(() =>{
44
+ state.musicData = cloneDeep(musicData)
45
+ }, [musicData])
46
+
47
+ const openMusic = () =>{
48
+ if(config['workMode'] !== WorkMode.Music) state.musicData.lastWorkMode = config['workMode']
49
+ state.musicData.musicSwitch = true
50
+ if (parmas.dreamMusicDp && state.musicData.musicType === 0){
51
+ setMusicData(cloneDeep(state.musicData))
52
+ }else{
53
+ // setMusicData({
54
+ // ...cloneDeep(state.musicData),
55
+ // phoneDpData: ''
56
+ // }).then()
57
+ MusicManager.open(
58
+ state.musicData.phoneMusicData[state.musicData.phoneGenreMode],
59
+ () => {},
60
+ async (v) =>{
61
+ const musicDpData = ColorParser.encodeControlData(
62
+ v.mode,
63
+ v.hue,
64
+ v.saturation,
65
+ v.value,
66
+ v.brightness,
67
+ v.temperature
68
+ );
69
+ // await setMusic(musicDpData)
70
+ await setMusicData({
71
+ ...cloneDeep(state.musicData),
72
+ phoneDpData: musicDpData
73
+ })
74
+ },
75
+ { isColourExist: true, isTempExist: true }
76
+ )
77
+ }
78
+ }
79
+
80
+ const closeMusic = () =>{
81
+ MusicManager.close()
82
+ state.musicData.musicSwitch = false
83
+ setMusicData(cloneDeep(state.musicData))
84
+ }
85
+
86
+ const getSelectModeData = (): [string | undefined, any[]] => {
87
+ const genreModeData = parmas.dreamMusicDp && state.musicData.musicType === 0 ? state.musicData.deviceMusicData : state.musicData.phoneMusicData
88
+ const genreMode = parmas.dreamMusicDp && state.musicData.musicType === 0 ? state.musicData.deviceGenreMode : state.musicData.phoneGenreMode
89
+ const title = genreModeData.find(mode => mode.id === genreMode)?.title
90
+ const selectModeData = genreModeData.map(music => {
91
+ return {
92
+ text: music.title,
93
+ selected: music.id === genreMode,
94
+ value: music.id,
95
+ }
96
+ })
97
+ return [title, selectModeData]
98
+ }
99
+ return (
100
+ <Page
101
+ backText={deviceInfo.name}
102
+ headlineText={I18n.getLang('devicemusic_headline_text')}
103
+ >
104
+ <View style={styles.content}>
105
+ <SwitchButton
106
+ style={styles.headSwitch}
107
+ value={state.musicData.musicSwitch}
108
+ thumbStyle={{ elevation: 0 }}
109
+ onValueChange={async v => {
110
+ if(v) {
111
+ openMusic()
112
+ }else{
113
+ closeMusic()
114
+ }
115
+ }} />
116
+ {parmas.dreamMusicDp && <TabBar
117
+ type='radio'
118
+ tabs={musicTabs}
119
+ style={{ borderRadius: cx(8), backgroundColor: '#f6f6f6', height: cx(36) }}
120
+ tabTextStyle={{ color: '#000' }}
121
+ tabActiveTextStyle={{ color: '#000', fontWeight: 'bold' }}
122
+ activeKey={state.musicData.musicType}
123
+ onChange={async (v) => {
124
+ state.musicData.musicType = Number(v)
125
+ if(state.musicData.musicSwitch) openMusic()
126
+ }}
127
+ />}
128
+ <Spacer />
129
+ <Text style={styles.tiptext}>{I18n.getLang(state.musicData.musicType === 0 ? 'devicemusic_devicemic_description_text' : 'devicemusic_description_text')}</Text>
130
+ <View style={{ alignItems: 'center', marginVertical: cx(38) }}>
131
+ <Image
132
+ style={{ width: cx(200), height: cx(204) }}
133
+ source={state.musicData.musicSwitch ? Img.app_music_center_on : Img.app_music_center_off}
134
+ resizeMode="contain"
135
+ />
136
+ </View>
137
+ {
138
+ state.musicData.musicSwitch &&
139
+ <>
140
+ {parmas.dreamMusicDp && state.musicData.musicType === 0 &&
141
+ <LdvSlider
142
+ title={I18n.getLang('devicemusic_switch_tab_device_sensitivity')}
143
+ value={state.musicData.deviceMusicData[state.musicData.deviceGenreMode]?.sensitivity || 50}
144
+ min={1}
145
+ max={100}
146
+ onValueChange={() => { }}
147
+ onSlidingComplete={(v: number) => {
148
+ state.musicData.deviceMusicData = state.musicData.deviceMusicData.map(m => {
149
+ if(m.id === state.musicData.deviceGenreMode){
150
+ return {
151
+ ...m,
152
+ sensitivity: v
153
+ }
154
+ }
155
+ return m
156
+ })
157
+ openMusic()
158
+ }}
159
+ subTitleStr={''} />
160
+ }
161
+ <TextFieldStyleButton
162
+ text={getSelectModeData()[0] || I18n.getLang('devicemusic_music_text')}
163
+ placeholder={I18n.getLang('devicemusic_subheadline_text')}
164
+ onPress={() => {
165
+ const paramsSelect: SelectPageParams<number> = {
166
+ title: I18n.getLang('devicemusic_subheadline_text'),
167
+ data: getSelectModeData()[1],
168
+ onSelect: selectPageData => {
169
+ if (parmas.dreamMusicDp && state.musicData.musicType === 0) {
170
+ state.musicData.deviceGenreMode = selectPageData.value
171
+ } else {
172
+ state.musicData.phoneGenreMode = selectPageData.value
173
+ }
174
+ openMusic()
175
+ },
176
+ }
177
+ navigation.navigate(ui_biz_routerKey.group_ui_biz_select_page, paramsSelect)
178
+ }}
179
+ />
180
+ </>
181
+ }
182
+ </View>
183
+ </Page>
184
+ )
185
+ }
186
+
187
+ const styles = StyleSheet.create({
188
+ content: {
189
+ flex: 1,
190
+ marginHorizontal: cx(18)
191
+ },
192
+ headSwitch: {
193
+ position: 'absolute',
194
+ right: 0,
195
+ top: - cx(40),
196
+ zIndex: 2,
197
+ marginBottom: cx(24)
198
+ },
199
+ tiptext: {
200
+ color: '#000',
201
+ fontSize: cx(14),
202
+ lineHeight: cx(14),
203
+ }
204
+ })
205
+
206
+ export default MusicPage
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ app_music_music: any;
3
+ app_music_ball: any;
4
+ app_music_game: any;
5
+ app_music_romantic: any;
6
+ app_music_check: any;
7
+ app_music_center_off: any;
8
+ app_music_center_on: any;
9
+ };
10
+ export default _default;
@@ -0,0 +1,9 @@
1
+ export default {
2
+ app_music_music: require('./app_music_music.png'),
3
+ app_music_ball: require('./app_music_ball.png'),
4
+ app_music_game: require('./app_music_game.png'),
5
+ app_music_romantic: require('./app_music_romantic.png'),
6
+ app_music_check: require('./iconsMaterialOutlinedArrowsNavCheck.png'),
7
+ app_music_center_off: require('./illustrationsFeaturesMusicDisabled.png'),
8
+ app_music_center_on: require('./illustrationsFeaturesMusic.png'),
9
+ }
@@ -15,6 +15,10 @@ import RandomTimeForPlugPage from "../modules/randomTimeForPlug/RandomTimeForPlu
15
15
  import RandomTimeForPlugDetailPage from "../modules/randomTimeForPlug/RandomTimeForPlugDetailPage";
16
16
  import RandomTimeForLightPage from "../modules/randomTimingForLight/RandomTimingForLightPage";
17
17
  import RandomTimingForLightDetailPage from "../modules/randomTimingForLight/RandomTimingForLightDetailPage";
18
+ import BiorhythmPage from '../modules/biorhythm/BiorhythmPage'
19
+ import BiorhythmEditPage from '../modules/biorhythm/BiorhythmDetailPage'
20
+ import IconSelectPage from '../modules/biorhythm/IconSelect'
21
+ import MusicPage from '../modules/music/MusicPage'
18
22
 
19
23
  export const ui_biz_routerKey = {
20
24
  'group_ui_biz_timer': 'group_ui_biz_timer',
@@ -33,6 +37,10 @@ export const ui_biz_routerKey = {
33
37
  'group_ui_biz_random_time_plug_detail': 'group_ui_biz_random_time_plug_detail',
34
38
  'group_ui_biz_random_timing_light': 'group_ui_biz_random_timing_light',
35
39
  'group_ui_biz_random_timing_light_detail': 'group_ui_biz_random_timing_light_detail',
40
+ 'group_ui_biz_biological': 'group_ui_biz_biological',
41
+ 'group_ui_biz_biological_detail': 'group_ui_biz_biological_detail',
42
+ 'group_ui_biz_biological_icon_select': 'group_ui_biz_biological_icon_select',
43
+ 'group_ui_biz_music': 'group_ui_biz_music'
36
44
  }
37
45
 
38
46
  export const TimerRouters: NavigationRoute[] = [
@@ -190,3 +198,41 @@ export const RandomTimingForLightRouters: NavigationRoute[] = [
190
198
  },
191
199
  },
192
200
  ]
201
+
202
+ export const BiologicalRouters: NavigationRoute[] = [
203
+ {
204
+ name: ui_biz_routerKey.group_ui_biz_biological,
205
+ component: BiorhythmPage,
206
+ options: {
207
+ hideTopbar: true,
208
+ showOfflineView: false,
209
+ },
210
+ },
211
+ {
212
+ name: ui_biz_routerKey.group_ui_biz_biological_detail,
213
+ component: BiorhythmEditPage,
214
+ options: {
215
+ hideTopbar: true,
216
+ showOfflineView: false,
217
+ },
218
+ },
219
+ {
220
+ name: ui_biz_routerKey.group_ui_biz_biological_icon_select,
221
+ component: IconSelectPage,
222
+ options: {
223
+ hideTopbar: true,
224
+ showOfflineView: false,
225
+ },
226
+ },
227
+ ]
228
+
229
+ export const MusicPageRouters: NavigationRoute[] = [
230
+ {
231
+ name: ui_biz_routerKey.group_ui_biz_music,
232
+ component: MusicPage,
233
+ options: {
234
+ hideTopbar: true,
235
+ showOfflineView: false,
236
+ },
237
+ },
238
+ ]