@ledvance/base 1.0.25 → 1.0.27

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.0.25",
7
+ "version": "1.0.27",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@reduxjs/toolkit": "^1.8.6",
@@ -17,3 +17,4 @@ export declare class NativeApi {
17
17
  static putJson(deviceId: string, featureType: string, json: string): Promise<Result<any>>;
18
18
  static getJson(deviceId: string, featureType: string): Promise<Result<string>>;
19
19
  }
20
+ export declare const queryDpIds: (dpIds: string, deviceId: string) => Promise<unknown>;
package/src/api/native.ts CHANGED
@@ -1,5 +1,5 @@
1
- import {NativeModules} from 'react-native'
2
- import {NativeResult, Result} from '../models/modules/Result'
1
+ import { NativeModules } from 'react-native'
2
+ import { NativeResult, Result } from '../models/modules/Result'
3
3
 
4
4
  interface LDVDevicePanelManager {
5
5
  back: () => void
@@ -11,6 +11,7 @@ interface LDVDevicePanelManager {
11
11
  toDeviceSettingsPage: (deviceId: string) => void
12
12
  putJson: (deviceId: string, featureType: string, json: string, callback: (res: NativeResult<any>) => void) => void
13
13
  getJson: (deviceId: string, featureType: string, callback: (res: NativeResult<string>) => void) => void
14
+ getInitiativeQueryDpsInfoWithDpsArray: (dpIds: string, deviceId: string, callback: (res: NativeResult<string>) => void) => void
14
15
  }
15
16
 
16
17
  const devicePanel: LDVDevicePanelManager = NativeModules.LDVDevicePanelManager
@@ -31,7 +32,7 @@ const showObj = (objc) => {
31
32
  }
32
33
 
33
34
  const control = (devId, dps, callback) => {
34
- devicePanel.control({devId, dps: JSON.stringify(dps)}, res => {
35
+ devicePanel.control({ devId, dps: JSON.stringify(dps) }, res => {
35
36
  callback && callback(res)
36
37
  })
37
38
  }
@@ -41,7 +42,7 @@ const TASK = 'LDV_TY'
41
42
 
42
43
  const timerList = devId => {
43
44
  return new Promise((resolve, _reject) => {
44
- const params = {devId, task: TASK, action: 'list', bizType: 0}
45
+ const params = { devId, task: TASK, action: 'list', bizType: 0 }
45
46
  devicePanel.setTimer(params, res => {
46
47
  resolve(res)
47
48
  })
@@ -49,21 +50,21 @@ const timerList = devId => {
49
50
  }
50
51
 
51
52
  const addTimer = (devId, value, callback: any = undefined) => {
52
- const params = {devId, task: TASK, action: 'add', value, bizType: 0}
53
+ const params = { devId, task: TASK, action: 'add', value, bizType: 0 }
53
54
  devicePanel.setTimer(params, res => {
54
55
  callback && callback(res)
55
56
  })
56
57
  }
57
58
 
58
59
  const editTimer = (devId, value, callback: any = undefined) => {
59
- const params = {devId, task: TASK, action: 'update', value, bizType: 0}
60
+ const params = { devId, task: TASK, action: 'update', value, bizType: 0 }
60
61
  devicePanel.setTimer(params, res => {
61
62
  callback && callback(res)
62
63
  })
63
64
  }
64
65
 
65
66
  const deleteTimer = (devId, value, callback: any = undefined) => {
66
- const params = {devId, task: TASK, action: 'delete', value, bizType: 0}
67
+ const params = { devId, task: TASK, action: 'delete', value, bizType: 0 }
67
68
  devicePanel.setTimer(params, res => {
68
69
  callback && callback(res)
69
70
  })
@@ -81,7 +82,7 @@ function getAllTaskTimer(devId: string, type: number = 0, callback: ((res: Nativ
81
82
 
82
83
  const setDp = <T>(deviceId: string, key: string, value: any) => {
83
84
  return new Promise<NativeResult<T>>((resolve, _reject) => {
84
- control(deviceId, {[key]: value}, res => {
85
+ control(deviceId, { [key]: value }, res => {
85
86
  resolve(res)
86
87
  })
87
88
  })
@@ -207,4 +208,12 @@ export class NativeApi {
207
208
  })
208
209
  })
209
210
  }
211
+ }
212
+
213
+ export const queryDpIds = (dpIds: string, deviceId: string) => {
214
+ return new Promise((resolve, _reject) => {
215
+ devicePanel.getInitiativeQueryDpsInfoWithDpsArray(dpIds, deviceId, res => {
216
+ resolve(res)
217
+ })
218
+ })
210
219
  }
@@ -2,7 +2,7 @@ interface TopBarProps {
2
2
  title: string;
3
3
  onBackPress: () => void;
4
4
  rightButtonIcon?: any | {};
5
- rightButtonStyle?: any | undefined;
5
+ rightButtonStyle?: any | undefined | number;
6
6
  onRightButtonPress?: (() => void) | undefined;
7
7
  }
8
8
  declare const LDVTopBar: (props: TopBarProps) => JSX.Element;
@@ -10,11 +10,12 @@ interface TopBarProps {
10
10
  title: string,
11
11
  onBackPress: () => void,
12
12
  rightButtonIcon?: any | {},
13
- rightButtonStyle?: any | undefined,
13
+ rightButtonStyle?: any | undefined | number,
14
14
  onRightButtonPress?: (() => void) | undefined,
15
15
  }
16
16
 
17
17
  const LDVTopBar = (props: TopBarProps) => {
18
+ const icon = typeof props.rightButtonIcon === 'number' ? props.rightButtonIcon : { uri: props.rightButtonIcon }
18
19
  return (
19
20
  <View
20
21
  style={{
@@ -52,7 +53,7 @@ const LDVTopBar = (props: TopBarProps) => {
52
53
  { width: cx(28), height: cx(28) },
53
54
  props.rightButtonStyle,
54
55
  ]}
55
- source={{ uri: props.rightButtonIcon }} />
56
+ source={icon} />
56
57
  </View>
57
58
  </TouchableOpacity>
58
59
  }
@@ -1,6 +1,6 @@
1
1
  interface LdvTopNameProps {
2
2
  title: string;
3
- rightIcon?: string | undefined;
3
+ rightIcon?: string | undefined | number;
4
4
  rightIconClick?: () => void;
5
5
  }
6
6
  declare const LdvTopName: (props: LdvTopNameProps) => JSX.Element;
@@ -6,11 +6,12 @@ const cx = Utils.RatioUtils.convertX
6
6
 
7
7
  interface LdvTopNameProps {
8
8
  title: string,
9
- rightIcon?: string | undefined,
9
+ rightIcon?: string | undefined | number,
10
10
  rightIconClick?: () => void
11
11
  }
12
12
 
13
13
  const LdvTopName = (props: LdvTopNameProps) => {
14
+ const icon = typeof props.rightIcon === 'number' ? props.rightIcon : { uri: props.rightIcon }
14
15
  return (
15
16
  <View style={styles.container}>
16
17
  <View
@@ -25,7 +26,7 @@ const LdvTopName = (props: LdvTopNameProps) => {
25
26
  onPress={props.rightIconClick}>
26
27
  <Image
27
28
  style={{ width: cx(24), height: cx(24), tintColor: '#ff6600' }}
28
- source={{ uri: props.rightIcon }} />
29
+ source={icon} />
29
30
  </TouchableOpacity>}
30
31
  </View>
31
32
  </View>