@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 +1 -1
- package/src/api/native.ts +23 -1
- package/src/components/DrawToolView.tsx +112 -101
- package/src/components/Stepper.tsx +9 -1
- package/.temp/uaDevInfo.txt +0 -51
package/package.json
CHANGED
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
|
package/.temp/uaDevInfo.txt
DELETED
|
@@ -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
|