@ledvance/base 1.3.84 → 1.3.86
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 +29 -1
- package/package.json +1 -1
- package/src/components/BottomTabNavigator.tsx +151 -0
- package/src/components/Cell.tsx +4 -4
- package/src/i18n/strings.ts +784 -0
- package/src/utils/index.ts +52 -0
- package/translateKey.txt +29 -1
package/src/utils/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {Utils} from 'tuya-panel-kit'
|
|
|
3
3
|
import {store} from '../models'
|
|
4
4
|
import I18n from '../i18n/index'
|
|
5
5
|
import dayjs from "dayjs";
|
|
6
|
+
import { NativeApi } from 'api/native';
|
|
6
7
|
|
|
7
8
|
export const getFaultStrings = (faultCode: string, faultValue: number, onlyPrior = true) => {
|
|
8
9
|
const {devInfo} = store.getState()
|
|
@@ -247,3 +248,54 @@ export async function retryWithBackoff<T>(
|
|
|
247
248
|
|
|
248
249
|
return execute();
|
|
249
250
|
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* 将回调风格的函数转换为返回Promise的函数
|
|
254
|
+
* @param func 要转换的回调风格函数
|
|
255
|
+
* @param args 传递给函数的参数(不包括回调函数本身)
|
|
256
|
+
* @returns 返回一个Promise,当原函数的回调被调用时 resolve 或 reject
|
|
257
|
+
*/
|
|
258
|
+
export function callbackToPromise<T>(
|
|
259
|
+
func: (...args: any[]) => void,
|
|
260
|
+
...args: any[]
|
|
261
|
+
): Promise<T> {
|
|
262
|
+
return new Promise((resolve, reject) => {
|
|
263
|
+
try {
|
|
264
|
+
// 调用原函数,将参数和回调函数一起传递
|
|
265
|
+
func(...args, resolve, reject);
|
|
266
|
+
} catch (error) {
|
|
267
|
+
// 如果函数调用本身抛出错误,直接reject
|
|
268
|
+
reject(error);
|
|
269
|
+
}
|
|
270
|
+
})
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Enhanced log function that wraps console.log and NativeApi.log
|
|
276
|
+
* Supports all console.log features while ensuring NativeApi.log receives string parameters
|
|
277
|
+
* @param args - Arguments to log (same as console.log parameters)
|
|
278
|
+
*/
|
|
279
|
+
export function xLog(...args: any[]): void {
|
|
280
|
+
// Call the original console.log with all arguments
|
|
281
|
+
console.log(...args);
|
|
282
|
+
|
|
283
|
+
// Convert all arguments to a single string for NativeApi.log
|
|
284
|
+
// This preserves the formatting behavior similar to console.log
|
|
285
|
+
const formattedMessage = args.map(arg => {
|
|
286
|
+
// Handle objects and arrays by converting to JSON
|
|
287
|
+
if (typeof arg === 'object' && arg !== null) {
|
|
288
|
+
try {
|
|
289
|
+
return JSON.stringify(arg);
|
|
290
|
+
} catch (error) {
|
|
291
|
+
// Handle circular references or other serialization errors
|
|
292
|
+
return String(arg);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
// Handle other types directly
|
|
296
|
+
return String(arg);
|
|
297
|
+
}).join(' ');
|
|
298
|
+
|
|
299
|
+
// Call NativeApi.log with the formatted string
|
|
300
|
+
NativeApi.log(formattedMessage);
|
|
301
|
+
}
|
package/translateKey.txt
CHANGED
|
@@ -1197,4 +1197,32 @@ camera_motiondetection
|
|
|
1197
1197
|
camera_motiondetectiondescription
|
|
1198
1198
|
wifi_repeater_title
|
|
1199
1199
|
wifi_repeater_description
|
|
1200
|
-
wifi_repeater_group_tips
|
|
1200
|
+
wifi_repeater_group_tips
|
|
1201
|
+
repeater_ssid
|
|
1202
|
+
repeater_ssid_required
|
|
1203
|
+
login_textfield_headline_pw
|
|
1204
|
+
repeater_ssid_desc
|
|
1205
|
+
password_required
|
|
1206
|
+
repeater_change_wifi_tips
|
|
1207
|
+
repeater_schedule_error_limit
|
|
1208
|
+
repeater_schedule_error_common
|
|
1209
|
+
repeater_other_device
|
|
1210
|
+
internet_access
|
|
1211
|
+
repeater_no_device
|
|
1212
|
+
repeater_router_setting
|
|
1213
|
+
repeater_repeater_setting
|
|
1214
|
+
show_password
|
|
1215
|
+
manage_room_headline_devices
|
|
1216
|
+
repeater_quickly_config
|
|
1217
|
+
repeater_copy_router_info
|
|
1218
|
+
repeater_network_2_4g
|
|
1219
|
+
repeater_applying_title
|
|
1220
|
+
repeater_applying_content_1
|
|
1221
|
+
repeater_applying_content_2
|
|
1222
|
+
repeater_select_router
|
|
1223
|
+
repeater_current_router
|
|
1224
|
+
repeater_change_router_tips
|
|
1225
|
+
repeater_select_other_router
|
|
1226
|
+
repeater_password_error_length
|
|
1227
|
+
repeater_password_error_space
|
|
1228
|
+
cancel_dialog_leave_unsaved_repeater_note
|