@eohjsc/react-native-smart-city 0.2.76 → 0.2.81
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/commons/Device/HorizontalBarChart.js +1 -1
- package/src/commons/Device/LinearChart.js +1 -1
- package/src/commons/SubUnit/Favorites/index.js +7 -4
- package/src/commons/SubUnit/ShortDetail.js +7 -4
- package/src/configs/API.js +2 -1
- package/src/iot/RemoteControl/__test__/Bluetooth.test.js +1 -1
- package/src/screens/Unit/__test__/Detail.test.js +1 -1
- package/src/utils/Utils.js +0 -12
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.2.
|
|
4
|
+
"version": "0.2.81",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@ant-design/icons-react-native": "^2.2.1",
|
|
99
99
|
"@ant-design/react-native": "^4.0.5",
|
|
100
|
+
"@eohjsc/highcharts": "^1.0.3",
|
|
100
101
|
"@formatjs/intl-getcanonicallocales": "^1.4.5",
|
|
101
102
|
"@formatjs/intl-numberformat": "^5.6.2",
|
|
102
103
|
"@formatjs/intl-pluralrules": "^3.4.7",
|
|
103
|
-
"@highcharts/highcharts-react-native": "highcharts/highcharts-react-native#107/head",
|
|
104
104
|
"@invertase/react-native-apple-authentication": "^1.1.2",
|
|
105
105
|
"@messageformat/core": "^3.0.0",
|
|
106
106
|
"@react-native-community/async-storage": "^1.12.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { memo, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { View, StyleSheet } from 'react-native';
|
|
3
|
-
import HighchartsReactNative from '@
|
|
3
|
+
import HighchartsReactNative from '@eohjsc/highcharts';
|
|
4
4
|
import { isEmpty } from 'lodash';
|
|
5
5
|
|
|
6
6
|
import { Colors } from '../../configs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { memo, useState, useEffect, useCallback } from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import HighchartsReactNative from '@
|
|
3
|
+
import HighchartsReactNative from '@eohjsc/highcharts';
|
|
4
4
|
import moment from 'moment';
|
|
5
5
|
import { Colors } from '../../configs';
|
|
6
6
|
|
|
@@ -31,9 +31,12 @@ const SubUnitFavorites = ({
|
|
|
31
31
|
favorites.devices.forEach((sensor) => {
|
|
32
32
|
params.append('sensors', sensor.id);
|
|
33
33
|
});
|
|
34
|
-
const { success, data } = await axiosGet(
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const { success, data } = await axiosGet(
|
|
35
|
+
API.UNIT.SENSORS_STATUS(unit.id),
|
|
36
|
+
{
|
|
37
|
+
params: params,
|
|
38
|
+
}
|
|
39
|
+
);
|
|
37
40
|
if (success) {
|
|
38
41
|
setSensorsStatus(data);
|
|
39
42
|
}
|
|
@@ -45,7 +48,7 @@ const SubUnitFavorites = ({
|
|
|
45
48
|
} else {
|
|
46
49
|
clearInterval(intervalSensorStatus.current);
|
|
47
50
|
}
|
|
48
|
-
}, [isFocused, favorites?.devices]);
|
|
51
|
+
}, [isFocused, favorites?.devices, unit.id]);
|
|
49
52
|
|
|
50
53
|
const handleOnAddNew = () => {
|
|
51
54
|
alert(t('feature_under_development'));
|
|
@@ -35,9 +35,12 @@ const ShortDetailSubUnit = ({ unit, station, isGGHomeConnected }) => {
|
|
|
35
35
|
station.sensors.forEach((sensor) => {
|
|
36
36
|
params.append('sensors', sensor.id);
|
|
37
37
|
});
|
|
38
|
-
const { success, data } = await axiosGet(
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const { success, data } = await axiosGet(
|
|
39
|
+
API.UNIT.SENSORS_STATUS(unit.id),
|
|
40
|
+
{
|
|
41
|
+
params: params,
|
|
42
|
+
}
|
|
43
|
+
);
|
|
41
44
|
if (success) {
|
|
42
45
|
setSensorsStatus(data);
|
|
43
46
|
}
|
|
@@ -49,7 +52,7 @@ const ShortDetailSubUnit = ({ unit, station, isGGHomeConnected }) => {
|
|
|
49
52
|
} else {
|
|
50
53
|
clearInterval(intervalSensorStatus.current);
|
|
51
54
|
}
|
|
52
|
-
}, [isFocused, station?.sensors]);
|
|
55
|
+
}, [isFocused, station?.sensors, unit.id]);
|
|
53
56
|
|
|
54
57
|
const renderCamera = () => {
|
|
55
58
|
if (station?.camera) {
|
package/src/configs/API.js
CHANGED
|
@@ -35,6 +35,8 @@ const API = {
|
|
|
35
35
|
SCConfig.apiRoot + `/property_manager/units/${id}/device_sensor/`,
|
|
36
36
|
ADD_GATEWAY: (id) =>
|
|
37
37
|
SCConfig.apiRoot + `/property_manager/units/${id}/add_gateway/`,
|
|
38
|
+
SENSORS_STATUS: (id) =>
|
|
39
|
+
SCConfig.apiRoot + `/property_manager/units/${id}/sensors_status/`,
|
|
38
40
|
},
|
|
39
41
|
SUB_UNIT: {
|
|
40
42
|
REMOVE_SUB_UNIT: (unitId, id) =>
|
|
@@ -87,7 +89,6 @@ const API = {
|
|
|
87
89
|
CHANGE_SUB_UNIT: (unit_id, station_id, id) =>
|
|
88
90
|
SCConfig.apiRoot +
|
|
89
91
|
`/property_manager/${unit_id}/sub_units/${station_id}/devices/${id}/change_sub_unit/`,
|
|
90
|
-
STATUS: () => SCConfig.apiRoot + '/property_manager/sensors/status/',
|
|
91
92
|
},
|
|
92
93
|
SHARED_SENSOR: {
|
|
93
94
|
ACCESS: (id) =>
|
|
@@ -74,7 +74,7 @@ describe('Test UnitDetail', () => {
|
|
|
74
74
|
|
|
75
75
|
const detailUnitApiUrl = API.UNIT.UNIT_DETAIL(1);
|
|
76
76
|
const summaryUnitApiUrl = API.UNIT.UNIT_SUMMARY(1);
|
|
77
|
-
const sensorStatusApiUrl = API.
|
|
77
|
+
const sensorStatusApiUrl = API.UNIT.SENSORS_STATUS(1);
|
|
78
78
|
|
|
79
79
|
let tree;
|
|
80
80
|
|
package/src/utils/Utils.js
CHANGED
|
@@ -72,10 +72,6 @@ export const openMapDirection = (item) => () => {
|
|
|
72
72
|
|
|
73
73
|
export const ToastBottomHelper = {
|
|
74
74
|
success: (msg, line2) => {
|
|
75
|
-
if (!Toast._ref) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
75
|
Toast.show({
|
|
80
76
|
type: 'success',
|
|
81
77
|
position: 'bottom',
|
|
@@ -85,10 +81,6 @@ export const ToastBottomHelper = {
|
|
|
85
81
|
});
|
|
86
82
|
},
|
|
87
83
|
error: (msg, line2) => {
|
|
88
|
-
if (!Toast._ref) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
84
|
Toast.show({
|
|
93
85
|
type: 'error',
|
|
94
86
|
position: 'bottom',
|
|
@@ -98,10 +90,6 @@ export const ToastBottomHelper = {
|
|
|
98
90
|
});
|
|
99
91
|
},
|
|
100
92
|
info: (msg, line2) => {
|
|
101
|
-
if (!Toast._ref) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
93
|
Toast.show({
|
|
106
94
|
type: 'info',
|
|
107
95
|
position: 'bottom',
|