@ledvance/ui-biz-bundle 1.1.133 → 1.1.135
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 +1 -1
- package/src/modules/mood/DynamicMoodEditorPage.tsx +1 -1
- package/src/modules/mood/FantasyMoodEditPage.tsx +1 -1
- package/src/modules/mood/MixMood/MixMoodEditPage.tsx +1 -1
- package/src/modules/mood/StaticMoodEditorPage.tsx +2 -2
- package/src/newModules/biorhythm/BiorhythmActions.ts +34 -8
- package/src/newModules/biorhythm/BiorhythmPage.tsx +58 -24
- package/src/newModules/biorhythm/circular/RhythmsCircle.tsx +488 -0
- package/src/newModules/biorhythm/circular/conical-gradient/Android.tsx +63 -0
- package/src/newModules/biorhythm/circular/conical-gradient/Ios.tsx +26 -0
- package/src/newModules/biorhythm/circular/conical-gradient/Normal.tsx +187 -0
- package/src/newModules/biorhythm/circular/conical-gradient/index.android.tsx +164 -0
- package/src/newModules/biorhythm/circular/conical-gradient/index.ios.tsx +124 -0
- package/src/newModules/biorhythm/circular/conical-gradient/index.tsx +3 -0
- package/src/newModules/biorhythm/circular/conical-gradient/index.web.tsx +94 -0
- package/src/newModules/biorhythm/circular/conical-gradient/interface.ts +19 -0
- package/src/newModules/biorhythm/circular/conical-gradient/utils.ts +25 -0
- package/src/newModules/biorhythm/circular/interface.ts +114 -0
- package/src/newModules/energyConsumption/component/EnergyModal.tsx +3 -0
- package/src/newModules/lightMode/LightModePage.tsx +52 -145
- package/src/newModules/mood/DynamicMoodEditorPage.tsx +1 -1
- package/src/newModules/mood/MixDynamicMoodEditor.tsx +1 -1
- package/src/newModules/mood/MoodInfo.ts +1 -1
- package/src/newModules/mood/MoodPage.tsx +4 -5
- package/src/newModules/mood/StaticMoodEditorPage.tsx +1 -1
- package/src/newModules/powerOnBehavior/LightBehaviorPage.tsx +37 -120
- package/src/newModules/powerOnBehavior/PlugBehaviorPage.tsx +60 -141
- package/src/newModules/powerOnBehavior/PowerOnBehaviorActions.ts +13 -5
- package/src/newModules/sleepWakeUp/SleepWakeUpActions.ts +122 -59
- package/src/newModules/sleepWakeUp/SleepWakeUpPage.tsx +10 -10
- package/src/newModules/swithInching/SwithInching.tsx +23 -20
- package/src/newModules/swithInching/SwithInchingAction.ts +21 -15
- package/src/newModules/biorhythm/circular/ItemIcon.d.ts +0 -22
- package/src/newModules/biorhythm/circular/ItemIcon.tsx +0 -173
- package/src/newModules/biorhythm/circular/Progress.d.ts +0 -24
- package/src/newModules/biorhythm/circular/Progress.tsx +0 -372
- package/src/newModules/biorhythm/circular/TimeCircular.d.ts +0 -11
- package/src/newModules/biorhythm/circular/TimeCircular.tsx +0 -64
package/package.json
CHANGED
|
@@ -191,7 +191,7 @@ const DynamicMoodEditorPage = () => {
|
|
|
191
191
|
maxLength={33}
|
|
192
192
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
193
193
|
tipColor={nameRepeat ? '#f00' : undefined}
|
|
194
|
-
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
194
|
+
tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
|
|
195
195
|
errorText={Strings.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')}/>
|
|
196
196
|
<Card style={styles.adjustCard}>
|
|
197
197
|
<Spacer height={cx(16)}/>
|
|
@@ -227,7 +227,7 @@ const FantasyMoodEditPage = () => {
|
|
|
227
227
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
228
228
|
maxLength={33}
|
|
229
229
|
tipColor={nameRepeat ? '#f00' : undefined}
|
|
230
|
-
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
230
|
+
tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
|
|
231
231
|
errorText={I18n.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')} />
|
|
232
232
|
<Card style={styles.adjustCard}>
|
|
233
233
|
<Spacer height={cx(16)} />
|
|
@@ -191,7 +191,7 @@ const RgbcMoodEditPage = () => {
|
|
|
191
191
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
192
192
|
maxLength={33}
|
|
193
193
|
tipColor={nameRepeat ? '#f00' : undefined}
|
|
194
|
-
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
194
|
+
tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
|
|
195
195
|
errorText={I18n.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')} />
|
|
196
196
|
{params.isStatic ? <Card style={styles.adjustCard}>
|
|
197
197
|
<LdvSwitch
|
|
@@ -191,7 +191,7 @@ const StaticMoodEditorPage = () => {
|
|
|
191
191
|
maxLength={33}
|
|
192
192
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
193
193
|
tipColor={nameRepeat ? '#f00' : undefined}
|
|
194
|
-
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
194
|
+
tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
|
|
195
195
|
errorText={Strings.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')}/>
|
|
196
196
|
<Card style={styles.adjustCard}>
|
|
197
197
|
<Spacer height={cx(16)}/>
|
|
@@ -318,4 +318,4 @@ const styles = StyleSheet.create({
|
|
|
318
318
|
},
|
|
319
319
|
})
|
|
320
320
|
|
|
321
|
-
export default StaticMoodEditorPage
|
|
321
|
+
export default StaticMoodEditorPage
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
Plan,
|
|
11
11
|
RemoteBiorhythmBean,
|
|
12
12
|
} from './BiorhythmBean'
|
|
13
|
-
import { useCallback, useEffect, useState } from 'react'
|
|
13
|
+
import { useCallback, useEffect, useState, useRef } from 'react'
|
|
14
14
|
import { NativeResult, Result } from '@ledvance/base/src/models/modules/Result'
|
|
15
15
|
import { useDeviceId, useDp } from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
16
16
|
import { getFeature, NativeApi, putFeature } from '@ledvance/base/src/api/native'
|
|
@@ -23,14 +23,16 @@ import { useUpdateEffect } from 'ahooks'
|
|
|
23
23
|
|
|
24
24
|
type UseBiorhythmType = (dpKey: string, disabledFeature?: boolean) => [BiorhythmBean, SetBiorhythmType];
|
|
25
25
|
type SetBiorhythmType = (biorhythmObj: BiorhythmBean, pushFeature?: boolean) => Promise<Result<any>>;
|
|
26
|
-
let biorhythmTimer: undefined | number = undefined
|
|
27
26
|
|
|
27
|
+
let biorhythmTimer: number | undefined = undefined
|
|
28
28
|
export const useBiorhythm: UseBiorhythmType = (dpKey: string, disabledFeature?: boolean) => {
|
|
29
29
|
const [dp, setDp] = useDp<string, (v: string) => any>(dpKey)
|
|
30
30
|
const deviceId = useDeviceId()
|
|
31
31
|
const [biorhythmState, setBiorhythmState] = useState(dp2Obj(dp))
|
|
32
|
+
const isInternalUpdateRef = useRef(false)
|
|
33
|
+
const previousDpRef = useRef(dp)
|
|
32
34
|
|
|
33
|
-
const getBiorhythm =
|
|
35
|
+
const getBiorhythm = () => {
|
|
34
36
|
const biorhythm = dp2Obj(dp)
|
|
35
37
|
getRemoteBiorhythm(deviceId, biorhythm).then(res => {
|
|
36
38
|
if (res.success && res.data) {
|
|
@@ -42,31 +44,53 @@ export const useBiorhythm: UseBiorhythmType = (dpKey: string, disabledFeature?:
|
|
|
42
44
|
}))
|
|
43
45
|
}
|
|
44
46
|
})
|
|
45
|
-
}
|
|
47
|
+
}
|
|
46
48
|
|
|
47
49
|
useEffect(() => {
|
|
48
50
|
if (disabledFeature) return
|
|
49
51
|
biorhythmTimer = setTimeout(() => {
|
|
50
52
|
getBiorhythm()
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
+
}, 150)
|
|
53
54
|
return () => {
|
|
54
|
-
|
|
55
|
+
if (biorhythmTimer) {
|
|
56
|
+
clearTimeout(biorhythmTimer)
|
|
57
|
+
biorhythmTimer = undefined
|
|
58
|
+
}
|
|
55
59
|
}
|
|
56
60
|
}, [])
|
|
57
61
|
|
|
58
62
|
useUpdateEffect(() => {
|
|
63
|
+
if (isInternalUpdateRef.current || disabledFeature) {
|
|
64
|
+
if (disabledFeature) {
|
|
65
|
+
setBiorhythmState(dp2Obj(dp))
|
|
66
|
+
}
|
|
67
|
+
if (isInternalUpdateRef.current) {
|
|
68
|
+
previousDpRef.current = dp
|
|
69
|
+
}
|
|
70
|
+
isInternalUpdateRef.current = false
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
if (dp?.toLocaleLowerCase() === previousDpRef.current?.toLocaleLowerCase()) {
|
|
74
|
+
return
|
|
75
|
+
}
|
|
59
76
|
getBiorhythm()
|
|
60
77
|
}, [dp])
|
|
61
78
|
|
|
62
79
|
const setBiorhythmFn = async (biorhythmObj: BiorhythmBean, pushFeature: boolean = true) => {
|
|
63
80
|
const dpValue = obj2Dp(biorhythmObj)
|
|
81
|
+
isInternalUpdateRef.current = true
|
|
82
|
+
|
|
64
83
|
if (pushFeature) {
|
|
65
84
|
const putFeatureRes = await putFeature(deviceId, biorhythmFeatureId, vo2Dto(biorhythmObj))
|
|
85
|
+
console.log(vo2Dto(biorhythmObj), '< --- biorhythmObj --- >')
|
|
66
86
|
if (putFeatureRes.result) {
|
|
87
|
+
setBiorhythmState(biorhythmObj)
|
|
67
88
|
return setDp(dpValue)
|
|
89
|
+
} else {
|
|
90
|
+
isInternalUpdateRef.current = false
|
|
68
91
|
}
|
|
69
92
|
} else {
|
|
93
|
+
setBiorhythmState(biorhythmObj)
|
|
70
94
|
return setDp(dpValue)
|
|
71
95
|
}
|
|
72
96
|
return { success: false }
|
|
@@ -182,6 +206,7 @@ export function dp2Obj(dp: string): BiorhythmBean {
|
|
|
182
206
|
enabled: p === '1',
|
|
183
207
|
}
|
|
184
208
|
})
|
|
209
|
+
repeatPeriod.sort((a, b) => a.index - b.index)
|
|
185
210
|
dpCopy = dpCopy.slice(2)
|
|
186
211
|
// 节点个数 (每个节点长度18),最多8个节点
|
|
187
212
|
hex2Int(dpCopy.slice(0, 2))
|
|
@@ -346,8 +371,9 @@ function obj2Dp(obj: BiorhythmBean): string {
|
|
|
346
371
|
const versionHex = '00'
|
|
347
372
|
const enableHex = obj.enable ? '01' : '00'
|
|
348
373
|
const gradientHex = obj.gradient === BiorhythmGradientType.EntireGradient ? '00' : '0F'
|
|
374
|
+
const newRepeatPeriod = [obj.repeatPeriod[obj.repeatPeriod.length - 1], ...obj.repeatPeriod.slice(0, -1)]
|
|
349
375
|
const repeatPeriodHex = parseInt(
|
|
350
|
-
|
|
376
|
+
newRepeatPeriod
|
|
351
377
|
.map(p => (p.enabled ? '1' : '0'))
|
|
352
378
|
.reverse()
|
|
353
379
|
.join(''),
|
|
@@ -21,11 +21,9 @@ import I18n from '@ledvance/base/src/i18n'
|
|
|
21
21
|
import res from '@ledvance/base/src/res'
|
|
22
22
|
import { ui_biz_routerKey } from "../../navigation/Routers";
|
|
23
23
|
import { cctToColor } from '@ledvance/base/src/utils/cctUtils'
|
|
24
|
-
import { setDataSource } from '@ledvance/base/src/components/weekSelect'
|
|
25
24
|
import { BiorhythmEditPageParams } from './BiorhythmEditPage'
|
|
26
25
|
import { useBiorhythm } from './BiorhythmActions'
|
|
27
26
|
import { convertMinutesTo12HourFormat, showDialog as showCommonDialog } from '@ledvance/base/src/utils/common'
|
|
28
|
-
import TimeCircular from './circular/TimeCircular'
|
|
29
27
|
import Page from '@ledvance/base/src/components/Page'
|
|
30
28
|
import Card from '@ledvance/base/src/components/Card'
|
|
31
29
|
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
@@ -33,6 +31,7 @@ import DeleteButton from '@ledvance/base/src/components/DeleteButton'
|
|
|
33
31
|
import { useParams } from '@ledvance/base/src/hooks/Hooks'
|
|
34
32
|
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
35
33
|
import { useConflictTask } from 'hooks/DeviceDpStateHooks'
|
|
34
|
+
import RhythmsCircle from './circular/RhythmsCircle'
|
|
36
35
|
|
|
37
36
|
const cx = Utils.RatioUtils.convertX
|
|
38
37
|
const { withTheme } = Utils.ThemeUtils
|
|
@@ -78,6 +77,14 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
78
77
|
loading: false
|
|
79
78
|
})
|
|
80
79
|
|
|
80
|
+
const timeImg = useMemo(() => {
|
|
81
|
+
if (is24Hour) {
|
|
82
|
+
return devicesJudge ? res.ic_warning_amber_sun : res.ic_warning_amber_new
|
|
83
|
+
} else {
|
|
84
|
+
return devicesJudge ? res.ic_warning_amber_sun_12 : res.ic_warning_amber_new_12
|
|
85
|
+
}
|
|
86
|
+
}, [is24Hour, devicesJudge])
|
|
87
|
+
|
|
81
88
|
const showGradientTypeSelectModal = useCallback((show: boolean) => {
|
|
82
89
|
state.showGradientTypeSelectModal = show
|
|
83
90
|
}, [])
|
|
@@ -181,12 +188,8 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
181
188
|
}
|
|
182
189
|
}
|
|
183
190
|
|
|
184
|
-
useEffect(() =>{
|
|
185
|
-
const weeks
|
|
186
|
-
biorhythm.repeatPeriod.map(item => {
|
|
187
|
-
return item?.enabled ? 1 : 0
|
|
188
|
-
})).filter(item => item.enabled)
|
|
189
|
-
.map(item => item.title)
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
const weeks = biorhythm.repeatPeriod.filter(it => it.enabled).map(it => it.title)
|
|
190
193
|
|
|
191
194
|
if (weeks.length > 0) {
|
|
192
195
|
if (weeks.length === 7) {
|
|
@@ -233,15 +236,16 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
233
236
|
fontSize: cx(14),
|
|
234
237
|
flexDirection: 'row',
|
|
235
238
|
}}>
|
|
236
|
-
<Text style={{color: props.theme?.global.fontColor }}>{text[0]}</Text>
|
|
237
|
-
<Text
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
<Text style={{ color: props.theme?.global.fontColor }}>{text[0]}</Text>
|
|
240
|
+
<Text
|
|
241
|
+
onPress={openLink}
|
|
242
|
+
style={{
|
|
243
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
244
|
+
color: props.theme?.button.primary,
|
|
245
|
+
textDecorationLine: 'underline',
|
|
246
|
+
flexWrap: 'wrap',
|
|
247
|
+
}}>SUN@HOME</Text>
|
|
248
|
+
<Text style={{ color: props.theme?.global.fontColor }}>{text[1]}</Text>
|
|
245
249
|
</Text>
|
|
246
250
|
}
|
|
247
251
|
|
|
@@ -257,6 +261,17 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
257
261
|
return availableChart[randomIndex]
|
|
258
262
|
}
|
|
259
263
|
|
|
264
|
+
const convertPlandata = useCallback(() => {
|
|
265
|
+
return state.planList.map(item => {
|
|
266
|
+
return {
|
|
267
|
+
...item,
|
|
268
|
+
noActiveColor: '#474e5d',
|
|
269
|
+
activeColor: '#F7EB2A',
|
|
270
|
+
color: item?.brightness === 0 ? '#000' : !params.isSupportTemperature && cctToColor(1) || cctToColor(item.colorTemperature.toFixed(), item?.brightness)
|
|
271
|
+
}
|
|
272
|
+
}).filter(plan => plan.enable)
|
|
273
|
+
}, [JSON.stringify(state.planList), params.isSupportTemperature])
|
|
274
|
+
|
|
260
275
|
return (
|
|
261
276
|
<>
|
|
262
277
|
<Page
|
|
@@ -348,10 +363,10 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
348
363
|
})}
|
|
349
364
|
</View>
|
|
350
365
|
<View style={{ marginHorizontal: cx(24), marginTop: cx(20) }}>
|
|
351
|
-
<Text style={{color: props.theme?.global.fontColor}}>{state.weekString}</Text>
|
|
366
|
+
<Text style={{ color: props.theme?.global.fontColor }}>{state.weekString}</Text>
|
|
352
367
|
</View>
|
|
353
368
|
<View style={{ marginHorizontal: cx(24), marginTop: cx(16) }}>
|
|
354
|
-
<Text style={{color: props.theme?.global.fontColor}}>
|
|
369
|
+
<Text style={{ color: props.theme?.global.fontColor }}>
|
|
355
370
|
{I18n.getLang('bio_ryhthm_default_selectionfield_topic_text')}
|
|
356
371
|
</Text>
|
|
357
372
|
<TouchableOpacity
|
|
@@ -390,7 +405,7 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
390
405
|
</TouchableOpacity>
|
|
391
406
|
</View>
|
|
392
407
|
<View style={{ height: cx(20) }} />
|
|
393
|
-
<TimeCircular
|
|
408
|
+
{/* <TimeCircular
|
|
394
409
|
planEdit={true}
|
|
395
410
|
planList={state.planList}
|
|
396
411
|
onPanMoved={(id, time) => {
|
|
@@ -404,7 +419,26 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
404
419
|
}}
|
|
405
420
|
replaceStatus={devicesJudge}
|
|
406
421
|
gradient={state.gradient === BiorhythmGradientType.DirectGradient}
|
|
407
|
-
isSupportTemperature={!params.isSupportTemperature} />
|
|
422
|
+
isSupportTemperature={!params.isSupportTemperature} /> */}
|
|
423
|
+
<View style={{ alignItems: 'center', justifyContent: 'center' }}>
|
|
424
|
+
<RhythmsCircle
|
|
425
|
+
size={250}
|
|
426
|
+
ringWidth={40}
|
|
427
|
+
thumbSize={36}
|
|
428
|
+
timeImg={timeImg}
|
|
429
|
+
gradientMode={state.gradient === BiorhythmGradientType.EntireGradient}
|
|
430
|
+
data={convertPlandata()}
|
|
431
|
+
onRelease={(planList) => {
|
|
432
|
+
state.planList = state.planList.map(item => {
|
|
433
|
+
return {
|
|
434
|
+
...item,
|
|
435
|
+
time: planList.find(p => p.index === item.index)?.time
|
|
436
|
+
}
|
|
437
|
+
})
|
|
438
|
+
state.flag = Symbol()
|
|
439
|
+
}}
|
|
440
|
+
/>
|
|
441
|
+
</View>
|
|
408
442
|
<View
|
|
409
443
|
style={{
|
|
410
444
|
flexDirection: 'row',
|
|
@@ -415,7 +449,7 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
415
449
|
}}>
|
|
416
450
|
{state.planList.length === 8 && <View
|
|
417
451
|
style={{ marginVertical: cx(10), flexDirection: 'row', alignItems: 'center', width: width - cx(48) }}>
|
|
418
|
-
<Image style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.warning }} source={{uri: res.ic_warning_amber}} />
|
|
452
|
+
<Image style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.warning }} source={{ uri: res.ic_warning_amber }} />
|
|
419
453
|
<Text
|
|
420
454
|
style={{
|
|
421
455
|
flexWrap: 'wrap',
|
|
@@ -471,7 +505,7 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
471
505
|
}
|
|
472
506
|
navigation.navigate(ui_biz_routerKey.bi_biz_biological_edit, editPageParams)
|
|
473
507
|
}}>
|
|
474
|
-
<Image source={{uri: res.biorhythom_add}} style={{ height: cx(24), width: cx(24), tintColor: props.theme?.icon.primary }} />
|
|
508
|
+
<Image source={{ uri: res.biorhythom_add }} style={{ height: cx(24), width: cx(24), tintColor: props.theme?.icon.primary }} />
|
|
475
509
|
</TouchableOpacity>
|
|
476
510
|
</>
|
|
477
511
|
}
|
|
@@ -522,7 +556,7 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
522
556
|
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', marginTop: cx(16) }}>
|
|
523
557
|
<View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
|
|
524
558
|
<Image
|
|
525
|
-
source={{uri: setImg(item?.iconId)
|
|
559
|
+
source={{ uri: setImg(item?.iconId) }}
|
|
526
560
|
style={{
|
|
527
561
|
width: cx(24),
|
|
528
562
|
height: cx(24),
|