@ledvance/base 1.3.102 → 1.3.104
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 +9 -1
- package/package.json +1 -1
- package/src/components/AdvanceCard.tsx +13 -5
- package/src/components/AdvanceList.tsx +16 -8
- package/src/components/Marquee.tsx +99 -0
- package/src/composeLayout.tsx +7 -3
- package/src/i18n/strings.ts +412 -172
- package/src/models/TuyaApi.ts +60 -43
- package/src/models/modules/NativePropsSlice.tsx +14 -3
- package/translateKey.txt +9 -1
package/src/models/TuyaApi.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {commonApi} from '@tuya/tuya-panel-api'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { commonApi } from '@tuya/tuya-panel-api'
|
|
2
|
+
import {
|
|
3
|
+
Dp,
|
|
4
|
+
IGetDpResultByHourResponse,
|
|
5
|
+
IGetDpResultByMonthResponse,
|
|
6
|
+
IGetLogInSpecifiedTimeResponse
|
|
7
|
+
} from '@tuya/tuya-panel-api/lib/common/interface'
|
|
8
|
+
import { retryWithBackoff } from '@utils'
|
|
9
|
+
import { TYSdk } from 'tuya-panel-kit'
|
|
10
|
+
import { sendAppEvent } from '../api/native'
|
|
6
11
|
|
|
7
12
|
export interface PagingResult<T> {
|
|
8
13
|
data: T
|
|
@@ -69,23 +74,25 @@ export async function getDpResultByMonth(
|
|
|
69
74
|
dpId,
|
|
70
75
|
type,
|
|
71
76
|
}
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
return await retryWithBackoff(
|
|
78
|
+
() => commonApi.statApi.getDpResultByMonth(params),
|
|
79
|
+
{
|
|
80
|
+
// 自定义判断哪些错误需要重试
|
|
81
|
+
shouldRetry: (error) => {
|
|
82
|
+
if (error.errorCode === 'DPID_NOT_SUPPORT_STATISTICS_ERROR') {
|
|
83
|
+
sendAppEvent('RN_ERROR', { message: `code: ${error.errorCode}, deviceId: ${devId}` })
|
|
84
|
+
}
|
|
85
|
+
// 网络错误、超时错误或服务器错误(5xx)通常需要重试
|
|
86
|
+
const isNetworkError = error.name === 'NetworkError' ||
|
|
87
|
+
error.name === 'TimeoutError' ||
|
|
88
|
+
error.errorCode === '103';
|
|
74
89
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return res;
|
|
79
|
-
} catch (err) {
|
|
80
|
-
if (err.errorCode === 'DPID_NOT_SUPPORT_STATISTICS_ERROR') {
|
|
81
|
-
sendAppEvent('RN_ERROR', { message: `code: ${err.errorCode}, deviceId: ${devId}` })
|
|
82
|
-
}
|
|
83
|
-
retry++;
|
|
84
|
-
if (retry > maxRetries) {
|
|
85
|
-
return undefined;
|
|
90
|
+
// 对于特定的业务错误码也可以在这里添加判断
|
|
91
|
+
const isFrequencyError = error.errorCode === 'FREQUENCY_LIMIT_ERROR';
|
|
92
|
+
return isNetworkError || isFrequencyError;
|
|
86
93
|
}
|
|
87
94
|
}
|
|
88
|
-
|
|
95
|
+
);
|
|
89
96
|
}
|
|
90
97
|
|
|
91
98
|
export interface DpResultByDataWithSpecifiedResData {
|
|
@@ -107,20 +114,25 @@ export async function getDataWithSpecified(
|
|
|
107
114
|
endDay,
|
|
108
115
|
type,
|
|
109
116
|
}
|
|
110
|
-
|
|
111
|
-
|
|
117
|
+
return await retryWithBackoff(
|
|
118
|
+
() => commonApi.statApi.getDataWithSpecified(params),
|
|
119
|
+
{
|
|
120
|
+
// 自定义判断哪些错误需要重试
|
|
121
|
+
shouldRetry: (error) => {
|
|
122
|
+
if (error.errorCode === 'DPID_NOT_SUPPORT_STATISTICS_ERROR') {
|
|
123
|
+
sendAppEvent('RN_ERROR', { message: `code: ${error.errorCode}, deviceId: ${devId}` })
|
|
124
|
+
}
|
|
125
|
+
// 网络错误、超时错误或服务器错误(5xx)通常需要重试
|
|
126
|
+
const isNetworkError = error.name === 'NetworkError' ||
|
|
127
|
+
error.name === 'TimeoutError' ||
|
|
128
|
+
error.errorCode === '103';
|
|
112
129
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return res;
|
|
117
|
-
} catch (err) {
|
|
118
|
-
retry++;
|
|
119
|
-
if (retry > maxRetries) {
|
|
120
|
-
return undefined;
|
|
130
|
+
// 对于特定的业务错误码也可以在这里添加判断
|
|
131
|
+
const isFrequencyError = error.errorCode === 'FREQUENCY_LIMIT_ERROR';
|
|
132
|
+
return isNetworkError || isFrequencyError;
|
|
121
133
|
}
|
|
122
134
|
}
|
|
123
|
-
|
|
135
|
+
);
|
|
124
136
|
}
|
|
125
137
|
|
|
126
138
|
export async function getDpResultByHour(
|
|
@@ -135,20 +147,25 @@ export async function getDpResultByHour(
|
|
|
135
147
|
date,
|
|
136
148
|
type,
|
|
137
149
|
}
|
|
138
|
-
|
|
139
|
-
|
|
150
|
+
return await retryWithBackoff(
|
|
151
|
+
() => commonApi.statApi.getDpResultByHour(params),
|
|
152
|
+
{
|
|
153
|
+
// 自定义判断哪些错误需要重试
|
|
154
|
+
shouldRetry: (error) => {
|
|
155
|
+
if (error.errorCode === 'DPID_NOT_SUPPORT_STATISTICS_ERROR') {
|
|
156
|
+
sendAppEvent('RN_ERROR', { message: `code: ${error.errorCode}, deviceId: ${devId}` })
|
|
157
|
+
}
|
|
158
|
+
// 网络错误、超时错误或服务器错误(5xx)通常需要重试
|
|
159
|
+
const isNetworkError = error.name === 'NetworkError' ||
|
|
160
|
+
error.name === 'TimeoutError' ||
|
|
161
|
+
error.errorCode === '103';
|
|
140
162
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return res;
|
|
145
|
-
} catch (err) {
|
|
146
|
-
retry++;
|
|
147
|
-
if (retry > maxRetries) {
|
|
148
|
-
return undefined;
|
|
163
|
+
// 对于特定的业务错误码也可以在这里添加判断
|
|
164
|
+
const isFrequencyError = error.errorCode === 'FREQUENCY_LIMIT_ERROR';
|
|
165
|
+
return isNetworkError || isFrequencyError;
|
|
149
166
|
}
|
|
150
167
|
}
|
|
151
|
-
|
|
168
|
+
);
|
|
152
169
|
}
|
|
153
170
|
|
|
154
171
|
/**
|
|
@@ -194,7 +211,7 @@ export async function getAllDpReportLogs(
|
|
|
194
211
|
// 网络错误、超时错误或服务器错误(5xx)通常需要重试
|
|
195
212
|
const isNetworkError = error.name === 'NetworkError' ||
|
|
196
213
|
error.name === 'TimeoutError' ||
|
|
197
|
-
|
|
214
|
+
error.errorCode === '103';
|
|
198
215
|
|
|
199
216
|
// 对于特定的业务错误码也可以在这里添加判断
|
|
200
217
|
return isNetworkError;
|
|
@@ -256,7 +273,7 @@ export async function getSpecifiedTimeDpReportLogs(
|
|
|
256
273
|
// 网络错误、超时错误或服务器错误(5xx)通常需要重试
|
|
257
274
|
const isNetworkError = error.name === 'NetworkError' ||
|
|
258
275
|
error.name === 'TimeoutError' ||
|
|
259
|
-
|
|
276
|
+
error.errorCode === '103';
|
|
260
277
|
|
|
261
278
|
// 对于特定的业务错误码也可以在这里添加判断
|
|
262
279
|
return isNetworkError;
|
|
@@ -25,6 +25,7 @@ export interface NativeProps {
|
|
|
25
25
|
timeZone: string
|
|
26
26
|
gestureControlValues: GestureControlType
|
|
27
27
|
newPalette?: boolean
|
|
28
|
+
isPad?: boolean
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
interface FlagModeState {
|
|
@@ -89,7 +90,8 @@ const initialState: NativeProps = {
|
|
|
89
90
|
gestureControlValues: {
|
|
90
91
|
isEnd: false
|
|
91
92
|
},
|
|
92
|
-
newPalette: false
|
|
93
|
+
newPalette: false,
|
|
94
|
+
isPad: false
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
// energy generation
|
|
@@ -193,7 +195,10 @@ const nativePropsSlice = createSlice({
|
|
|
193
195
|
},
|
|
194
196
|
setNewPalette(state, action: PayloadAction<boolean>) {
|
|
195
197
|
state.newPalette = action.payload
|
|
196
|
-
}
|
|
198
|
+
},
|
|
199
|
+
setIsPad(state, action: PayloadAction<boolean>) {
|
|
200
|
+
state.isPad = action.payload
|
|
201
|
+
},
|
|
197
202
|
},
|
|
198
203
|
})
|
|
199
204
|
|
|
@@ -488,6 +493,10 @@ const useNewPalette = () => {
|
|
|
488
493
|
return useSelector(store => store.ldvModules.newPalette)
|
|
489
494
|
}
|
|
490
495
|
|
|
496
|
+
const useIsPad = () => {
|
|
497
|
+
return useSelector(store => store.ldvModules.isPad)
|
|
498
|
+
}
|
|
499
|
+
|
|
491
500
|
export const useFanMaxSpeed = () => {
|
|
492
501
|
const { productId } = useDeviceInfo()
|
|
493
502
|
return fanProductList.includes(productId) ? 20 : 3
|
|
@@ -515,6 +524,7 @@ export const {
|
|
|
515
524
|
setEnergieverbrauch,
|
|
516
525
|
setGestureControlValues,
|
|
517
526
|
setNewPalette,
|
|
527
|
+
setIsPad,
|
|
518
528
|
} = nativePropsSlice.actions
|
|
519
529
|
|
|
520
530
|
export {
|
|
@@ -542,5 +552,6 @@ export {
|
|
|
542
552
|
useEnergieverbrauch,
|
|
543
553
|
useGestureControl,
|
|
544
554
|
useDeviceCategory,
|
|
545
|
-
useNewPalette
|
|
555
|
+
useNewPalette,
|
|
556
|
+
useIsPad,
|
|
546
557
|
}
|
package/translateKey.txt
CHANGED
|
@@ -1285,4 +1285,12 @@ infobutton_fixedtimecycle
|
|
|
1285
1285
|
infobutton_randomtimecycle
|
|
1286
1286
|
infobutton_timer
|
|
1287
1287
|
infobutton_poweronbehavior
|
|
1288
|
-
infobutton_history
|
|
1288
|
+
infobutton_history
|
|
1289
|
+
country_JO
|
|
1290
|
+
country_CV
|
|
1291
|
+
country_PA
|
|
1292
|
+
country_northern_ireland
|
|
1293
|
+
country_wales
|
|
1294
|
+
country_BA
|
|
1295
|
+
country_north_macedonia
|
|
1296
|
+
country_werder_bremen
|