@ledvance/base 1.1.92 → 1.1.93

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/base",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.1.92",
7
+ "version": "1.1.93",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@reduxjs/toolkit": "^1.8.6",
package/src/api/native.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import {NativeModules, Platform} from 'react-native'
2
2
  import {NativeResult, Result} from '../models/modules/Result'
3
-
3
+ import { TYSdk } from 'tuya-panel-kit'
4
4
  interface LDVDevicePanelManager {
5
5
  back: () => void
6
6
  control: (params: any, callback: (result: any) => void) => void
@@ -363,3 +363,25 @@ export const getMicrophoneAccess: () => Promise<boolean> = () => {
363
363
  })
364
364
  })
365
365
  }
366
+
367
+ export const getTuyaCloudData = (devId: string): Promise<Record<string, any>> => {
368
+ return new Promise((resolve, reject) => {
369
+ TYSdk.native.apiRNRequest(
370
+ {
371
+ a: 's.m.dev.property.get',
372
+ postData: {
373
+ devId: devId,
374
+ bizType: 0,
375
+ },
376
+ v: '2.0'
377
+ },
378
+ (d: string) => {
379
+ const data = typeof d === 'string' ? JSON.parse(d) : d;
380
+ resolve(data);
381
+ },
382
+ (err: string) => {
383
+ reject(err);
384
+ }
385
+ )
386
+ })
387
+ }
@@ -53,6 +53,9 @@ interface DrawToolViewProps extends PropsWithChildren<ViewProps> {
53
53
  hideLedNum?: boolean
54
54
  ledNum?: number
55
55
  setLedNum: (num: number) => void
56
+ hidLampAdjustView?: boolean
57
+ hideDisableLight?: boolean
58
+ hideColorize?: boolean
56
59
  }
57
60
 
58
61
  const DrawToolView = (props: DrawToolViewProps) => {
@@ -88,7 +91,7 @@ const DrawToolView = (props: DrawToolViewProps) => {
88
91
  }
89
92
  return '#ffffff'
90
93
  }, [props.isColorMode, props.h, props.s])
