@ledvance/group-ui-biz-bundle 1.0.43 → 1.0.44

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
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/group-ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.0.43",
7
+ "version": "1.0.44",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -15,7 +15,6 @@ import { sortBy, cloneDeep } from 'lodash'
15
15
  import iconList from './iconListData'
16
16
  import pIdList from './pIdList'
17
17
  import {
18
- useDeviceId,
19
18
  useDeviceInfo,
20
19
  useGroupDevices,
21
20
  } from '@ledvance/base/src/models/modules/NativePropsSlice'
@@ -25,11 +24,10 @@ import res from '@ledvance/base/src/res'
25
24
  import { ui_biz_routerKey } from '../../navigation/Routers'
26
25
  import BiologicalRes from './res/BiologicalRes'
27
26
  import { cctToColor } from '@ledvance/base/src/utils/cctUtils'
28
- import { NativeApi } from '@ledvance/base/src/api/native'
29
27
  import { setDataSource } from '@ledvance/base/src/components/weekSelect'
30
28
  import { BiorhythmEditPageParams } from './BiorhythmDetailPage'
31
29
  import { useBiorhythm } from './BiorhythmActions'
32
- import { showDialog as showCommonDialog } from '@ledvance/base/src/utils/common'
30
+ import { showDialog as showCommonDialog, showDialog } from '@ledvance/base/src/utils/common'
33
31
  import { useParams } from '@ledvance/base/src/hooks/Hooks'
34
32
  import Spacer from '@ledvance/base/src/components/Spacer'
35
33
  import ApplyForDeviceList from '@ledvance/base/src/components/ApplyForDeviceList'
@@ -44,7 +42,6 @@ interface UIState extends BiorhythmBean {
44
42
  showGradientTypeSelectModal: boolean;
45
43
  flag: symbol;
46
44
  weekString: string,
47
- timeSchedule: any[]
48
45
  loading: boolean
49
46
  }
50
47
 
@@ -59,7 +56,6 @@ const BiorhythmPage = () => {
59
56
  const navigation = useNavigation()
60
57
  const params = useParams<BiorhythmPageParams>()
61
58
  const [biorhythm, setBiorhythm] = useBiorhythm()
62
- const deviceId = useDeviceId()
63
59
  const deviceInfo = useDeviceInfo()
64
60
  const [groupDevices] = useGroupDevices()
65
61
  const { productId } = deviceInfo
@@ -70,7 +66,6 @@ const BiorhythmPage = () => {
70
66
  showGradientTypeSelectModal: false,
71
67
  flag: Symbol(),
72
68
  weekString: '',
73
- timeSchedule: [],
74
69
  loading: false
75
70
  })
76
71
 
@@ -257,21 +252,6 @@ const BiorhythmPage = () => {
257
252
  return availableChart[randomIndex]
258
253
  }
259
254
 
