@eohjsc/react-native-smart-city 0.4.31 → 0.4.32
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 +6 -4
- package/src/commons/Processing/index.js +8 -8
- package/src/commons/Unit/HeaderUnit/index.js +15 -8
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +25 -25
- package/src/iot/Monitor.js +2 -2
- package/src/screens/AddNewGateway/ConnectingModbusDevice.js +4 -4
- package/src/screens/HanetCamera/utils/Monitor.js +4 -4
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.4.
|
|
4
|
+
"version": "0.4.32",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -65,7 +65,9 @@
|
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@react-native-community/clipboard": "*",
|
|
67
67
|
"react": "*",
|
|
68
|
-
"react-native": "*"
|
|
68
|
+
"react-native": "*",
|
|
69
|
+
"react-native-modal": "*",
|
|
70
|
+
"react-native-modal-datetime-picker": "*"
|
|
69
71
|
},
|
|
70
72
|
"devDependencies": {
|
|
71
73
|
"@babel/core": "^7.12.9",
|
|
@@ -181,8 +183,8 @@
|
|
|
181
183
|
"react-native-localize": "^1.4.1",
|
|
182
184
|
"react-native-maps": "0.27.1",
|
|
183
185
|
"react-native-maps-directions": "^1.8.0",
|
|
184
|
-
"react-native-modal": "
|
|
185
|
-
"react-native-modal-datetime-picker": "
|
|
186
|
+
"react-native-modal": "^13.0.1",
|
|
187
|
+
"react-native-modal-datetime-picker": "^15.0.1",
|
|
186
188
|
"react-native-new-snap-carousel": "^3.9.3",
|
|
187
189
|
"react-native-onesignal": "^4.3.1",
|
|
188
190
|
"react-native-pager-view": "^5.4.1",
|
|
@@ -4,7 +4,7 @@ import * as Progress from 'react-native-progress';
|
|
|
4
4
|
|
|
5
5
|
import Text from '../Text';
|
|
6
6
|
import { HeaderCustom } from '../Header';
|
|
7
|
-
|
|
7
|
+
import { getPusher } from '../../utils/Pusher';
|
|
8
8
|
import { ModalCustom } from '../Modal';
|
|
9
9
|
import { Colors, Constants } from '../../configs';
|
|
10
10
|
import styles from './styles';
|
|
@@ -74,13 +74,13 @@ const Processing = ({
|
|
|
74
74
|
}, [setHidePopupTurnOnGuide, setIsRecallChipScan]);
|
|
75
75
|
|
|
76
76
|
useEffect(() => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
const channel = getPusher().subscribe(channelName);
|
|
78
|
+
channel.bind('progress', (message) => {
|
|
79
|
+
processMessage(channel, message);
|
|
80
|
+
});
|
|
81
|
+
return () => {
|
|
82
|
+
getPusher().unsubscribe(channelName);
|
|
83
|
+
};
|
|
84
84
|
}, [channelName, complete, fail, processMessage]);
|
|
85
85
|
|
|
86
86
|
useEffect(() => {
|
|
@@ -4,9 +4,11 @@ import { Icon } from '@ant-design/react-native';
|
|
|
4
4
|
import { useNavigation } from '@react-navigation/native';
|
|
5
5
|
import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
|
6
6
|
|
|
7
|
-
import { Colors, Device } from '../../../configs';
|
|
7
|
+
import { Colors, Device, Images } from '../../../configs';
|
|
8
8
|
import Text from '../../Text';
|
|
9
9
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
10
|
+
import { Image } from 'react-native';
|
|
11
|
+
import { Platform } from 'react-native';
|
|
10
12
|
|
|
11
13
|
const HeaderUnit = memo(
|
|
12
14
|
({
|
|
@@ -47,11 +49,7 @@ const HeaderUnit = memo(
|
|
|
47
49
|
style={styles.btnLeft}
|
|
48
50
|
onPress={onPressBack}
|
|
49
51
|
>
|
|
50
|
-
<
|
|
51
|
-
name={'left'}
|
|
52
|
-
size={27}
|
|
53
|
-
color={transparent ? Colors.White : Colors.Black}
|
|
54
|
-
/>
|
|
52
|
+
<Image source={Images.arrowLeft} style={styles.iconBack} />
|
|
55
53
|
</TouchableOpacity>
|
|
56
54
|
<View style={[styles.boxTitle, styleBoxTitle]}>
|
|
57
55
|
{title && (
|
|
@@ -70,7 +68,7 @@ const HeaderUnit = memo(
|
|
|
70
68
|
onPress={onPressAdd}
|
|
71
69
|
>
|
|
72
70
|
<Icon
|
|
73
|
-
name={'plus'}
|
|
71
|
+
name={Platform.OS === 'android' ? 'plus-square' : 'plus'}
|
|
74
72
|
size={27}
|
|
75
73
|
color={transparent ? Colors.White : Colors.Black}
|
|
76
74
|
/>
|
|
@@ -83,9 +81,10 @@ const HeaderUnit = memo(
|
|
|
83
81
|
accessibilityLabel={idButtonMore}
|
|
84
82
|
>
|
|
85
83
|
<Icon
|
|
86
|
-
name={'
|
|
84
|
+
name={'ellipsis'}
|
|
87
85
|
size={27}
|
|
88
86
|
color={transparent ? Colors.White : Colors.Black}
|
|
87
|
+
style={styles.iconMore}
|
|
89
88
|
/>
|
|
90
89
|
</TouchableOpacity>
|
|
91
90
|
</View>
|
|
@@ -146,4 +145,12 @@ const styles = StyleSheet.create({
|
|
|
146
145
|
borderBottomWidth: 1,
|
|
147
146
|
borderBottomColor: Colors.Gray4,
|
|
148
147
|
},
|
|
148
|
+
iconMore: {
|
|
149
|
+
transform: [{ rotate: '90deg' }],
|
|
150
|
+
},
|
|
151
|
+
iconBack: {
|
|
152
|
+
tintColor: Colors.White,
|
|
153
|
+
width: 16,
|
|
154
|
+
height: 20,
|
|
155
|
+
},
|
|
149
156
|
});
|
|
@@ -4,7 +4,7 @@ import moment from 'moment';
|
|
|
4
4
|
import { API } from '../../../configs';
|
|
5
5
|
import HistoryChart from '../../../commons/Device/HistoryChart';
|
|
6
6
|
import { axiosGet } from '../../../utils/Apis/axios';
|
|
7
|
-
|
|
7
|
+
import { getPusher } from '../../../utils/Pusher';
|
|
8
8
|
|
|
9
9
|
const fetchDataS3 = async (url) => {
|
|
10
10
|
const { data } = await axiosGet(url, {
|
|
@@ -87,30 +87,30 @@ export const updateConfigChart = async (
|
|
|
87
87
|
);
|
|
88
88
|
|
|
89
89
|
data.configs.map((config) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
90
|
+
if (config.middle.not_ready.length > 0) {
|
|
91
|
+
const channel = getPusher().subscribe(config.middle.channel);
|
|
92
|
+
channel.bind('caching-value-log-process', async () => {
|
|
93
|
+
await Promise.all(
|
|
94
|
+
config.middle.not_ready.map((item) =>
|
|
95
|
+
(async () => {
|
|
96
|
+
item.data = await fetchDataS3(item.url);
|
|
97
|
+
})()
|
|
98
|
+
)
|
|
99
|
+
);
|
|
100
|
+
const middleDataByDay = [
|
|
101
|
+
...config.middle.not_ready,
|
|
102
|
+
...config.middle.ready,
|
|
103
|
+
];
|
|
104
|
+
middleDataByDay.sort((a, b) => (a.date > b.date ? 1 : -1)); // small to large
|
|
105
|
+
const middleData = middleDataByDay.map((x) => x.data).flat();
|
|
106
|
+
data_by_id[config.id] = [...config.head, ...middleData, ...config.tail];
|
|
107
|
+
setChartData((chartData) => {
|
|
108
|
+
const index = chartData.map((c) => c.id).indexOf(config.id);
|
|
109
|
+
chartData[index].data = data_by_id[config.id];
|
|
110
|
+
return [...chartData];
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
114
|
});
|
|
115
115
|
};
|
|
116
116
|
|
package/src/iot/Monitor.js
CHANGED
|
@@ -48,8 +48,8 @@ const watchConfig = (configId) => {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
watchingConfigs[configId] = 1;
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const channel = getPusher().subscribe(`private-config_v2-${configId}`);
|
|
52
|
+
channel.bind('new-value', updateGlobalValue.bind(channel, configId));
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const unwatchConfig = (configId) => {
|
|
@@ -54,10 +54,10 @@ const ConnectingModbusDevice = ({ route }) => {
|
|
|
54
54
|
|
|
55
55
|
useEffect(() => {
|
|
56
56
|
if (channelNameTemp) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
const channel = getPusher().subscribe(channelNameTemp);
|
|
58
|
+
channel.bind('change_modbus_address_completed', (messageRes) => {
|
|
59
|
+
setIsChangeAddressSuccess(messageRes.success);
|
|
60
|
+
});
|
|
61
61
|
}
|
|
62
62
|
}, [channelNameTemp, setIsChangeAddressSuccess]);
|
|
63
63
|
|
|
@@ -40,10 +40,10 @@ const destroyPusher = () => {
|
|
|
40
40
|
|
|
41
41
|
// eslint-disable-next-line promise/prefer-await-to-callbacks
|
|
42
42
|
export const watchHanetCheckinData = (hanetCamera, callback) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const channel = getPusher().subscribe(
|
|
44
|
+
`private-hanet-camera-${hanetCamera.device_id}`
|
|
45
|
+
);
|
|
46
|
+
channel.bind('new-checkin-data', callback);
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
export const unwatchHanetCheckinData = (hanetCamera) => {
|