91
-
94
+
92
95
  return (
93
96
  <Card style={{ marginHorizontal: cx(24) }}>
94
97
  <LdvSwitch
@@ -97,109 +100,117 @@ const DrawToolView = (props: DrawToolViewProps) => {
97
100
  colorAlpha={1}
98
101
  enable={!!props.switchLed}
99
102
  showSwitch={!!props.showEnable}
100
- setEnable={props.setEnable}/>
103
+ setEnable={props.setEnable} />
101
104
  {(props.showEnable && props.switchLed || !props.showEnable) && <>
102
- <View style={styles.container}>
103
- <View style={styles.adjustButtons}>
104
- <TouchableOpacity
105
- onPress={() => {
106
- props.setAdjustType(1)
107
- }}>
108
- <Image
109
- style={[styles.adjustButton, { tintColor: props.adjustType === 1 ? '#f60' : '#666' }]}
110
- source={res.ic_paint_bucket}/>
111
- </TouchableOpacity>
112
- <TouchableOpacity
113
- onPress={() => {
114
- props.setAdjustType(3)
115
- }}>
116
- <Image
117
- style={[styles.adjustButton, { tintColor: props.adjustType === 3 ? '#f60' : '#666' }]}
118
- source={res.ic_disabled_light}/>
119
- </TouchableOpacity>
120
- <TouchableOpacity
121
- onPress={() => {
122
- props.setAdjustType(2)
123
- }}>
124
- <Image
125
- style={[styles.adjustButton, { tintColor: props.adjustType === 2 ? '#f60' : '#666' }]}
126
- source={res.ic_colorize}/>
127
- </TouchableOpacity>
128
- {!props.hideLedNum && <TouchableOpacity
129
- onPress={() => {
130
- state.visible = true
131
- }}
132
- style={[styles.adjustButton, {
133
- alignItems: 'center',
134
- justifyContent: 'center',
135
- backgroundColor: '#f60',
136
- borderRadius: cx(5),
137
- }]}>
138
- <Text style={{ color: '#fff', fontSize: cx(18), fontWeight: 'bold' }}>{props.ledNum || 5}</Text>
139
- </TouchableOpacity>}
140
- </View>
141
- <StripLightView
142
- style={{ height, flex: 1 }}
143
- nodes={props.nodes}
144
- fixCount={props.fixCount || 5}
145
- stripStyle={props.stripStyle || 'WITH_BEAD'}
146
- touchingMode={props.touchingMode || 'TOUCH'}
147
- width={state.width}
148
- onLayout={onLayout}/>
105
+ <View style={styles.container}>
106
+ <View style={styles.adjustButtons}>
107
+ <TouchableOpacity
108
+ onPress={() => {
109
+ props.setAdjustType(1)
110
+ }}>
111
+ <Image
112
+ style={[styles.adjustButton, { tintColor: props.adjustType === 1 ? '#f60' : '#666' }]}
113
+ source={res.ic_paint_bucket} />
114
+ </TouchableOpacity>
115
+ {!props.hideDisableLight && <TouchableOpacity
116
+ onPress={() => {
117
+ props.setAdjustType(3)
118
+ }}>
119
+ <Image
120
+ style={[styles.adjustButton, { tintColor: props.adjustType === 3 ? '#f60' : '#666' }]}
121
+ source={res.ic_disabled_light} />
122
+ </TouchableOpacity>}
123
+ {!props.hideColorize && <TouchableOpacity
124
+ onPress={() => {
125
+ props.setAdjustType(2)
126
+ }}>
127
+ <Image
128
+ style={[styles.adjustButton, { tintColor: props.adjustType === 2 ? '#f60' : '#666' }]}
129
+ source={res.ic_colorize} />
130
+ </TouchableOpacity>}
131
+ {!props.hideLedNum && <TouchableOpacity
132
+ onPress={() => {
133
+ state.visible = true
134
+ }}
135
+ style={[styles.adjustButton, {
136
+ alignItems: 'center',
137
+ justifyContent: 'center',
138
+ backgroundColor: '#f60',
139
+ borderRadius: cx(5),
140
+ }]}>
141
+ <Text style={{ color: '#fff', fontSize: cx(18), fontWeight: 'bold' }}>{props.ledNum || 5}</Text>
142
+ </TouchableOpacity>}
149
143
  </View>
150
- <LdvSwitch
151
- title={I18n.getLang('add_new_dynamic_mood_lights_field_headline2_text')}
152
- color={getBlockColor()}
153
- colorAlpha={1}
154
- enable={false}
155
- showSwitch={false}
156
- setEnable={() => {
157
- }}/>
158
- <LampAdjustView
159
- isSupportColor={!!props.isSupportColor}
160
- isSupportTemperature={!!props.isSupportTemperature}
161
- isSupportBrightness={!!props.isSupportBrightness}
162
- isColorMode={!!props.isColorMode}
163
- reserveSV={true}
164
- setIsColorMode={props.setIsColorMode}
165
- h={props.h} s={props.s} v={props.v}
166
- onHSVChange={props.onHSVChange}
167
- onHSVChangeComplete={props.onHSVChangeComplete}
168
- colorTemp={props.temperature}
169
- brightness={props.brightness}
170
- onCCTChange={props.onCCTChange}
171
- onCCTChangeComplete={props.onCCTChangeComplete}
172
- onBrightnessChange={props.onBrightnessChange}
173
- onBrightnessChangeComplete={props.onBrightnessChangeComplete}/>
144
+ <StripLightView
145
+ style={{ height, flex: 1 }}
146
+ nodes={props.nodes}
147
+ fixCount={props.fixCount || 5}
148
+ stripStyle={props.stripStyle || 'WITH_BEAD'}
149
+ touchingMode={props.touchingMode || 'TOUCH'}
150
+ width={state.width}
151
+ onLayout={onLayout} />
152
+ </View>
153
+ <LdvSwitch
154
+ title={I18n.getLang('add_new_dynamic_mood_lights_field_headline2_text')}
155
+ color={getBlockColor()}
156
+ colorAlpha={1}
157
+ enable={false}
158
+ showSwitch={false}
159
+ setEnable={() => {
160
+ }} />
161
+ {!props.hidLampAdjustView && <LampAdjustView
162
+ isSupportColor={!!props.isSupportColor}
163
+ isSupportTemperature={!!props.isSupportTemperature}
164
+ isSupportBrightness={!!props.isSupportBrightness}
165
+ isColorMode={!!props.isColorMode}
166
+ reserveSV={true}
167
+ setIsColorMode={props.setIsColorMode}
168
+ h={props.h} s={props.s} v={props.v}
169
+ onHSVChange={props.onHSVChange}
170
+ onHSVChangeComplete={props.onHSVChangeComplete}
171
+ colorTemp={props.temperature}
172
+ brightness={props.brightness}
173
+ onCCTChange={props.onCCTChange}
174
+ onCCTChangeComplete={props.onCCTChangeComplete}
175
+ onBrightnessChange={props.onBrightnessChange}
176
+ onBrightnessChangeComplete={props.onBrightnessChangeComplete} />}
174
177
  {!props.hideLedNum && <Modal
175
- visible={state.visible}
176
- onMaskPress={() => {
177
- state.visible = false
178
- }}
179
- alignContainer="center"
180
- style={{ width: '100%', height: cx(100) }}>
181
- <Card style={{ marginHorizontal: cx(24), marginTop: cx(50), alignItems: 'center' }}>
182
- <Spacer/>
183
- <Stepper
184
- min={5}
185
- max={48}
186
- stepValue={1}
187
- editable={true}
188
- value={state.ledNum}
189
- onValueChange={(v) => {
190
- state.ledNum = v
191
- }}/>
192
- <Spacer/>
193
- <DeleteButton
194
- text={I18n.getLang('auto_scan_system_wifi_confirm')}
195
- style={{ width: cx(150), height: cx(40), backgroundColor: '#f60' }}
196
- textStyle={{ fontSize: cx(14) }}
197
- onPress={() => {
198
- props.setLedNum(state.ledNum)
199
- state.visible = false
200
- }}/>
201
- <Spacer/>
202
- </Card>
178
+ visible={state.visible}
179
+ onMaskPress={() => {
180
+ state.visible = false
181
+ }}
182
+ alignContainer="center"
183
+ style={{ width: '100%', height: cx(150) }}>
184
+ <Card
185
+ containerStyle={{ marginHorizontal: cx(16), alignItems: 'center' }}
186
+ style={{ marginHorizontal: cx(16), marginTop: cx(50) }}>
187
+ <Spacer />
188
+ <Text style={{ color: '#000', fontSize: cx(14) }}>Please set the number of bulbs according to the actual number of bulbs in the lamp string</Text>
189
+ <Spacer height={cx(10)}/>
190
+ <Text style={{color: '#999'}}>Supports a maximum of 48 and a minumum of 5</Text>
191
+ <Spacer />
192
+ <Stepper
193
+ min={5}
194
+ max={48}
195
+ stepValue={1}
196
+ editable={true}
197
+ value={state.ledNum}
198
+ isRealTime={true}
199
+ onValueChange={(v) => {
200
+ state.ledNum = v
201
+ }} />
202
+ <Spacer />
203
+ <DeleteButton
204
+ text={I18n.getLang('auto_scan_system_wifi_confirm')}
205
+ style={{ width: cx(150), height: cx(40), backgroundColor: (state.ledNum < 5 || state.ledNum > 48) ? '#666' : '#f60' }}
206
+ textStyle={{ fontSize: cx(14) }}
207
+ onPress={() => {
208
+ if(state.ledNum < 5 || state.ledNum > 48) return
209
+ props.setLedNum(state.ledNum)
210
+ state.visible = false
211
+ }} />
212
+ <Spacer />
213
+ </Card>
203
214
  </Modal>}
204
215
  {props.children}
205
216
  </>}
@@ -16,6 +16,7 @@ export interface StepperProps {
16
16
  max?: number // 99
17
17
  editable?: boolean
18
18
  selectionColor?: string
19
+ isRealTime?: boolean
19
20
  onValueChange?: ((value: number) => void)
20
21
  disabled?: boolean
21
22
  style?: StyleProp<ViewStyle>
@@ -44,10 +45,17 @@ const Stepper = (props: StepperProps) => {
44
45
  if(newValue[0] === '.' ||
45
46
  (newValue.length === 2 && newValue[0] === '0' && newValue[1] !== '.') ||
46
47
  newValue.split('').filter(item => item === '.').length > 1 ||
47
- Number(newValue) > state.max || Number(newValue) < state.min ||
48
+ // Number(newValue) > state.max || Number(newValue) < state.min ||
48
49
  (idx !== -1 && newValue.length > idx + 2)){
49
50
  return
50
51
  }
52
+ if(props.isRealTime){
53
+ if (typeof v === 'string' && !v.length) {
54
+ props.onValueChange && props.onValueChange(0)
55
+ }else{
56
+ props.onValueChange && props.onValueChange(Number(exchangeNumber(v)))
57
+ }
58
+ }
51
59
  state.value = v
52
60
  }, [])
53
61
 
@@ -1,51 +0,0 @@
1
- @ColumnInfo(name = "device_id")
2
- val deviceId: String,
3
- @ColumnInfo(name = "device_name")
4
- val deviceName: String,
5
- @ColumnInfo(name = "cat_id")
6
- val catId: String,
7
- @ColumnInfo(name = "channel_no")
8
- val channelNo: Int,
9
- @ColumnInfo(name = "device_category")
10
- val deviceCategory: String,
11
- @ColumnInfo(name = "device_image")
12
- val deviceImage: String,
13
- @ColumnInfo(name = "tuya_device_id")
14
- val tuyaDeviceId: String,
15
- // deviceType 对应 ProductInfo 的 productId
16
- @ColumnInfo(name = "device_type")
17
- val deviceType: String,
18
- @ColumnInfo(name = "offline_time")
19
- val offlineTime: String,
20
- @ColumnInfo(name = "rn_package")
21
- val rnPackage: String?,
22
- @ColumnInfo(name = "status")
23
- val status: Int,
24
- @ColumnInfo(name = "create_time")
25
- val createTime: String,
26
- @ColumnInfo(name = "version")
27
- val version: String,
28
- @ColumnInfo(name = "user_id")
29
- val userId: String,
30
- @ColumnInfo(name = "family_id")
31
- val familyId: Long,
32
- @ColumnInfo(name = "room_id")
33
- val roomId: Long,
34
- @ColumnInfo(name = "room_name")
35
- val roomName: String,
36
- @ColumnInfo(name = "is_shared")
37
- val isShared: Int,
38
- @ColumnInfo(name = "local_index")
39
- val localIndex: String,
40
- @ColumnInfo(name = "resource_category")
41
- val resourceCategory: String,
42
- @ColumnInfo(name = "resource_id")
43
- val resourceId: String,
44
- @ColumnInfo(name = "resource_identifier")
45
- val resourceIdentifier: String,
46
- @ColumnInfo(name = "resource_type")
47
- val resourceType: Int,
48
- @ColumnInfo(name = "index")
49
- val index: Int = 0,
50
- @ColumnInfo(name = "switch_state")
51
- val switchState: Boolean = true