260
- const reloadData = async () => {
261
- const res: any = await NativeApi.getAllTaskTimer(deviceId)
262
- console.log('reload data', res)
263
- if (res.success && res.data) {
264
- // 原生传过来的dps是json字符串。
265
- if (Array.isArray(res.data) && res.data.length) {
266
- state.timeSchedule = res.data
267
- }
268
- }
269
- }
270
-
271
- useEffect(() => {
272
- reloadData().then()
273
- }, [])
274
-
275
255
  return (
276
256
  <>
277
257
  <View style={{ flex: 1, flexDirection: 'column' }}>
@@ -305,7 +285,19 @@ const BiorhythmPage = () => {
305
285
  thumbColor={'#f60'}
306
286
  trackColor={{ false: '#00000026', true: '#ff660036' }}
307
287
  onValueChange={async enable => {
308
- // if (enable && (enableTimeScheduleStatus)) return showDialog(enable)
288
+ if (enable) return showDialog({
289
+ method: 'confirm',
290
+ title: I18n.getLang('conflict_dialog_active_item_bio_rhythm_titel'),
291
+ subTitle: I18n.getLang('group_conflict_feature'),
292
+ confirmText: I18n.getLang('registration_dialog_button_yes'),
293
+ cancelText: I18n.getLang('registration_dialog_button_no'),
294
+ onConfirm: async (_, { close }) => {
295
+ state.loading = true
296
+ state.enable = enable
297
+ close()
298
+ state.flag = Symbol()
299
+ }
300
+ })
309
301
  state.loading = true
310
302
  state.enable = enable
311
303
  state.flag = Symbol()
@@ -24,6 +24,7 @@ export interface FixedTimeItem {
24
24
  weeks: number[]
25
25
  startTime: number
26
26
  endTime: number
27
+ settingTime: number
27
28
  onTime: number
28
29
  offTime: number
29
30
  name?: string
@@ -72,6 +73,7 @@ const fixedTimeItemsFromBase64 = (base64Str: string): FixedTimeItem[] => {
72
73
  endTime,
73
74
  onTime,
74
75
  offTime,
76
+ settingTime: new Date().getTime(),
75
77
  name: `FixedTime ${items.length}`,
76
78
  index: items.length
77
79
  });
@@ -36,6 +36,7 @@ const newFixedTimeItem = (): FixedTimeItem => {
36
36
  weeks: [0, 0, 0, 0, 0, 0, 0, 0],
37
37
  startTime: startTime,
38
38
  endTime: startTime + 60,
39
+ settingTime: new Date().getTime(),
39
40
  onTime: 1,
40
41
  offTime: 1
41
42
  }
@@ -100,7 +101,19 @@ const FixedTimeForPlugDetailPage = () => {
100
101
  const item = cloneDeep(state.item)
101
102
  item.onTime = parseTime(state.onHour, state.onMinute)
102
103
  item.offTime = parseTime(state.offHour, state.offMinute)
103
- await params.onPost(params.mode, item, true);
104
+ showDialog({
105
+ method: 'confirm',
106
+ title: I18n.getLang('conflict_dialog_active_item_fixedtimecycle_titel'),
107
+ subTitle: I18n.getLang('group_conflict_feature'),
108
+ confirmText: I18n.getLang('registration_dialog_button_yes'),
109
+ cancelText: I18n.getLang('registration_dialog_button_no'),
110
+ onConfirm: async (_, { close }) => {
111
+ state.loading = true
112
+ close()
113
+ await params.onPost(params.mode, item, true);
114
+ state.loading = false
115
+ }
116
+ })
104
117
  }
105
118
 
106
119
  const onDelete = () => {
@@ -3,7 +3,7 @@ import Card from "@ledvance/base/src/components/Card";
3
3
  import Spacer from "@ledvance/base/src/components/Spacer";
4
4
  import {StyleSheet, Text, View} from "react-native";
5
5
  import {SwitchButton, Utils} from "tuya-panel-kit";
6
- import {loopText} from "@ledvance/base/src/utils/common";
6
+ import {getIsClosed, loopText} from "@ledvance/base/src/utils/common";
7
7
  import {parseHour12} from "@tuya/tuya-panel-lamp-sdk/lib/utils";
8
8
  import {FixedTimeItem} from "./FixedTimeForPlugActon";
9
9
 
@@ -19,6 +19,8 @@ export interface ItemCardProps {
19
19
 
20
20
  const ItemCard = (props: ItemCardProps) => {
21
21
  const {item, is24Hour, onSwitch, onPress} = props
22
+ // 判断是否关闭
23
+ const closed = getIsClosed(item)
22
24
  return (
23
25
  <Card style={styles.itemCard} onPress={onPress}>
24
26
  <Spacer height={cx(16)}/>
@@ -32,11 +34,11 @@ const ItemCard = (props: ItemCardProps) => {
32
34
  </Text>
33
35
  <SwitchButton
34
36
  style={styles.switchBtn}
35
- value={item.enable}
37
+ value={item.enable && closed}
36
38
  thumbStyle={{elevation: 0}}
37
39
  onValueChange={onSwitch}/>
38
40
  </View>
39
- <Text style={styles.loopText}>{loopText(item.weeks, parseTimer(item.startTime * 60))}</Text>
41
+ <Text style={styles.loopText}>{loopText(item.weeks, parseTimer(item.endTime * 60))}</Text>
40
42
  <Spacer height={cx(5)}/>
41
43
  <Text style={styles.loopText}>{item.name}</Text>
42
44
  <Spacer/>
@@ -18,6 +18,7 @@ export interface FixedTimingItem {
18
18
  endTime: number
19
19
  openTime: number
20
20
  closeTime: number
21
+ settingTime: number
21
22
  color: {
22
23
  hue: number
23
24
  saturation: number
@@ -39,6 +39,7 @@ const newFixedTimingItem = (): FixedTimingItem => {
39
39
  weeks: [0, 0, 0, 0, 0, 0, 0],
40
40
  startTime: startTime,
41
41
  endTime: startTime + 60,
42
+ settingTime: new Date().getTime(),
42
43
  openTime: 1,
43
44
  closeTime: 1,
44
45
  color: {
@@ -123,11 +124,24 @@ const FixedTimingForLightDetailPage = () => {
123
124
  value: state.isColorMode ? state.item.color.value : 0,
124
125
  temperature: state.isColorMode ? 0 : state.item.color.temperature,
125
126
  brightness: state.isColorMode ? 0 : state.item.color.brightness
126
- }
127
+ },
128
+ settingTime: new Date().getTime()
127
129
  };
128
130
  item.openTime = parseTime(state.onHour, state.onMinute)
129
131
  item.closeTime = parseTime(state.offHour, state.offMinute)
130
- await params.onPost(params.mode, item, true);
132
+ showDialog({
133
+ method: 'confirm',
134
+ title: I18n.getLang('conflict_dialog_active_item_fixedtimecycle_titel'),
135
+ subTitle: I18n.getLang('group_conflict_feature'),
136
+ confirmText: I18n.getLang('registration_dialog_button_yes'),
137
+ cancelText: I18n.getLang('registration_dialog_button_no'),
138
+ onConfirm: async (_, { close }) => {
139
+ state.loading = true
140
+ close()
141
+ await params.onPost(params.mode, item, true);
142
+ state.loading = false
143
+ }
144
+ })
131
145
  }
132
146
 
133
147
  const onDelete = () => {
@@ -3,7 +3,7 @@ import Card from "@ledvance/base/src/components/Card";
3
3
  import Spacer from "@ledvance/base/src/components/Spacer";
4
4
  import {StyleSheet, Text, View} from "react-native";
5
5
  import {SwitchButton, Utils} from "tuya-panel-kit";
6
- import {loopText} from "@ledvance/base/src/utils/common";
6
+ import {getIsClosed, loopText} from "@ledvance/base/src/utils/common";
7
7
  import {parseHour12} from "@tuya/tuya-panel-lamp-sdk/lib/utils";
8
8
  import {FixedTimingItem} from "./FixedTimingForLightAction";
9
9
 
@@ -19,6 +19,8 @@ export interface ItemCardProps {
19
19
 
20
20
  const ItemCard = (props: ItemCardProps) => {
21
21
  const {item, is24Hour, onSwitch, onPress} = props
22
+ // 判断是否关闭
23
+ const closed = getIsClosed(item)
22
24
  return (
23
25
  <Card style={styles.itemCard} onPress={onPress}>
24
26
  <Spacer height={cx(16)}/>
@@ -32,11 +34,11 @@ const ItemCard = (props: ItemCardProps) => {
32
34
  </Text>
33
35
  <SwitchButton
34
36
  style={styles.switchBtn}
35
- value={item.power}
37
+ value={item.power && closed}
36
38
  thumbStyle={{elevation: 0}}
37
39
  onValueChange={onSwitch}/>
38
40
  </View>
39
- <Text style={styles.loopText}>{loopText(item.weeks, parseTimer(item.startTime * 60))}</Text>
41
+ <Text style={styles.loopText}>{loopText(item.weeks, parseTimer(item.endTime * 60))}</Text>
40
42
  <Spacer height={cx(5)}/>
41
43
  <Text style={styles.loopText}>{item.name}</Text>
42
44
  <Spacer/>
@@ -44,6 +44,7 @@ export const useDreamMusicData = (musicOption: MusicPageParams) => {
44
44
  dps[musicOption.musicDataDp] = v.phoneDpData
45
45
  }
46
46
  dps[musicOption.workModeDp] = WorkMode.Music
47
+ dps[musicOption.switchLedDp] = true
47
48
  }else{
48
49
  dps[musicOption.workModeDp] = v.lastWorkMode
49
50
  }
@@ -3,7 +3,7 @@ import Card from "@ledvance/base/src/components/Card";
3
3
  import Spacer from "@ledvance/base/src/components/Spacer";
4
4
  import {StyleSheet, Text, View} from "react-native";
5
5
  import {SwitchButton, Utils} from "tuya-panel-kit";
6
- import {loopText} from "@ledvance/base/src/utils/common";
6
+ import {getIsClosed, loopText} from "@ledvance/base/src/utils/common";
7
7
  import {parseHour12} from "@tuya/tuya-panel-lamp-sdk/lib/utils";
8
8
 
9
9
  const {convertX: cx} = Utils.RatioUtils
@@ -14,6 +14,7 @@ export interface ItemCardProps<T> {
14
14
  enable: boolean
15
15
  startTime: number
16
16
  endTime: number
17
+ settingTime: number
17
18
  weeks: number[]
18
19
  name?: string
19
20
  },
@@ -24,6 +25,8 @@ export interface ItemCardProps<T> {
24
25
 
25
26
  const ItemCard = <T, >(props: ItemCardProps<T>) => {
26
27
  const {item, is24Hour, onSwitch, onPress} = props
28
+ // 判断是否关闭
29
+ const closed = getIsClosed(item)
27
30
  return (
28
31
  <Card style={styles.itemCard} onPress={onPress}>
29
32
  <Spacer height={cx(16)}/>
@@ -37,11 +40,11 @@ const ItemCard = <T, >(props: ItemCardProps<T>) => {
37
40
  </Text>
38
41
  <SwitchButton
39
42
  style={styles.switchBtn}
40
- value={item.enable}
43
+ value={item.enable && closed}
41
44
  thumbStyle={{elevation: 0}}
42
45
  onValueChange={onSwitch}/>
43
46
  </View>
44
- <Text style={styles.loopText}>{loopText(item.weeks, parseTimer(item.startTime * 60))}</Text>
47
+ <Text style={styles.loopText}>{loopText(item.weeks, parseTimer(item.endTime * 60))}</Text>
45
48
  <Spacer height={cx(5)}/>
46
49
  <Text style={styles.loopText}>{item.name}</Text>
47
50
  <Spacer/>
@@ -22,6 +22,7 @@ export interface RandomTimeItem {
22
22
  weeks: number[]
23
23
  startTime: number
24
24
  endTime: number
25
+ settingTime: number
25
26
  name?: string
26
27
  index?: number
27
28
  }
@@ -65,6 +66,7 @@ const randomTimeItemsFromBase64 = (base64Str: string): RandomTimeItem[] => {
65
66
  weeks,
66
67
  startTime,
67
68
  endTime,
69
+ settingTime: new Date().getTime(),
68
70
  name: `RandomTime ${items.length}`,
69
71
  index: items.length
70
72
  });
@@ -35,6 +35,7 @@ const newRandomTimeItem = (): RandomTimeItem => {
35
35
  channel: 0,
36
36
  weeks: [0, 0, 0, 0, 0, 0, 0, 0],
37
37
  startTime: startTime,
38
+ settingTime: new Date().getTime(),
38
39
  endTime: startTime + 30
39
40
  }
40
41
  }
@@ -71,7 +72,22 @@ const RandomTimeForPlugDetailPage = () => {
71
72
  })
72
73
  return
73
74
  }
74
- await params.onPost(params.mode, cloneDeep(state.item), true);
75
+ showDialog({
76
+ method: 'confirm',
77
+ title: I18n.getLang('conflict_dialog_active_item_randomtimecycle_titel'),
78
+ subTitle: I18n.getLang('group_conflict_feature'),
79
+ confirmText: I18n.getLang('registration_dialog_button_yes'),
80
+ cancelText: I18n.getLang('registration_dialog_button_no'),
81
+ onConfirm: async (_, { close }) => {
82
+ state.loading = true
83
+ close()
84
+ await params.onPost(params.mode, cloneDeep({
85
+ ...state.item,
86
+ settingTime: new Date().getTime()
87
+ }), true);
88
+ state.loading = false
89
+ }
90
+ })
75
91
  }
76
92
 
77
93
  const onDelete = () => {
@@ -3,7 +3,7 @@ import Card from "@ledvance/base/src/components/Card";
3
3
  import Spacer from "@ledvance/base/src/components/Spacer";
4
4
  import {StyleSheet, Text, View} from "react-native";
5
5
  import {SwitchButton, Utils} from "tuya-panel-kit";
6
- import {loopText} from "@ledvance/base/src/utils/common";
6
+ import {getIsClosed, loopText} from "@ledvance/base/src/utils/common";
7
7
  import {parseHour12} from "@tuya/tuya-panel-lamp-sdk/lib/utils";
8
8
 
9
9
  const {convertX: cx} = Utils.RatioUtils
@@ -14,6 +14,7 @@ export interface ItemCardProps<T> {
14
14
  power: boolean
15
15
  startTime: number
16
16
  endTime: number
17
+ settingTime: number
17
18
  weeks: number[]
18
19
  name?: string
19
20
  },
@@ -24,6 +25,8 @@ export interface ItemCardProps<T> {
24
25
 
25
26
  const ItemCard = <T, >(props: ItemCardProps<T>) => {
26
27
  const {item, is24Hour, onSwitch, onPress} = props
28
+ // 判断是否关闭
29
+ const closed = getIsClosed(item)
27
30
  return (
28
31
  <Card style={styles.itemCard} onPress={onPress}>
29
32
  <Spacer height={cx(16)}/>
@@ -37,11 +40,11 @@ const ItemCard = <T, >(props: ItemCardProps<T>) => {
37
40
  </Text>
38
41
  <SwitchButton
39
42
  style={styles.switchBtn}
40
- value={item.power}
43
+ value={item.power && closed}
41
44
  thumbStyle={{elevation: 0}}
42
45
  onValueChange={onSwitch}/>
43
46
  </View>
44
- <Text style={styles.loopText}>{loopText(item.weeks, parseTimer(item.startTime * 60))}</Text>
47
+ <Text style={styles.loopText}>{loopText(item.weeks, parseTimer(item.endTime * 60))}</Text>
45
48
  <Spacer height={cx(5)}/>
46
49
  <Text style={styles.loopText}>{item.name}</Text>
47
50
  <Spacer/>
@@ -16,6 +16,7 @@ export interface RandomTimingItem {
16
16
  weeks: number[]
17
17
  startTime: number
18
18
  endTime: number
19
+ settingTime: number
19
20
  color: {
20
21
  hue: number
21
22
  saturation: number
@@ -38,6 +38,7 @@ const newRandomTimingItem = (): RandomTimingItem => {
38
38
  weeks: [0, 0, 0, 0, 0, 0, 0],
39
39
  startTime: startTime,
40
40
  endTime: startTime + 60,
41
+ settingTime: new Date().getTime(),
41
42
  color: {
42
43
  hue: 0,
43
44
  saturation: 100,
@@ -86,17 +87,30 @@ const RandomTimingForLightDetailPage = () => {
86
87
  })
87
88
  return
88
89
  }
89
- await params.onPost(params.mode, {
90
- ...state.item,
91
- power: true,
92
- color: {
93
- hue: state.isColorMode ? state.item.color.hue : 0,
94
- saturation: state.isColorMode ? state.item.color.saturation : 0,
95
- value: state.isColorMode ? state.item.color.value : 0,
96
- temperature: state.isColorMode ? 0 : state.item.color.temperature,
97
- brightness: state.isColorMode ? 0 : state.item.color.brightness
90
+ showDialog({
91
+ method: 'confirm',
92
+ title: I18n.getLang('conflict_dialog_active_item_randomtimecycle_titel'),
93
+ subTitle: I18n.getLang('group_conflict_feature'),
94
+ confirmText: I18n.getLang('registration_dialog_button_yes'),
95
+ cancelText: I18n.getLang('registration_dialog_button_no'),
96
+ onConfirm: async (_, { close }) => {
97
+ state.loading = true
98
+ close()
99
+ await params.onPost(params.mode, {
100
+ ...state.item,
101
+ power: true,
102
+ color: {
103
+ hue: state.isColorMode ? state.item.color.hue : 0,
104
+ saturation: state.isColorMode ? state.item.color.saturation : 0,
105
+ value: state.isColorMode ? state.item.color.value : 0,
106
+ temperature: state.isColorMode ? 0 : state.item.color.temperature,
107
+ brightness: state.isColorMode ? 0 : state.item.color.brightness
108
+ },
109
+ settingTime: new Date().getTime()
110
+ }, true);
111
+ state.loading = false
98
112
  }
99
- }, true);
113
+ })
100
114
  }
101
115
 
102
116
  const onDelete = () => {