@ledvance/base 1.2.58 → 1.2.60
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 +697 -0
- package/localazy.keys.json +4 -0
- package/package.json +4 -2
- package/src/api/native.ts +18 -2
- package/src/composeLayout.tsx +8 -3
- package/src/i18n/strings.ts +19488 -19401
- package/src/models/modules/NativePropsSlice.tsx +18 -3
- package/src/utils/index.ts +6 -1
- package/src/utils/interface.ts +6 -1
- package/update-localazy.py +52 -0
package/package.json
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
"name": "@ledvance/base",
|
|
5
5
|
"pid": [],
|
|
6
6
|
"uiid": "",
|
|
7
|
-
"version": "1.2.
|
|
8
|
-
"scripts": {
|
|
7
|
+
"version": "1.2.60",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"prepublishOnly": "python update-localazy.py"
|
|
10
|
+
},
|
|
9
11
|
"dependencies": {
|
|
10
12
|
"@reduxjs/toolkit": "^1.8.6",
|
|
11
13
|
"@tuya/tuya-panel-api": "^1.12.0",
|
package/src/api/native.ts
CHANGED
|
@@ -250,6 +250,19 @@ export class NativeApi {
|
|
|
250
250
|
deleteTimer(deviceId, value, callback)
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
static manageTimer(devId: string, timer: any, mode: 'add' | 'delete' | 'update'){
|
|
254
|
+
return new Promise<Result<any>>((resolve) =>{
|
|
255
|
+
const params = {devId, task: TASK, action: mode, value: timer, bizType: 0}
|
|
256
|
+
devicePanel.setTimer(params, res => {
|
|
257
|
+
resolve({
|
|
258
|
+
success: res.result,
|
|
259
|
+
data: res.data,
|
|
260
|
+
msg: res.msg
|
|
261
|
+
})
|
|
262
|
+
})
|
|
263
|
+
})
|
|
264
|
+
}
|
|
265
|
+
|
|
253
266
|
static setDp<T>(deviceId: string, key: string, value: any): Promise<NativeResult<T>> {
|
|
254
267
|
return setDp<T>(deviceId, key, value)
|
|
255
268
|
}
|
|
@@ -339,8 +352,11 @@ export const formatNumber: (num: number, fixed: number, shoGroup?: boolean) => s
|
|
|
339
352
|
return res
|
|
340
353
|
}
|
|
341
354
|
|
|
342
|
-
export const getTimeZone
|
|
343
|
-
return
|
|
355
|
+
export const getTimeZone = async (): Promise<string> => {
|
|
356
|
+
return new Promise((resolve) => {
|
|
357
|
+
const timeZone = Platform.OS === 'android' ? devicePanel.getTimeZone() || 'Europe/Berlin' : Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
358
|
+
resolve(timeZone)
|
|
359
|
+
})
|
|
344
360
|
}
|
|
345
361
|
|
|
346
362
|
// 获取手机系统设置的12小时制还是24小时制
|
package/src/composeLayout.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { Provider } from 'react-redux'
|
|
|
4
4
|
import { DevInfo, DpValue, Theme, TYSdk } from 'tuya-panel-kit'
|
|
5
5
|
import { actions, store } from './models'
|
|
6
6
|
import { addListener, removeListener } from 'api/nativeEventEmitter'
|
|
7
|
-
import {
|
|
7
|
+
import {getSystemTimeFormat, getTimeZone, NativeApi} from 'api/native'
|
|
8
8
|
import {
|
|
9
9
|
DeviceInfo,
|
|
10
10
|
NativeProps,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
setGroupNativeProps,
|
|
13
13
|
setNativeProps,
|
|
14
14
|
setSystemTimeFormat,
|
|
15
|
+
setTimeZone,
|
|
15
16
|
UAGroupInfo,
|
|
16
17
|
} from './models/modules/NativePropsSlice'
|
|
17
18
|
import { DpSchema, GlobalParams } from './models/GlobalParams'
|
|
@@ -121,6 +122,10 @@ const composeLayout = (component: React.ComponentType) => {
|
|
|
121
122
|
getSystemTimeFormat().then(time => {
|
|
122
123
|
dispatch(setSystemTimeFormat(time === 24))
|
|
123
124
|
})
|
|
125
|
+
|
|
126
|
+
getTimeZone().then(timeZone => {
|
|
127
|
+
dispatch(setTimeZone(timeZone))
|
|
128
|
+
})
|
|
124
129
|
}
|
|
125
130
|
|
|
126
131
|
initReduxDeviceNativeProps(ldvDevInfo: LdvDevInfo) {
|
|
@@ -182,7 +187,7 @@ const composeLayout = (component: React.ComponentType) => {
|
|
|
182
187
|
}
|
|
183
188
|
|
|
184
189
|
async initGroupDevices(tyGroupId: number){
|
|
185
|
-
if(!tyGroupId) return
|
|
190
|
+
if(!tyGroupId) return
|
|
186
191
|
const res = await NativeApi.getGroupDevices(tyGroupId)
|
|
187
192
|
if(res.success && Array.isArray(res.data)){
|
|
188
193
|
dispatch(setGroupDevices(res.data))
|
|
@@ -231,4 +236,4 @@ const composeLayout = (component: React.ComponentType) => {
|
|
|
231
236
|
}
|
|
232
237
|
|
|
233
238
|
|
|
234
|
-
export default composeLayout
|
|
239
|
+
export default composeLayout
|