@ledvance/base 1.2.62 → 1.2.64
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 +700 -697
- package/localazy.keys.json +3 -3
- package/package.json +4 -1
- package/src/api/native.ts +10 -0
- package/src/api/nativeEventEmitter.ts +8 -10
- package/src/components/Summary.tsx +124 -0
- package/src/i18n/strings.ts +139 -52
- package/src/models/modules/NativePropsSlice.tsx +4 -0
- package/src/utils/common.ts +36 -0
package/localazy.keys.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"writeKey": "",
|
|
3
|
-
"readKey": "a7349213573288779040-d092b120e7d6d90c7e9528ddf2aa600659f60631bd4a5c2d55de0aa2b081af1b"
|
|
1
|
+
{
|
|
2
|
+
"writeKey": "",
|
|
3
|
+
"readKey": "a7349213573288779040-d092b120e7d6d90c7e9528ddf2aa600659f60631bd4a5c2d55de0aa2b081af1b"
|
|
4
4
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
"name": "@ledvance/base",
|
|
5
5
|
"pid": [],
|
|
6
6
|
"uiid": "",
|
|
7
|
-
"version": "1.2.
|
|
7
|
+
"version": "1.2.64",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"prepublishOnly": "python update-localazy.py"
|
|
10
|
+
},
|
|
8
11
|
"dependencies": {
|
|
9
12
|
"@reduxjs/toolkit": "^1.8.6",
|
|
10
13
|
"@tuya/tuya-panel-api": "^1.12.0",
|
package/src/api/native.ts
CHANGED
|
@@ -17,6 +17,7 @@ interface LDVDevicePanelManager {
|
|
|
17
17
|
formatNumber: (num: number, fixed: number, isCN: boolean) => string
|
|
18
18
|
getTimeZone: () => string
|
|
19
19
|
groupControl: (tyGroupId: number, dps: string, config: string) => Promise<NativeResult<any>>
|
|
20
|
+
groupControlToTuya: (tyGroupId: number, dps: string) => Promise<NativeResult<any>>
|
|
20
21
|
getFeature: (deviceId: string, featureId: string, callback: (res: NativeResult<string>) => void) => void
|
|
21
22
|
putFeature: (deviceId: string, featureId: string, value: any, callback: (res: NativeResult<string>) => void) => void
|
|
22
23
|
getGroupDevices: (tyGroupId: number) => Promise<NativeResult<string>>
|
|
@@ -329,6 +330,15 @@ export class NativeApi {
|
|
|
329
330
|
}
|
|
330
331
|
}
|
|
331
332
|
|
|
333
|
+
static async putGroupTYDps(tyGroupId: number, dps: string){
|
|
334
|
+
const nativeResult = await devicePanel.groupControlToTuya(tyGroupId, dps)
|
|
335
|
+
return {
|
|
336
|
+
success: nativeResult.result,
|
|
337
|
+
msg: nativeResult.msg,
|
|
338
|
+
data: nativeResult.data,
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
332
342
|
}
|
|
333
343
|
|
|
334
344
|
// 打开下载文件
|
|
@@ -98,17 +98,15 @@ export const addListener = (store) => {
|
|
|
98
98
|
})
|
|
99
99
|
|
|
100
100
|
groupDeviceListener = nativeEventEmitter.addListener('TYInfoUpdate', (event: TYInfoUpdateType) =>{
|
|
101
|
-
const groupDevices = store.getState().ldvModules.uaGroupInfo.groupDevices
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
101
|
+
const groupDevices = cloneDeep(store.getState().ldvModules.uaGroupInfo.groupDevices)
|
|
102
|
+
const idx = groupDevices.findIndex(device => device?.deviceId?.indexOf(event.devId) !== -1)
|
|
103
|
+
if(idx !== -1 && Number(groupDevices[idx].status) !== (event.online ? 1 : 0)){
|
|
104
|
+
groupDevices[idx] = {
|
|
105
|
+
...groupDevices[idx],
|
|
106
|
+
status: event.online ? 1 : 0
|
|
108
107
|
}
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
store.dispatch(setGroupDevices(newGroupDevices))
|
|
108
|
+
store.dispatch(setGroupDevices(groupDevices))
|
|
109
|
+
}
|
|
112
110
|
})
|
|
113
111
|
}
|
|
114
112
|
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React, { ReactElement, memo } from "react";
|
|
2
|
+
import { Text, Image, ViewStyle, View, StyleSheet } from 'react-native'
|
|
3
|
+
import res from "@ledvance/base/src/res"
|
|
4
|
+
import I18n from "@ledvance/base/src/i18n";
|
|
5
|
+
import { Utils } from "tuya-panel-kit";
|
|
6
|
+
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
7
|
+
|
|
8
|
+
const { convertX: cx } = Utils.RatioUtils;
|
|
9
|
+
|
|
10
|
+
interface SummaryProps {
|
|
11
|
+
style?: ViewStyle
|
|
12
|
+
frequency?: string | ReactElement
|
|
13
|
+
time?: string | ReactElement
|
|
14
|
+
actions?: ReactElement
|
|
15
|
+
hideActions?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Summary = (props: SummaryProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<View style={styles.cardContainer}>
|
|
21
|
+
<Text style={styles.itemTitle}>{I18n.getLang('add_randomtimecycle_subheadline_text')}</Text>
|
|
22
|
+
<Spacer height={cx(10)} />
|
|
23
|
+
<View style={{}}>
|
|
24
|
+
<View style={styles.summaryContainer}>
|
|
25
|
+
<View style={styles.summaryLeft}>
|
|
26
|
+
<Image
|
|
27
|
+
source={res.summary_icon1}
|
|
28
|
+
resizeMode="contain"
|
|
29
|
+
style={styles.summaryImg}
|
|
30
|
+
/>
|
|
31
|
+
<View>
|
|
32
|
+
<Text style={styles.leftTitle}>{I18n.getLang('feature_summary_frequency_headline')}</Text>
|
|
33
|
+
</View>
|
|
34
|
+
</View>
|
|
35
|
+
<View style={styles.summaryRight}>
|
|
36
|
+
<View style={styles.rightWrap}>
|
|
37
|
+
<Text style={styles.rightItem}>{props.frequency}</Text>
|
|
38
|
+
</View>
|
|
39
|
+
</View>
|
|
40
|
+
</View>
|
|
41
|
+
<View style={styles.summaryContainer}>
|
|
42
|
+
<View style={styles.summaryLeft}>
|
|
43
|
+
<Image
|
|
44
|
+
source={res.summary_icon2}
|
|
45
|
+
resizeMode="contain"
|
|
46
|
+
style={styles.summaryImg}
|
|
47
|
+
/>
|
|
48
|
+
<View>
|
|
49
|
+
<Text style={styles.leftTitle}>{I18n.getLang('feature_summary_time_headline')}</Text>
|
|
50
|
+
</View>
|
|
51
|
+
</View>
|
|
52
|
+
<View style={styles.summaryRight}>
|
|
53
|
+
<View style={styles.rightWrap}>
|
|
54
|
+
<Text style={styles.rightItem}>{props.time}</Text>
|
|
55
|
+
</View>
|
|
56
|
+
</View>
|
|
57
|
+
</View>
|
|
58
|
+
{!props.hideActions && <View style={[styles.summaryContainer, { alignItems: 'flex-start' }]}>
|
|
59
|
+
<View style={styles.summaryLeft}>
|
|
60
|
+
<Image
|
|
61
|
+
source={res.summary_icon3}
|
|
62
|
+
resizeMode="contain"
|
|
63
|
+
style={styles.summaryImg}
|
|
64
|
+
/>
|
|
65
|
+
<View>
|
|
66
|
+
<Text style={styles.leftTitle}>{I18n.getLang('motion_detection_add_time_schedule_actions_text1')}</Text>
|
|
67
|
+
</View>
|
|
68
|
+
</View>
|
|
69
|
+
<View style={styles.summaryRight}>
|
|
70
|
+
{props.actions}
|
|
71
|
+
</View>
|
|
72
|
+
</View>}
|
|
73
|
+
</View>
|
|
74
|
+
</View>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
cardContainer: {
|
|
80
|
+
marginHorizontal: cx(24),
|
|
81
|
+
},
|
|
82
|
+
itemTitle: {
|
|
83
|
+
color: '#000',
|
|
84
|
+
fontSize: cx(16),
|
|
85
|
+
fontWeight: 'bold',
|
|
86
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
87
|
+
},
|
|
88
|
+
summaryContainer: {
|
|
89
|
+
flex: 1,
|
|
90
|
+
flexDirection: 'row',
|
|
91
|
+
marginBottom: cx(10),
|
|
92
|
+
},
|
|
93
|
+
summaryLeft: {
|
|
94
|
+
flexDirection: 'row',
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
minWidth: cx(100)
|
|
97
|
+
},
|
|
98
|
+
summaryImg: {
|
|
99
|
+
width: cx(12),
|
|
100
|
+
height: cx(12),
|
|
101
|
+
marginRight: cx(6)
|
|
102
|
+
},
|
|
103
|
+
leftTitle: {
|
|
104
|
+
fontSize: cx(14),
|
|
105
|
+
color: '#000'
|
|
106
|
+
},
|
|
107
|
+
summaryRight: {
|
|
108
|
+
flex: 1,
|
|
109
|
+
flexDirection: 'column',
|
|
110
|
+
marginLeft: cx(15),
|
|
111
|
+
},
|
|
112
|
+
rightWrap: {
|
|
113
|
+
borderRadius: cx(16),
|
|
114
|
+
paddingHorizontal: cx(12),
|
|
115
|
+
alignSelf: 'flex-start',
|
|
116
|
+
backgroundColor: '#cbcbcb',
|
|
117
|
+
},
|
|
118
|
+
rightItem: {
|
|
119
|
+
color: '#000',
|
|
120
|
+
fontSize: cx(14)
|
|
121
|
+
},
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
export default memo(Summary)
|