@ledvance/base 1.2.64 → 1.2.66
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/localazy.json +701 -700
- package/localazy.keys.json +3 -3
- package/package.json +1 -2
- package/src/api/native.ts +10 -0
- package/src/models/modules/NativePropsSlice.tsx +19 -0
package/localazy.keys.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"writeKey": "",
|
|
3
|
-
"readKey": "a7349213573288779040-d092b120e7d6d90c7e9528ddf2aa600659f60631bd4a5c2d55de0aa2b081af1b"
|
|
1
|
+
{
|
|
2
|
+
"writeKey": "",
|
|
3
|
+
"readKey": "a7349213573288779040-d092b120e7d6d90c7e9528ddf2aa600659f60631bd4a5c2d55de0aa2b081af1b"
|
|
4
4
|
}
|
package/package.json
CHANGED
package/src/api/native.ts
CHANGED
|
@@ -18,6 +18,7 @@ interface LDVDevicePanelManager {
|
|
|
18
18
|
getTimeZone: () => string
|
|
19
19
|
groupControl: (tyGroupId: number, dps: string, config: string) => Promise<NativeResult<any>>
|
|
20
20
|
groupControlToTuya: (tyGroupId: number, dps: string) => Promise<NativeResult<any>>
|
|
21
|
+
groupControlToEzviz: (tyGroupId: number, config: string) => Promise<NativeResult<any>>
|
|
21
22
|
getFeature: (deviceId: string, featureId: string, callback: (res: NativeResult<string>) => void) => void
|
|
22
23
|
putFeature: (deviceId: string, featureId: string, value: any, callback: (res: NativeResult<string>) => void) => void
|
|
23
24
|
getGroupDevices: (tyGroupId: number) => Promise<NativeResult<string>>
|
|
@@ -339,6 +340,15 @@ export class NativeApi {
|
|
|
339
340
|
}
|
|
340
341
|
}
|
|
341
342
|
|
|
343
|
+
static async putGroupEzvizConfig(tyGroupId: number, config: string){
|
|
344
|
+
const nativeResult = await devicePanel.groupControlToEzviz(tyGroupId, config)
|
|
345
|
+
return {
|
|
346
|
+
success: nativeResult.result,
|
|
347
|
+
msg: nativeResult.msg,
|
|
348
|
+
data: nativeResult.data,
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
342
352
|
}
|
|
343
353
|
|
|
344
354
|
// 打开下载文件
|
|
@@ -329,6 +329,25 @@ export function putGroupTYDps(tyGroupId: number, dps: Record<string, any>) {
|
|
|
329
329
|
return NativeApi.putGroupTYDps(tyGroupId, JSON.stringify(dps))
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
+
export function useGroupEzvizConfig<GC, T extends PropertyValueTypes<GC>>(featureKey: keyof GC, defConfig?: T): [T, (newConfig: T) => Promise<Result<any>>] {
|
|
333
|
+
const tyGroupId = useUAGroupInfo().tyGroupId
|
|
334
|
+
const config = useUAGroupInfo().config || {}
|
|
335
|
+
const dispatch = useDispatch()
|
|
336
|
+
const { setGroupConfig } = nativePropsSlice.actions
|
|
337
|
+
const setConfig = useCallback(async (newConfig: T) => {
|
|
338
|
+
const configs = {
|
|
339
|
+
[featureKey]: newConfig
|
|
340
|
+
}
|
|
341
|
+
const res = await NativeApi.putGroupEzvizConfig(tyGroupId, JSON.stringify(configs))
|
|
342
|
+
if (res.success) {
|
|
343
|
+
// 只在结果成功时才改变 redux 数据
|
|
344
|
+
dispatch(setGroupConfig(configs))
|
|
345
|
+
}
|
|
346
|
+
return res
|
|
347
|
+
}, [])
|
|
348
|
+
return [config[featureKey] ?? defConfig, setConfig]
|
|
349
|
+
}
|
|
350
|
+
|
|
332
351
|
export function useGroupConfig<T>(): [T, (dps: any, newConfig: T) => Promise<Result<any>>] {
|
|
333
352
|
const tyGroupId = useUAGroupInfo().tyGroupId
|
|
334
353
|
const config = useUAGroupInfo().config || {}
|