@eohjsc/react-native-smart-city 0.3.82 → 0.3.84
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/package.json +2 -2
- package/src/Images/Common/Sunny.png +0 -0
- package/src/Images/Common/Sunny@2x.png +0 -0
- package/src/Images/Common/Sunny@3x.png +0 -0
- package/src/commons/ActionGroup/SliderRangeTemplateStyles.js +1 -0
- package/src/commons/Device/RainningSensor/CurrentRainSensor.js +14 -3
- package/src/commons/Device/RainningSensor/__test__/CurrentRainSensor.test.js +43 -3
- package/src/configs/Constants.js +1 -0
- package/src/configs/Images.js +1 -0
- package/src/screens/Device/components/SensorDisplayItem.js +13 -6
- package/src/screens/Device/detail.js +0 -1
- package/src/screens/Notification/components/NotificationItem.js +8 -0
- package/src/screens/Unit/components/MyUnitDevice/index.js +5 -2
- package/src/utils/I18n/translations/en.json +2 -1
- package/src/utils/I18n/translations/vi.json +3 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eohjsc/react-native-smart-city",
|
|
3
3
|
"title": "React Native Smart Home",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.84",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -179,7 +179,6 @@
|
|
|
179
179
|
"react-native-maps-directions": "^1.8.0",
|
|
180
180
|
"react-native-modal": "^11.5.6",
|
|
181
181
|
"react-native-modal-datetime-picker": "^8.9.3",
|
|
182
|
-
"react-native-new-snap-carousel": "^3.9.3",
|
|
183
182
|
"react-native-onesignal": "^4.3.1",
|
|
184
183
|
"react-native-pager-view": "^5.4.1",
|
|
185
184
|
"react-native-parallax-scroll-view": "^0.21.3",
|
|
@@ -191,6 +190,7 @@
|
|
|
191
190
|
"react-native-responsive-fontsize": "^0.5.1",
|
|
192
191
|
"react-native-safe-area-context": "^3.1.1",
|
|
193
192
|
"react-native-screens": "^2.9.0",
|
|
193
|
+
"react-native-snap-carousel": "4.0.0-beta.5",
|
|
194
194
|
"react-native-super-grid": "^4.0.3",
|
|
195
195
|
"react-native-svg": "^12.1.0",
|
|
196
196
|
"react-native-toast-message": "^2.1.1",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -6,6 +6,8 @@ import { Colors } from '../../../configs';
|
|
|
6
6
|
import { CircleView } from '../../../commons';
|
|
7
7
|
import Text from '../../../commons/Text';
|
|
8
8
|
import IconComponent from '../../IconComponent';
|
|
9
|
+
import images from '../../../configs/Images';
|
|
10
|
+
import FImage from '../../FImage';
|
|
9
11
|
|
|
10
12
|
const CurrentRainSensor = memo(({ data = [] }) => {
|
|
11
13
|
const item = data.length
|
|
@@ -31,9 +33,14 @@ const CurrentRainSensor = memo(({ data = [] }) => {
|
|
|
31
33
|
start={{ x: 1, y: 0 }}
|
|
32
34
|
end={{ x: 1, y: 1 }}
|
|
33
35
|
/>
|
|
34
|
-
|
|
35
|
-
icon={icon_kit_data?.icon || icon
|
|
36
|
-
|
|
36
|
+
{icon_kit_data?.icon || icon ? (
|
|
37
|
+
<IconComponent icon={icon_kit_data?.icon || icon} />
|
|
38
|
+
) : (
|
|
39
|
+
<FImage
|
|
40
|
+
source={images.activeCurrentSensor}
|
|
41
|
+
style={styles.iconDefault}
|
|
42
|
+
/>
|
|
43
|
+
)}
|
|
37
44
|
<Text style={styles.text}>{text}</Text>
|
|
38
45
|
</CircleView>
|
|
39
46
|
</View>
|
|
@@ -68,4 +75,8 @@ const styles = StyleSheet.create({
|
|
|
68
75
|
lineHeight: 32,
|
|
69
76
|
fontSize: 24,
|
|
70
77
|
},
|
|
78
|
+
iconDefault: {
|
|
79
|
+
width: 37,
|
|
80
|
+
height: 37,
|
|
81
|
+
},
|
|
71
82
|
});
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import renderer, { act } from 'react-test-renderer';
|
|
4
4
|
import CurrentRainSensor from '../CurrentRainSensor';
|
|
5
|
+
import FImage from '../../../FImage';
|
|
6
|
+
import IconComponent from '../../../IconComponent';
|
|
5
7
|
|
|
6
8
|
describe('Test CurrentRainSensor', () => {
|
|
7
9
|
let tree;
|
|
@@ -21,7 +23,7 @@ describe('Test CurrentRainSensor', () => {
|
|
|
21
23
|
});
|
|
22
24
|
const instance = tree.root;
|
|
23
25
|
const Views = instance.findAllByType(View);
|
|
24
|
-
expect(Views).toHaveLength(
|
|
26
|
+
expect(Views).toHaveLength(3);
|
|
25
27
|
});
|
|
26
28
|
|
|
27
29
|
it('render CurrentRainSensor raining: true', async () => {
|
|
@@ -40,7 +42,7 @@ describe('Test CurrentRainSensor', () => {
|
|
|
40
42
|
});
|
|
41
43
|
const instance = tree.root;
|
|
42
44
|
const Views = instance.findAllByType(View);
|
|
43
|
-
expect(Views).toHaveLength(
|
|
45
|
+
expect(Views).toHaveLength(3);
|
|
44
46
|
});
|
|
45
47
|
|
|
46
48
|
it('render CurrentRainSensor data empty', async () => {
|
|
@@ -49,6 +51,44 @@ describe('Test CurrentRainSensor', () => {
|
|
|
49
51
|
});
|
|
50
52
|
const instance = tree.root;
|
|
51
53
|
const Views = instance.findAllByType(View);
|
|
52
|
-
expect(Views).toHaveLength(
|
|
54
|
+
expect(Views).toHaveLength(3);
|
|
55
|
+
});
|
|
56
|
+
it('render CurrentRainSensor default icon', async () => {
|
|
57
|
+
const data = [
|
|
58
|
+
{
|
|
59
|
+
evaluate: {
|
|
60
|
+
text: 'default',
|
|
61
|
+
backgroundColor: '#FEFFE6',
|
|
62
|
+
borderColor: '#FADB14',
|
|
63
|
+
icon_kit_data: '',
|
|
64
|
+
icon: '',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
await act(async () => {
|
|
69
|
+
tree = renderer.create(<CurrentRainSensor data={data} />);
|
|
70
|
+
});
|
|
71
|
+
const instance = tree.root;
|
|
72
|
+
const fimage = instance.findAllByType(FImage);
|
|
73
|
+
expect(fimage).toHaveLength(1);
|
|
74
|
+
});
|
|
75
|
+
it('render CurrentRainSensor has icon kit and icon', async () => {
|
|
76
|
+
const data = [
|
|
77
|
+
{
|
|
78
|
+
evaluate: {
|
|
79
|
+
text: 'default',
|
|
80
|
+
backgroundColor: '#FEFFE6',
|
|
81
|
+
borderColor: '#FADB14',
|
|
82
|
+
icon_kit_data: 'http:s//',
|
|
83
|
+
icon: 'http:s//',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
await act(async () => {
|
|
88
|
+
tree = renderer.create(<CurrentRainSensor data={data} />);
|
|
89
|
+
});
|
|
90
|
+
const instance = tree.root;
|
|
91
|
+
const iconComponent = instance.findAllByType(IconComponent);
|
|
92
|
+
expect(iconComponent).toHaveLength(1);
|
|
53
93
|
});
|
|
54
94
|
});
|
package/src/configs/Constants.js
CHANGED
|
@@ -260,6 +260,7 @@ export const NOTIFICATION_TYPES = {
|
|
|
260
260
|
NOTIFY_REMOVE_SUB_UNIT: 'NOTIFY_REMOVE_SUB_UNIT',
|
|
261
261
|
NOTIFY_REMOVE_DEVICE: 'NOTIFY_REMOVE_DEVICE',
|
|
262
262
|
NOTIFY_EMERGENCY: 'NOTIFY_EMERGENCY',
|
|
263
|
+
NOTIFY_UPGRADE_SYSTEM: 'NOTIFY_UPGRADE_SYSTEM',
|
|
263
264
|
NOTIFY_CHANGE_UNIT_OLD_OWNER: 'NOTIFY_CHANGE_UNIT_OLD_OWNER',
|
|
264
265
|
NOTIFY_CHANGE_UNIT_NEW_OWNER: 'NOTIFY_CHANGE_UNIT_NEW_OWNER',
|
|
265
266
|
AIR_QUALITY: 'AIR_QUALITY',
|
package/src/configs/Images.js
CHANGED
|
@@ -55,16 +55,23 @@ export const SensorDisplayItem = ({
|
|
|
55
55
|
const data = item.configuration.configs.map((config) => {
|
|
56
56
|
const configValue = configValues[config.id]?.value;
|
|
57
57
|
const configEvaluate = evaluate[config.id] || {};
|
|
58
|
+
let value = {};
|
|
58
59
|
if (configValue === null || configValue === undefined) {
|
|
59
|
-
|
|
60
|
+
value = {
|
|
61
|
+
id: config.id,
|
|
62
|
+
value: null,
|
|
63
|
+
evaluate: null,
|
|
64
|
+
};
|
|
65
|
+
} else {
|
|
66
|
+
value = {
|
|
67
|
+
id: config.id,
|
|
68
|
+
value: configValue,
|
|
69
|
+
evaluate: evaluateValue(config.id, configValue) || configEvaluate,
|
|
70
|
+
};
|
|
60
71
|
}
|
|
61
|
-
const value = {
|
|
62
|
-
id: config.id,
|
|
63
|
-
value: configValue,
|
|
64
|
-
evaluate: evaluateValue(config.id, configValue) || configEvaluate,
|
|
65
|
-
};
|
|
66
72
|
return { ...config, ...value };
|
|
67
73
|
});
|
|
74
|
+
|
|
68
75
|
return data.filter(Boolean);
|
|
69
76
|
}, [configValues, evaluateValue, item, evaluate]);
|
|
70
77
|
|
|
@@ -320,6 +320,14 @@ const NotificationItem = memo(({ item }) => {
|
|
|
320
320
|
<IconComponent icon={'home'} style={styles.backgroundSummer} />
|
|
321
321
|
),
|
|
322
322
|
};
|
|
323
|
+
case NOTIFICATION_TYPES.NOTIFY_UPGRADE_SYSTEM:
|
|
324
|
+
return {
|
|
325
|
+
content: customColorText(t('the_system_has_been_upgraded')),
|
|
326
|
+
redirect: () => null,
|
|
327
|
+
iconContent: (
|
|
328
|
+
<IconComponent icon={'home'} style={styles.backgroundSummer} />
|
|
329
|
+
),
|
|
330
|
+
};
|
|
323
331
|
case NOTIFICATION_TYPES.NOTIFY_EMERGENCY:
|
|
324
332
|
switch (params?.type) {
|
|
325
333
|
case EMERGENCY_TYPE.CREATED:
|
|
@@ -7,7 +7,7 @@ import ItemQuickAction from '../../../../commons/Action/ItemQuickAction';
|
|
|
7
7
|
import Text from '../../../../commons/Text';
|
|
8
8
|
import Routes from '../../../../utils/Route';
|
|
9
9
|
import { Colors } from '../../../../configs';
|
|
10
|
-
import
|
|
10
|
+
import IconComponent from '../../../../commons/IconComponent';
|
|
11
11
|
import { DEVICE_TYPE } from '../../../../configs/Constants';
|
|
12
12
|
|
|
13
13
|
const MyUnitDevice = ({ device, unit }) => {
|
|
@@ -45,7 +45,10 @@ const MyUnitDevice = ({ device, unit }) => {
|
|
|
45
45
|
<View style={styles.item}>
|
|
46
46
|
<TouchableOpacity style={styles.flex1} onPress={goToSensorDisplay}>
|
|
47
47
|
<View style={styles.rowCenter}>
|
|
48
|
-
<
|
|
48
|
+
<IconComponent
|
|
49
|
+
icon={device?.icon_kit || device?.icon}
|
|
50
|
+
style={styles.image}
|
|
51
|
+
/>
|
|
49
52
|
<View style={styles.marginTop3}>
|
|
50
53
|
<Text numberOfLines={1} semibold style={styles.nameDevice}>
|
|
51
54
|
{device.name}
|
|
@@ -1121,5 +1121,6 @@
|
|
|
1121
1121
|
"pin_mode": "PIN mode",
|
|
1122
1122
|
"rename_device_fail": "Rename device fail",
|
|
1123
1123
|
"release_time": "Release time",
|
|
1124
|
-
"data_address": "Data address"
|
|
1124
|
+
"data_address": "Data address",
|
|
1125
|
+
"the_system_has_been_upgraded" : "To provide a better user experience, [Era] will perform a system upgrade.The upgrade will take about 10 minutes.\n\n Some device control functions will be interrupted during the upgrade.[Era] would like to ask for your understanding for this inconvenience.\n\nBest regards."
|
|
1125
1126
|
}
|
|
@@ -1120,5 +1120,7 @@
|
|
|
1120
1120
|
"pin_mode": "Chế độ mã PIN",
|
|
1121
1121
|
"rename_device_fail": "Đổi tên thiết bị thất bại",
|
|
1122
1122
|
"release_time": "Thời gian nhả trạng thái",
|
|
1123
|
-
"data_address": "Địa chỉ dữ liệu"
|
|
1123
|
+
"data_address": "Địa chỉ dữ liệu",
|
|
1124
|
+
"the_system_has_been_upgraded" : "Để mang lại trải nghiệm tốt hơn cho người dùng, [Era] sẽ tiến hành nâng cấp hệ thống.Việc nâng cấp sẽ diễn ra trong khoảng 10 phút.\n\nMột số chức năng điều khiển thiết bị sẽ bị gián đoạn trong thời gian nâng cấp.[Era] kính mong quý khách hàng thông cảm cho sự bất tiện này.\n\nTrân trọng "
|
|
1125
|
+
|
|
1124
1126
|
}
|