@eohjsc/react-native-smart-city 0.6.0-rc1 → 0.6.0-rc3
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 +1 -1
- package/src/commons/Header/HeaderCustom.js +6 -1
- package/src/commons/SummaryItem/index.js +22 -23
- package/src/commons/Unit/HeaderUnit/index.js +3 -2
- package/src/commons/Unit/SharedUnit.js +2 -2
- package/src/configs/API.js +1 -2
- package/src/screens/Automate/ScriptDetail/index.js +2 -1
- package/src/screens/Automate/index.js +1 -1
- package/src/screens/Device/detail.js +4 -3
- package/src/screens/HanetCamera/Detail.js +6 -2
- package/src/screens/Notification/__test__/Notification.test.js +5 -15
- package/src/screens/Notification/index.js +3 -3
- package/src/screens/Sharing/UnitMemberList.js +6 -5
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +3 -2
- package/src/screens/SubUnit/ManageSubUnit.js +2 -1
- package/src/screens/Template/detail.js +2 -2
- package/src/screens/Unit/SmartAccountItem.js +2 -2
- package/src/screens/Unit/Summaries.js +21 -27
- package/src/utils/Monitor.js +4 -4
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import { View, Text, TouchableOpacity, Image } from 'react-native';
|
|
|
3
3
|
import Images from '../../configs/Images';
|
|
4
4
|
import { Colors } from '../../configs';
|
|
5
5
|
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
6
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
6
7
|
import { useNavigation } from '@react-navigation/native';
|
|
7
8
|
import styles from './Styles/HeaderCustomStyles';
|
|
8
9
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
@@ -98,7 +99,11 @@ const HeaderCustom = ({
|
|
|
98
99
|
accessibilityLabel={AccessibilityLabel.MENU_POPPER_MORE}
|
|
99
100
|
>
|
|
100
101
|
<View style={styles.buttonBack}>
|
|
101
|
-
<
|
|
102
|
+
<MaterialIcons
|
|
103
|
+
name={'more-vert'}
|
|
104
|
+
size={27}
|
|
105
|
+
color={Colors.Black}
|
|
106
|
+
/>
|
|
102
107
|
</View>
|
|
103
108
|
</TouchableOpacity>
|
|
104
109
|
</>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { memo } from 'react';
|
|
1
|
+
import React, { memo, useCallback, useMemo } from 'react';
|
|
2
2
|
import { View, TouchableOpacity } from 'react-native';
|
|
3
3
|
import styles from './styles';
|
|
4
4
|
import { Colors } from '../../configs';
|
|
@@ -11,38 +11,37 @@ import WaterQuality from '../../../assets/images/WaterQuality.svg';
|
|
|
11
11
|
import Device from '../../../assets/images/Device.svg';
|
|
12
12
|
import { AccessibilityLabel } from '../../configs/Constants';
|
|
13
13
|
|
|
14
|
+
const iconMap = {
|
|
15
|
+
air_quality: AirQuality,
|
|
16
|
+
water_quality: WaterQuality,
|
|
17
|
+
temperature: Temperature,
|
|
18
|
+
uv_index: UVIndex,
|
|
19
|
+
three_phase_power_consumption: PowerMeter,
|
|
20
|
+
power_consumption: PowerMeter,
|
|
21
|
+
default: Device,
|
|
22
|
+
};
|
|
23
|
+
|
|
14
24
|
const SummaryItem = memo(({ item, goToSummary }) => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return Temperature; /* istanbul ignore next */
|
|
23
|
-
case 'uv_index':
|
|
24
|
-
return UVIndex; /* istanbul ignore next */
|
|
25
|
-
case 'three_phase_power_consumption':
|
|
26
|
-
return PowerMeter; /* istanbul ignore next */
|
|
27
|
-
case 'power_consumption':
|
|
28
|
-
return PowerMeter; /* istanbul ignore next */
|
|
29
|
-
default:
|
|
30
|
-
return Device; /* istanbul ignore next */
|
|
31
|
-
}
|
|
32
|
-
})();
|
|
25
|
+
const { template, left_text, left_value, id } = item;
|
|
26
|
+
const Icon = useMemo(() => iconMap[template] || iconMap.default, [template]);
|
|
27
|
+
|
|
28
|
+
const handlePress = useCallback(() => {
|
|
29
|
+
goToSummary(item);
|
|
30
|
+
}, [goToSummary, item]);
|
|
31
|
+
|
|
33
32
|
return (
|
|
34
33
|
<TouchableOpacity
|
|
35
|
-
onPress={
|
|
34
|
+
onPress={handlePress}
|
|
36
35
|
style={styles.wrapSummaryItem}
|
|
37
|
-
accessibilityLabel={`${AccessibilityLabel.UNIT_DETAIL_UNIT_SUMMARY_ITEM}-${
|
|
36
|
+
accessibilityLabel={`${AccessibilityLabel.UNIT_DETAIL_UNIT_SUMMARY_ITEM}-${id}`}
|
|
38
37
|
>
|
|
39
38
|
<View style={styles.summaryItem}>
|
|
40
39
|
<Icon />
|
|
41
40
|
<Text type="Body" color={Colors.Gray7} style={styles.summaryText}>
|
|
42
|
-
{
|
|
41
|
+
{left_text}
|
|
43
42
|
</Text>
|
|
44
43
|
<Text color={Colors.Gray9} bold>
|
|
45
|
-
{
|
|
44
|
+
{left_value}
|
|
46
45
|
</Text>
|
|
47
46
|
</View>
|
|
48
47
|
<View style={styles.dashItem} />
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { memo, useCallback, useRef } from 'react';
|
|
2
2
|
import { View, TouchableOpacity, StyleSheet, StatusBar } from 'react-native';
|
|
3
3
|
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
4
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
4
5
|
import { useNavigation } from '@react-navigation/native';
|
|
5
6
|
import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
|
6
7
|
|
|
@@ -84,8 +85,8 @@ const HeaderUnit = memo(
|
|
|
84
85
|
accessibilityLabel={idButtonMore}
|
|
85
86
|
>
|
|
86
87
|
<View style={styles.btnMore}>
|
|
87
|
-
<
|
|
88
|
-
name={'more'}
|
|
88
|
+
<MaterialIcons
|
|
89
|
+
name={'more-vert'}
|
|
89
90
|
size={27}
|
|
90
91
|
color={transparent ? Colors.White : Colors.Black}
|
|
91
92
|
/>
|
|
@@ -100,7 +100,7 @@ const SharedUnit = ({
|
|
|
100
100
|
/>
|
|
101
101
|
) : (
|
|
102
102
|
<AntDesign
|
|
103
|
-
name="
|
|
103
|
+
name="pushpino"
|
|
104
104
|
size={20}
|
|
105
105
|
onPress={addPinSharedUnit}
|
|
106
106
|
accessibilityLabel={`${AccessibilityLabel.ICON_ADD_PIN_SHARED_UNIT}-${item.id}`}
|
|
@@ -116,7 +116,7 @@ const SharedUnit = ({
|
|
|
116
116
|
/>
|
|
117
117
|
) : (
|
|
118
118
|
<AntDesign
|
|
119
|
-
name="
|
|
119
|
+
name="staro"
|
|
120
120
|
size={20}
|
|
121
121
|
onPress={addStarSharedUnit}
|
|
122
122
|
accessibilityLabel={`${AccessibilityLabel.ICON_ADD_STAR_SHARED_UNIT}-${item.id}`}
|
package/src/configs/API.js
CHANGED
|
@@ -195,8 +195,7 @@ const API = {
|
|
|
195
195
|
},
|
|
196
196
|
},
|
|
197
197
|
NOTIFICATION: {
|
|
198
|
-
LIST_EOH_NOTIFICATIONS: (page
|
|
199
|
-
`/notifications/eoh/?page=${page}&type=${type}`,
|
|
198
|
+
LIST_EOH_NOTIFICATIONS: (page) => `/notifications/eoh/?page=${page}`,
|
|
200
199
|
SET_READ: (id) => `/notifications/eoh/${id}/set_read/`,
|
|
201
200
|
},
|
|
202
201
|
VALUE_EVALUATIONS: () => '/property_manager/config_value_evaluations/',
|
|
@@ -8,6 +8,7 @@ import React, {
|
|
|
8
8
|
import { Image, Platform, TouchableOpacity, View, Switch } from 'react-native';
|
|
9
9
|
import { PopoverMode } from 'react-native-popover-view';
|
|
10
10
|
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
11
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
11
12
|
|
|
12
13
|
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
13
14
|
import styles from './Styles/indexStyles';
|
|
@@ -191,7 +192,7 @@ const ScriptDetail = ({ route }) => {
|
|
|
191
192
|
accessibilityLabel={AccessibilityLabel.ICON_MORE}
|
|
192
193
|
>
|
|
193
194
|
<View style={[styles.headerButton, styles.moreButton]}>
|
|
194
|
-
<
|
|
195
|
+
<MaterialIcons name={'more-vert'} size={27} color={Colors.Black} />
|
|
195
196
|
</View>
|
|
196
197
|
</TouchableOpacity>
|
|
197
198
|
</View>
|
|
@@ -197,7 +197,7 @@ const Automate = () => {
|
|
|
197
197
|
/* istanbul ignore next */
|
|
198
198
|
headerRight: () => (
|
|
199
199
|
<TouchableOpacity style={styles.buttonAdd}>
|
|
200
|
-
<AntDesign name={'
|
|
200
|
+
<AntDesign name={'pluscircle'} size={28} color={Colors.Orange} />
|
|
201
201
|
</TouchableOpacity>
|
|
202
202
|
),
|
|
203
203
|
});
|
|
@@ -9,6 +9,7 @@ import React, {
|
|
|
9
9
|
import { View, TouchableOpacity, Platform } from 'react-native';
|
|
10
10
|
import { useNavigation, useFocusEffect } from '@react-navigation/native';
|
|
11
11
|
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
12
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
12
13
|
import moment from 'moment';
|
|
13
14
|
|
|
14
15
|
import { SCContext } from '../../context';
|
|
@@ -684,9 +685,9 @@ const DeviceDetail = ({ route }) => {
|
|
|
684
685
|
>
|
|
685
686
|
<View style={styles.buttonStar}>
|
|
686
687
|
{isFavorite ? (
|
|
687
|
-
<AntDesign name="star" size={
|
|
688
|
+
<AntDesign name="star" size={30} color={Colors.Yellow6} />
|
|
688
689
|
) : (
|
|
689
|
-
<AntDesign name="
|
|
690
|
+
<AntDesign name="staro" size={30} />
|
|
690
691
|
)}
|
|
691
692
|
</View>
|
|
692
693
|
</TouchableOpacity>
|
|
@@ -705,7 +706,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
705
706
|
ref={refMenuAction}
|
|
706
707
|
accessibilityLabel={AccessibilityLabel.HEADER_DEVICE_BUTTON_MORE}
|
|
707
708
|
>
|
|
708
|
-
<
|
|
709
|
+
<MaterialIcons name={'more-vert'} size={27} color={Colors.Black} />
|
|
709
710
|
</TouchableOpacity>
|
|
710
711
|
</View>
|
|
711
712
|
),
|
|
@@ -7,7 +7,7 @@ import React, {
|
|
|
7
7
|
} from 'react';
|
|
8
8
|
import { View, TouchableOpacity, FlatList, Image } from 'react-native';
|
|
9
9
|
import { useNavigation } from '@react-navigation/native';
|
|
10
|
-
import
|
|
10
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
11
11
|
import moment from 'moment';
|
|
12
12
|
import styles from './styles/detailStyles';
|
|
13
13
|
import { HeaderCustom } from '../../commons/Header';
|
|
@@ -184,7 +184,11 @@ const HanetCameraDetail = ({ route }) => {
|
|
|
184
184
|
onPress={handleShowMenuAction}
|
|
185
185
|
ref={refMenuAction}
|
|
186
186
|
>
|
|
187
|
-
<
|
|
187
|
+
<MaterialIcons
|
|
188
|
+
name={'more-vert'}
|
|
189
|
+
size={27}
|
|
190
|
+
color={Colors.Black}
|
|
191
|
+
/>
|
|
188
192
|
</TouchableOpacity>
|
|
189
193
|
</View>
|
|
190
194
|
);
|
|
@@ -73,9 +73,7 @@ describe('test Notification', () => {
|
|
|
73
73
|
},
|
|
74
74
|
],
|
|
75
75
|
};
|
|
76
|
-
mock
|
|
77
|
-
.onGet(API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1, ''))
|
|
78
|
-
.reply(200, response);
|
|
76
|
+
mock.onGet(API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1)).reply(200, response);
|
|
79
77
|
await act(async () => {
|
|
80
78
|
tree = await create(wrapComponent());
|
|
81
79
|
});
|
|
@@ -101,9 +99,7 @@ describe('test Notification', () => {
|
|
|
101
99
|
type: 'NEWS',
|
|
102
100
|
});
|
|
103
101
|
}
|
|
104
|
-
mock
|
|
105
|
-
.onGet(API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1, ''))
|
|
106
|
-
.reply(200, response);
|
|
102
|
+
mock.onGet(API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1)).reply(200, response);
|
|
107
103
|
await act(async () => {
|
|
108
104
|
tree = await create(wrapComponent());
|
|
109
105
|
});
|
|
@@ -112,9 +108,7 @@ describe('test Notification', () => {
|
|
|
112
108
|
expect(wrapHeaderScrollable.props.disableLoadMore).toEqual(false);
|
|
113
109
|
|
|
114
110
|
const scrollView = instance.findByType(Animated.ScrollView);
|
|
115
|
-
mock
|
|
116
|
-
.onGet(API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(2, ''))
|
|
117
|
-
.reply(200, response);
|
|
111
|
+
mock.onGet(API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(2)).reply(200, response);
|
|
118
112
|
await act(async () => {
|
|
119
113
|
scrollView.props.onMomentumScrollEnd();
|
|
120
114
|
});
|
|
@@ -144,9 +138,7 @@ describe('test Notification', () => {
|
|
|
144
138
|
},
|
|
145
139
|
],
|
|
146
140
|
};
|
|
147
|
-
mock
|
|
148
|
-
.onGet(API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1, ''))
|
|
149
|
-
.reply(200, response);
|
|
141
|
+
mock.onGet(API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1)).reply(200, response);
|
|
150
142
|
await act(async () => {
|
|
151
143
|
tree = await create(wrapComponent());
|
|
152
144
|
});
|
|
@@ -179,9 +171,7 @@ describe('test Notification', () => {
|
|
|
179
171
|
},
|
|
180
172
|
],
|
|
181
173
|
};
|
|
182
|
-
mock
|
|
183
|
-
.onGet(API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1, ''))
|
|
184
|
-
.reply(200, response);
|
|
174
|
+
mock.onGet(API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1)).reply(200, response);
|
|
185
175
|
await act(async () => {
|
|
186
176
|
tree = await create(wrapComponent());
|
|
187
177
|
});
|
|
@@ -41,7 +41,7 @@ const Notification = memo(() => {
|
|
|
41
41
|
notImplemented(t);
|
|
42
42
|
}}
|
|
43
43
|
>
|
|
44
|
-
<AntDesign name={'
|
|
44
|
+
<AntDesign name={'search1'} size={27} color={Colors.Black} />
|
|
45
45
|
</TouchableOpacity>
|
|
46
46
|
</View>
|
|
47
47
|
),
|
|
@@ -51,7 +51,7 @@ const Notification = memo(() => {
|
|
|
51
51
|
|
|
52
52
|
const fetchNotifications = useCallback(async (pageParam) => {
|
|
53
53
|
const { success, data } = await axiosGet(
|
|
54
|
-
API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(pageParam
|
|
54
|
+
API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(pageParam)
|
|
55
55
|
);
|
|
56
56
|
if (success) {
|
|
57
57
|
setNotifications((preState) => preState.concat(data.results));
|
|
@@ -69,7 +69,7 @@ const Notification = memo(() => {
|
|
|
69
69
|
const onRefresh = useCallback(async () => {
|
|
70
70
|
setPage(1);
|
|
71
71
|
const { success, data } = await axiosGet(
|
|
72
|
-
API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1
|
|
72
|
+
API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1)
|
|
73
73
|
);
|
|
74
74
|
if (success) {
|
|
75
75
|
setNotifications(data.results);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
3
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
3
4
|
import { useNavigation, useIsFocused } from '@react-navigation/native';
|
|
4
5
|
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
5
6
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
@@ -81,11 +82,11 @@ const UnitMemberList = ({ route }) => {
|
|
|
81
82
|
onPress={onPressRightHeader}
|
|
82
83
|
style={styles.rightHeader}
|
|
83
84
|
>
|
|
84
|
-
|
|
85
|
-
name={
|
|
86
|
-
|
|
87
|
-
color={Colors.Black}
|
|
88
|
-
|
|
85
|
+
{isOwner ? (
|
|
86
|
+
<AntDesign name={'plus'} size={30} color={Colors.Black} />
|
|
87
|
+
) : (
|
|
88
|
+
<MaterialIcons name={'more-vert'} size={30} color={Colors.Black} />
|
|
89
|
+
)}
|
|
89
90
|
</TouchableOpacity>
|
|
90
91
|
);
|
|
91
92
|
|
|
@@ -6,6 +6,7 @@ import SmartTiviActionTemplate from '../../../../commons/ActionGroup/SmartTiviAc
|
|
|
6
6
|
import Text from '../../../../commons/Text';
|
|
7
7
|
import { ModalCustom } from '../../../../commons/Modal';
|
|
8
8
|
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
9
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
9
10
|
import { Colors } from '../../../../configs';
|
|
10
11
|
import TextInput from '../../../../commons/Form/TextInput';
|
|
11
12
|
import { ButtonsBottom } from './ButtonsBottom';
|
|
@@ -69,8 +70,8 @@ const GroupButtonByType = memo(({ route }) => {
|
|
|
69
70
|
style={[styles.headerButton]}
|
|
70
71
|
accessibilityLabel={AccessibilityLabel.HEADER_BUTTON_TYPE_MORE}
|
|
71
72
|
>
|
|
72
|
-
<
|
|
73
|
-
name={'more'}
|
|
73
|
+
<MaterialIcons
|
|
74
|
+
name={'more-vert'}
|
|
74
75
|
size={27}
|
|
75
76
|
color={Colors.Black}
|
|
76
77
|
accessibilityLabel={AccessibilityLabel.ICON_OUTLINE_TYPE_MORE}
|
|
@@ -15,6 +15,7 @@ import Text from '../../commons/Text';
|
|
|
15
15
|
|
|
16
16
|
import styles from './ManageSubUnitStyles';
|
|
17
17
|
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
18
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
18
19
|
import Routes from '../../utils/Route';
|
|
19
20
|
import { RowItem } from '../../commons/RowItem';
|
|
20
21
|
import NoSubUnitImage from '../../../assets/images/Illustrations.svg';
|
|
@@ -60,7 +61,7 @@ const ManageSubUnit = ({ route }) => {
|
|
|
60
61
|
// ref={refMenuAction}
|
|
61
62
|
style={[styles.headerButton, styles.moreButton]}
|
|
62
63
|
>
|
|
63
|
-
<
|
|
64
|
+
<MaterialIcons name={'more-vert'} size={27} color={Colors.Black} />
|
|
64
65
|
</TouchableOpacity>
|
|
65
66
|
</View>
|
|
66
67
|
),
|
|
@@ -6,7 +6,7 @@ import React, {
|
|
|
6
6
|
useState,
|
|
7
7
|
} from 'react';
|
|
8
8
|
import { View, TouchableOpacity } from 'react-native';
|
|
9
|
-
import
|
|
9
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
10
10
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
11
11
|
|
|
12
12
|
import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
|
|
@@ -163,7 +163,7 @@ const TemplateDetail = () => {
|
|
|
163
163
|
ref={refMenuAction}
|
|
164
164
|
style={styles.headerButton}
|
|
165
165
|
>
|
|
166
|
-
<
|
|
166
|
+
<MaterialIcons name={'more-vert'} size={27} color={Colors.Black} />
|
|
167
167
|
</TouchableOpacity>
|
|
168
168
|
</View>
|
|
169
169
|
);
|
|
@@ -4,7 +4,7 @@ import React, { memo, useRef } from 'react';
|
|
|
4
4
|
import styles from './SmartAccountStyles';
|
|
5
5
|
import { Colors } from '../../configs';
|
|
6
6
|
import Text from '../../commons/Text';
|
|
7
|
-
import
|
|
7
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
8
8
|
import { AccessibilityLabel } from '../../configs/Constants';
|
|
9
9
|
|
|
10
10
|
export const SmartAccountItem = memo(
|
|
@@ -44,7 +44,7 @@ export const SmartAccountItem = memo(
|
|
|
44
44
|
onPress={onPressMore}
|
|
45
45
|
ref={buttonMoreRef}
|
|
46
46
|
>
|
|
47
|
-
<
|
|
47
|
+
<MaterialIcons name={'more-vert'} size={27} color={Colors.Black} />
|
|
48
48
|
</TouchableOpacity>
|
|
49
49
|
</View>
|
|
50
50
|
);
|
|
@@ -10,6 +10,7 @@ import { AccessibilityLabel } from '../../configs/Constants';
|
|
|
10
10
|
import { useSCContextSelector } from '../../context';
|
|
11
11
|
|
|
12
12
|
const Summaries = memo(({ unit }) => {
|
|
13
|
+
const { id } = unit;
|
|
13
14
|
const [unitSummaries, setUnitSummaries] = useState([]);
|
|
14
15
|
const isFocused = useIsFocused();
|
|
15
16
|
const navigation = useNavigation();
|
|
@@ -17,12 +18,12 @@ const Summaries = memo(({ unit }) => {
|
|
|
17
18
|
const timeoutId = useRef(null);
|
|
18
19
|
|
|
19
20
|
const fetchUnitSummary = useCallback(async () => {
|
|
20
|
-
if (!
|
|
21
|
+
if (!id) {
|
|
21
22
|
return false;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const { success, data } = await axiosGet(
|
|
25
|
-
API.UNIT.UNIT_SUMMARY(
|
|
26
|
+
API.UNIT.UNIT_SUMMARY(id),
|
|
26
27
|
{},
|
|
27
28
|
true
|
|
28
29
|
);
|
|
@@ -31,18 +32,18 @@ const Summaries = memo(({ unit }) => {
|
|
|
31
32
|
return true;
|
|
32
33
|
}
|
|
33
34
|
return false;
|
|
34
|
-
}, [
|
|
35
|
+
}, [id]);
|
|
35
36
|
|
|
36
37
|
const goToSummary = useCallback(
|
|
37
38
|
(summary) => {
|
|
38
39
|
navigation.navigate(Routes.UnitSummary, {
|
|
39
40
|
summaryId: summary.id,
|
|
40
|
-
unitId:
|
|
41
|
+
unitId: id,
|
|
41
42
|
summaryData: summary,
|
|
42
43
|
unitData: unit,
|
|
43
44
|
});
|
|
44
45
|
},
|
|
45
|
-
[navigation, unit]
|
|
46
|
+
[navigation, unit, id]
|
|
46
47
|
);
|
|
47
48
|
|
|
48
49
|
const continuousFetchSummary = useCallback(async () => {
|
|
@@ -80,32 +81,25 @@ const Summaries = memo(({ unit }) => {
|
|
|
80
81
|
const { dataNotification } = useReceiveNotifications();
|
|
81
82
|
|
|
82
83
|
useEffect(() => {
|
|
83
|
-
if (dataNotification) {
|
|
84
|
-
|
|
85
|
-
if (summary_id) {
|
|
86
|
-
fetchUnitSummary();
|
|
87
|
-
}
|
|
84
|
+
if (dataNotification?.params?.summary_id) {
|
|
85
|
+
fetchUnitSummary();
|
|
88
86
|
}
|
|
89
87
|
}, [dataNotification, fetchUnitSummary]);
|
|
90
88
|
|
|
89
|
+
if (unitSummaries.length === 0) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
91
93
|
return (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
key={(item?.id || index).toString()}
|
|
102
|
-
item={item}
|
|
103
|
-
goToSummary={goToSummary}
|
|
104
|
-
/>
|
|
105
|
-
))}
|
|
106
|
-
</ScrollView>
|
|
107
|
-
)}
|
|
108
|
-
</>
|
|
94
|
+
<ScrollView
|
|
95
|
+
horizontal
|
|
96
|
+
scrollIndicatorInsets={{ right: 1 }}
|
|
97
|
+
accessibilityLabel={AccessibilityLabel.UNIT_DETAIL_UNIT_SUMMARY_VIEW}
|
|
98
|
+
>
|
|
99
|
+
{unitSummaries.map((item) => (
|
|
100
|
+
<SummaryItem key={item.id} item={item} goToSummary={goToSummary} />
|
|
101
|
+
))}
|
|
102
|
+
</ScrollView>
|
|
109
103
|
);
|
|
110
104
|
});
|
|
111
105
|
|
package/src/utils/Monitor.js
CHANGED
|
@@ -2,11 +2,11 @@ import { getPusher, destroyPusher } from './Pusher';
|
|
|
2
2
|
|
|
3
3
|
// eslint-disable-next-line promise/prefer-await-to-callbacks
|
|
4
4
|
export const watchNotificationData = (user, callback) => {
|
|
5
|
-
const channel = getPusher().subscribe(`private-user-${user.id}`);
|
|
6
|
-
channel.bind('new-notification', callback);
|
|
5
|
+
// const channel = getPusher().subscribe(`private-user-${user.id}`);
|
|
6
|
+
// channel.bind('new-notification', callback);
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export const unwatchNotificationData = (user) => {
|
|
10
|
-
getPusher().unsubscribe(`private-user-${user.id}`);
|
|
11
|
-
destroyPusher();
|
|
10
|
+
// getPusher().unsubscribe(`private-user-${user.id}`);
|
|
11
|
+
// destroyPusher();
|
|
12
12
|
};
|