@ledvance/base 1.0.27 → 1.0.29
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/.prettierrc.js +0 -0
- package/package.json +2 -1
- package/src/api/native.ts +21 -5
- package/src/i18n/strings.ts +10472 -10080
- package/src/models/TuyaApi.ts +56 -0
- package/src/models/modules/NativePropsSlice.tsx +11 -1
- package/src/utils/common.ts +152 -2
package/.prettierrc.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "@ledvance/base",
|
|
5
5
|
"pid": [],
|
|
6
6
|
"uiid": "",
|
|
7
|
-
"version": "1.0.
|
|
7
|
+
"version": "1.0.29",
|
|
8
8
|
"scripts": {},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@reduxjs/toolkit": "^1.8.6",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"redux-logger": "^3.0.6",
|
|
28
28
|
"redux-observable": "^1.0.0",
|
|
29
29
|
"redux-thunk": "^2.3.0",
|
|
30
|
+
"rn-fetch-blob": "^0.12.0",
|
|
30
31
|
"rxjs": "^6.3.1",
|
|
31
32
|
"rxjs-compat": "^6.3.1",
|
|
32
33
|
"style-equal": "^1.0.0",
|
package/src/api/native.ts
CHANGED
|
@@ -12,6 +12,8 @@ interface LDVDevicePanelManager {
|
|
|
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
14
|
getInitiativeQueryDpsInfoWithDpsArray: (dpIds: string, deviceId: string, callback: (res: NativeResult<string>) => void) => void
|
|
15
|
+
openDownloadFile: (filePath: string) => void
|
|
16
|
+
formatNumber: (num: number, fixed: number) => string
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
const devicePanel: LDVDevicePanelManager = NativeModules.LDVDevicePanelManager
|
|
@@ -210,10 +212,24 @@ export class NativeApi {
|
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
214
|
|
|
213
|
-
|
|
215
|
+
|
|
216
|
+
// 打开下载文件
|
|
217
|
+
export const openDownloadFile = (filePath: string) => {
|
|
218
|
+
return new Promise((_reject) => {
|
|
219
|
+
devicePanel.openDownloadFile(filePath)
|
|
220
|
+
})
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export const queryDpIds = (dpIds: string, deviceId: string) => {
|
|
214
224
|
return new Promise((resolve, _reject) => {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
225
|
+
devicePanel.getInitiativeQueryDpsInfoWithDpsArray(dpIds, deviceId, res => {
|
|
226
|
+
resolve(res)
|
|
227
|
+
})
|
|
218
228
|
})
|
|
219
|
-
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export const formatNumber: (num: number, fixed: number) => string = (num, fixed) => {
|
|
232
|
+
const res = devicePanel.formatNumber(num, fixed)
|
|
233
|
+
log(`formatNumber: num=${num}, fixed=${fixed}, res=${res}`)
|
|
234
|
+
return res
|
|
235
|
+
}
|