@eohjsc/react-native-smart-city 0.3.26 → 0.3.29
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/index.js +2 -0
- package/package.json +1 -1
- package/src/Images/Common/device_icon.png +0 -0
- package/src/Images/DevMode/gateway.png +0 -0
- package/src/Images/DevMode/gateway@2x.png +0 -0
- package/src/Images/DevMode/gateway@3x.png +0 -0
- package/src/Images/DevMode/menu.png +0 -0
- package/src/Images/DevMode/menu@2x.png +0 -0
- package/src/Images/DevMode/menu@3x.png +0 -0
- package/src/Images/DevMode/search.png +0 -0
- package/src/Images/DevMode/search@2x.png +0 -0
- package/src/Images/DevMode/search@3x.png +0 -0
- package/src/Images/DevMode/smart.png +0 -0
- package/src/Images/DevMode/smart@2x.png +0 -0
- package/src/Images/DevMode/smart@3x.png +0 -0
- package/src/Images/DevMode/template.png +0 -0
- package/src/Images/DevMode/template@2x.png +0 -0
- package/src/Images/DevMode/template@3x.png +0 -0
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +1 -2
- package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +2 -0
- package/src/commons/ActionTemplate/CurtainAction.js +60 -0
- package/src/commons/ActionTemplate/CurtainActionStyles.js +11 -0
- package/src/commons/ActionTemplate/OnOffSmartLockAction.js +44 -0
- package/src/commons/ActionTemplate/OnOffSmartLockActionStyles.js +11 -0
- package/src/commons/ActionTemplate/index.js +18 -0
- package/src/commons/CameraDevice/index.js +1 -2
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +20 -12
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +2 -0
- package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +1 -1
- package/src/commons/ConnectingProcess/index.js +11 -0
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +55 -5
- package/src/commons/Dashboard/MyUnit/index.js +59 -12
- package/src/commons/DevMode/Label.js +10 -0
- package/src/commons/DevMode/Search.js +20 -0
- package/src/commons/DevMode/Styles/LabelStyles.js +8 -0
- package/src/commons/DevMode/Styles/SearchStyles.js +21 -0
- package/src/commons/DevMode/index.js +3 -0
- package/src/commons/Device/ItemDevice.js +1 -0
- package/src/commons/Form/TextInput.js +4 -0
- package/src/commons/HeaderAni/index.js +1 -0
- package/src/commons/MediaPlayerDetail/index.js +0 -20
- package/src/commons/MenuActionMore/index.js +12 -4
- package/src/commons/Modal/index.js +1 -2
- package/src/commons/NavBar/index.js +12 -1
- package/src/commons/Popover/index.js +26 -0
- package/src/commons/SubUnit/ShortDetail.js +1 -0
- package/src/commons/SummaryItem/index.js +2 -1
- package/src/commons/Tabbar/Styles/indexStyles.js +51 -0
- package/src/commons/Tabbar/index.js +110 -0
- package/src/commons/Unit/HeaderUnit/index.js +2 -0
- package/src/commons/Unit/SharedUnit.js +1 -0
- package/src/commons/WrapParallaxScrollView/index.js +16 -2
- package/src/configs/Colors.js +4 -0
- package/src/configs/Constants.js +5 -0
- package/src/configs/Images.js +6 -0
- package/src/context/actionType.ts +2 -0
- package/src/context/reducer.ts +10 -0
- package/src/hooks/Common/useGGHomeDeviceConnected.js +9 -2
- package/src/hooks/Common/usePopover.js +0 -8
- package/src/hooks/IoT/useGGHomeConnection.js +0 -1
- package/src/navigations/GatewayStack.js +23 -0
- package/src/navigations/Main.js +144 -0
- package/src/navigations/SmartStack.js +23 -0
- package/src/navigations/TemplateStack.js +23 -0
- package/src/navigations/UnitStack.js +10 -2
- package/src/screens/AddNewAction/SelectAction.js +6 -1
- package/src/screens/AllCamera/__test__/index.test.js +1 -8
- package/src/screens/AllCamera/index.js +0 -13
- package/src/screens/Device/hooks/__test__/useEmergencyButton.test.js +37 -0
- package/src/screens/Drawer/Drawer.test.js +24 -0
- package/src/screens/Drawer/index.js +198 -0
- package/src/screens/Gateway/__test__/index.test.js +16 -0
- package/src/screens/Gateway/index.js +8 -0
- package/src/screens/Notification/__test__/NotificationItem.test.js +79 -85
- package/src/screens/Notification/components/NotificationItem.js +37 -220
- package/src/screens/ScriptDetail/__test__/index.test.js +39 -3
- package/src/screens/ScriptDetail/index.js +7 -10
- package/src/screens/Smart/__test__/index.test.js +16 -0
- package/src/screens/Smart/index.js +8 -0
- package/src/screens/SubUnit/AddSubUnit.js +1 -1
- package/src/screens/SubUnit/EditSubUnit.js +4 -1
- package/src/screens/Template/Styles/indexStyles.js +51 -0
- package/src/screens/Template/__test__/index.test.js +16 -0
- package/src/screens/Template/index.js +84 -0
- package/src/screens/Unit/Detail.js +10 -27
- package/src/screens/Unit/MoreMenu.js +16 -1
- package/src/screens/Unit/SmartAccount.js +7 -6
- package/src/screens/Unit/Station/__test__/index.test.js +41 -0
- package/src/screens/Unit/Station/index.js +0 -1
- package/src/screens/Unit/Summaries.js +14 -2
- package/src/screens/Unit/__test__/Detail.test.js +1 -5
- package/src/screens/Unit/components/Header/index.js +1 -1
- package/src/screens/Unit/components/MyUnitDevice/index.js +29 -12
- package/src/screens/Unit/components/__test__/Header.test.js +1 -1
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
- package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +6 -5
- package/src/utils/Converter/__test__/timer.test.js +99 -0
- package/src/utils/Functions/Search.js +17 -0
- package/src/utils/Functions/ShortEmail.js +4 -0
- package/src/utils/Functions/__test__/Search.test.js +6 -0
- package/src/utils/Functions/__test__/ShortEmail.test.js +6 -0
- package/src/utils/I18n/translations/en.json +32 -42
- package/src/utils/I18n/translations/vi.json +32 -44
- package/src/utils/Route/index.js +6 -0
- package/src/commons/Modal/ModalFullVideo.js +0 -48
- package/src/commons/Modal/Styles/ModalFullVideoStyles.js +0 -26
- package/src/screens/Unit/components/MyUnit/index.js +0 -136
- package/src/screens/Unit/components/__test__/MyUnit.test.js +0 -35
|
@@ -50,57 +50,19 @@ describe('test NotificationItem', () => {
|
|
|
50
50
|
item = { ...item, is_read: false, content_code: '' };
|
|
51
51
|
});
|
|
52
52
|
let tree;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
62
|
-
params: { id: 1 },
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
content_code: NOTIFICATION_TYPES.REMIND_TO_SCAN_QR_CODE,
|
|
66
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
67
|
-
params: { id: 1 },
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
content_code: NOTIFICATION_TYPES.BOOKING_SUCCESSFULLY,
|
|
71
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
72
|
-
params: { id: 1 },
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
content_code: NOTIFICATION_TYPES.BOOKING_EXPIRED_AND_VIOLATION_CREATED,
|
|
76
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
77
|
-
params: { id: 1 },
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
content_code: NOTIFICATION_TYPES.MOVE_CAR_WITHOUT_PAY_VIOLATION,
|
|
81
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
82
|
-
params: { id: 1 },
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
content_code: NOTIFICATION_TYPES.PAY_FINE_SUCCESSFULLY,
|
|
86
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
87
|
-
params: { id: 1 },
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
content_code: NOTIFICATION_TYPES.STOP_VIOLATION_FREE_PARKING_ZONE,
|
|
91
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
92
|
-
params: { id: 1 },
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
content_code: NOTIFICATION_TYPES.PAY_FINE_AND_EXTEND_SUCCESSFULLY,
|
|
96
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
97
|
-
params: { id: 1 },
|
|
98
|
-
},
|
|
53
|
+
|
|
54
|
+
const listCase2 = [
|
|
55
|
+
NOTIFICATION_TYPES.NOTIFY_REMOVE_UNIT,
|
|
56
|
+
NOTIFICATION_TYPES.NOTIFY_REMOVE_MEMBER,
|
|
57
|
+
NOTIFICATION_TYPES.NOTIFY_MEMBER_LEAVE_UNIT,
|
|
58
|
+
NOTIFICATION_TYPES.NOTIFY_REMOVE_SUB_UNIT,
|
|
59
|
+
NOTIFICATION_TYPES.NOTIFY_REMOVE_DEVICE,
|
|
60
|
+
'default case',
|
|
99
61
|
];
|
|
100
62
|
|
|
101
|
-
for (const
|
|
102
|
-
test(`create ItemNotification ${
|
|
103
|
-
item.content_code =
|
|
63
|
+
for (const content_code of listCase2) {
|
|
64
|
+
test(`create ItemNotification ${content_code}`, () => {
|
|
65
|
+
item.content_code = content_code;
|
|
104
66
|
act(() => {
|
|
105
67
|
tree = create(wrapComponent(item));
|
|
106
68
|
});
|
|
@@ -109,33 +71,23 @@ describe('test NotificationItem', () => {
|
|
|
109
71
|
act(() => {
|
|
110
72
|
button.props.onPress();
|
|
111
73
|
});
|
|
112
|
-
expect(mockNavigate).
|
|
113
|
-
screen: notify.screen,
|
|
114
|
-
params: { id: 1 },
|
|
115
|
-
});
|
|
74
|
+
expect(mockNavigate).not.toHaveBeenCalled();
|
|
116
75
|
});
|
|
117
76
|
}
|
|
118
77
|
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
content_code: NOTIFICATION_TYPES.SYSTEM_CANCEL_NO_PAYMENT,
|
|
127
|
-
screen: Routes.MyBookingList,
|
|
128
|
-
params: { tab: 1 },
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
content_code: NOTIFICATION_TYPES.PARKING_COMPLETED,
|
|
132
|
-
screen: Routes.MyBookingList,
|
|
133
|
-
params: { tab: 1 },
|
|
134
|
-
},
|
|
78
|
+
const listCaseUnitDetail = [
|
|
79
|
+
NOTIFICATION_TYPES.NOTIFY_RENAME_UNIT,
|
|
80
|
+
NOTIFICATION_TYPES.NOTIFY_UPDATE_ADDRESS,
|
|
81
|
+
NOTIFICATION_TYPES.NOTIFY_RENAME_SUB_UNIT,
|
|
82
|
+
NOTIFICATION_TYPES.NOTIFY_INVITE_MEMBER,
|
|
135
83
|
];
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
84
|
+
|
|
85
|
+
for (const content_code of listCaseUnitDetail) {
|
|
86
|
+
test(`create ItemNotification ${content_code}`, () => {
|
|
87
|
+
item.content_code = content_code;
|
|
88
|
+
item.params = {
|
|
89
|
+
unit_id: 1,
|
|
90
|
+
};
|
|
139
91
|
act(() => {
|
|
140
92
|
tree = create(wrapComponent(item));
|
|
141
93
|
});
|
|
@@ -144,25 +96,24 @@ describe('test NotificationItem', () => {
|
|
|
144
96
|
act(() => {
|
|
145
97
|
button.props.onPress();
|
|
146
98
|
});
|
|
147
|
-
expect(mockNavigate).toHaveBeenCalledWith(Routes.
|
|
148
|
-
screen:
|
|
149
|
-
params: {
|
|
99
|
+
expect(mockNavigate).toHaveBeenCalledWith(Routes.UnitStack, {
|
|
100
|
+
screen: Routes.UnitDetail,
|
|
101
|
+
params: {
|
|
102
|
+
unitId: 1,
|
|
103
|
+
},
|
|
150
104
|
});
|
|
151
105
|
});
|
|
152
106
|
}
|
|
153
107
|
|
|
154
|
-
const
|
|
155
|
-
NOTIFICATION_TYPES.NOTIFY_REMOVE_UNIT,
|
|
156
|
-
NOTIFICATION_TYPES.NOTIFY_REMOVE_MEMBER,
|
|
157
|
-
NOTIFICATION_TYPES.NOTIFY_MEMBER_LEAVE_UNIT,
|
|
158
|
-
NOTIFICATION_TYPES.NOTIFY_REMOVE_SUB_UNIT,
|
|
159
|
-
NOTIFICATION_TYPES.NOTIFY_REMOVE_DEVICE,
|
|
160
|
-
'default case',
|
|
161
|
-
];
|
|
108
|
+
const listCaseDeviceDetail = [NOTIFICATION_TYPES.NOTIFY_DEVICE_DISCONNECT];
|
|
162
109
|
|
|
163
|
-
for (const content_code of
|
|
110
|
+
for (const content_code of listCaseDeviceDetail) {
|
|
164
111
|
test(`create ItemNotification ${content_code}`, () => {
|
|
165
112
|
item.content_code = content_code;
|
|
113
|
+
item.params = {
|
|
114
|
+
unit_id: 1,
|
|
115
|
+
sensor_id: 1,
|
|
116
|
+
};
|
|
166
117
|
act(() => {
|
|
167
118
|
tree = create(wrapComponent(item));
|
|
168
119
|
});
|
|
@@ -171,7 +122,13 @@ describe('test NotificationItem', () => {
|
|
|
171
122
|
act(() => {
|
|
172
123
|
button.props.onPress();
|
|
173
124
|
});
|
|
174
|
-
expect(mockNavigate).
|
|
125
|
+
expect(mockNavigate).toHaveBeenCalledWith(Routes.UnitStack, {
|
|
126
|
+
screen: Routes.DeviceDetail,
|
|
127
|
+
params: {
|
|
128
|
+
unitId: 1,
|
|
129
|
+
sensorId: 1,
|
|
130
|
+
},
|
|
131
|
+
});
|
|
175
132
|
});
|
|
176
133
|
}
|
|
177
134
|
|
|
@@ -208,6 +165,24 @@ describe('test NotificationItem', () => {
|
|
|
208
165
|
});
|
|
209
166
|
}
|
|
210
167
|
|
|
168
|
+
test('test case NOTIFY_INDICATOR no sensor_type', () => {
|
|
169
|
+
item.content_code = NOTIFICATION_TYPES.NOTIFY_INDICATOR;
|
|
170
|
+
item.params = {
|
|
171
|
+
sensor_type: null,
|
|
172
|
+
unit_id: 5,
|
|
173
|
+
summary_id: 11,
|
|
174
|
+
};
|
|
175
|
+
act(() => {
|
|
176
|
+
tree = create(wrapComponent(item));
|
|
177
|
+
});
|
|
178
|
+
const instance = tree.root;
|
|
179
|
+
const button = instance.findByType(TouchableOpacity);
|
|
180
|
+
act(() => {
|
|
181
|
+
button.props.onPress();
|
|
182
|
+
});
|
|
183
|
+
expect(mockNavigate).not.toHaveBeenCalled();
|
|
184
|
+
});
|
|
185
|
+
|
|
211
186
|
const listSensorType2 = [
|
|
212
187
|
SENSOR_TYPE.SMOKE,
|
|
213
188
|
SENSOR_TYPE.FIRE,
|
|
@@ -344,4 +319,23 @@ describe('test NotificationItem', () => {
|
|
|
344
319
|
},
|
|
345
320
|
});
|
|
346
321
|
});
|
|
322
|
+
|
|
323
|
+
test('test notify emergency not params type', () => {
|
|
324
|
+
item.content_code = NOTIFICATION_TYPES.NOTIFY_EMERGENCY;
|
|
325
|
+
item.params = {
|
|
326
|
+
unit_id: 1,
|
|
327
|
+
sensor_id: 1,
|
|
328
|
+
type: null,
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
act(() => {
|
|
332
|
+
tree = create(wrapComponent(item));
|
|
333
|
+
});
|
|
334
|
+
const instance = tree.root;
|
|
335
|
+
const button = instance.findByType(TouchableOpacity);
|
|
336
|
+
act(() => {
|
|
337
|
+
button.props.onPress();
|
|
338
|
+
});
|
|
339
|
+
expect(mockNavigate).not.toHaveBeenCalled();
|
|
340
|
+
});
|
|
347
341
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { memo, useCallback,
|
|
1
|
+
import React, { memo, useCallback, useState } from 'react';
|
|
2
2
|
import { View, TouchableOpacity, Image } from 'react-native';
|
|
3
3
|
import moment from 'moment';
|
|
4
4
|
import { useNavigation } from '@react-navigation/native';
|
|
@@ -23,38 +23,30 @@ const NotificationItem = memo(({ item }) => {
|
|
|
23
23
|
const [isRead, setIsRead] = useState(is_read);
|
|
24
24
|
const timeFormat = moment(created_at).format('LT DD/MM/YYYY');
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
i % 2 === 0 ? (
|
|
37
|
-
<Text type="Body" key={i} style={styles.textNotification}>
|
|
38
|
-
{str}
|
|
39
|
-
</Text>
|
|
40
|
-
) : (
|
|
41
|
-
<Text type="Body" bold key={i} style={styles.textNotification}>
|
|
42
|
-
{colorParams[(i - 1) / 2]}
|
|
26
|
+
const customColorText = useCallback(
|
|
27
|
+
(text) => {
|
|
28
|
+
return text.split('**').map((str, i) => (
|
|
29
|
+
<Text
|
|
30
|
+
type="Body"
|
|
31
|
+
bold={i % 2 !== 0}
|
|
32
|
+
key={i}
|
|
33
|
+
style={styles.textNotification}
|
|
34
|
+
>
|
|
35
|
+
{i % 2 === 0 ? str : params[str]}
|
|
43
36
|
</Text>
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
));
|
|
38
|
+
},
|
|
39
|
+
[params]
|
|
40
|
+
);
|
|
47
41
|
|
|
48
42
|
const renderItem = useCallback(() => {
|
|
49
|
-
const booking_id = params?.booking_id && params?.booking_id;
|
|
50
43
|
const unitId = params?.unit_id;
|
|
51
44
|
const sensorId = params?.sensor_id;
|
|
52
45
|
switch (content_code) {
|
|
53
46
|
case NOTIFICATION_TYPES.NOTIFY_INVITE_MEMBER:
|
|
54
47
|
return {
|
|
55
48
|
content: customColorText(
|
|
56
|
-
t('text_notification_content_invite_member')
|
|
57
|
-
arrParams
|
|
49
|
+
t('text_notification_content_invite_member')
|
|
58
50
|
),
|
|
59
51
|
redirect: () => {
|
|
60
52
|
navigation.navigate(Routes.UnitStack, {
|
|
@@ -71,160 +63,12 @@ const NotificationItem = memo(({ item }) => {
|
|
|
71
63
|
/>
|
|
72
64
|
),
|
|
73
65
|
};
|
|
74
|
-
case NOTIFICATION_TYPES.REMIND_TO_MAKE_PAYMENT:
|
|
75
|
-
return {
|
|
76
|
-
content: customColorText(
|
|
77
|
-
t('text_notification_content_remind_to_make_payment'),
|
|
78
|
-
arrParams
|
|
79
|
-
),
|
|
80
|
-
redirect: () =>
|
|
81
|
-
navigation.navigate(Routes.SmartParkingStack, {
|
|
82
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
83
|
-
params: { id: booking_id },
|
|
84
|
-
}),
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
case NOTIFICATION_TYPES.EXPIRE_PARKING_SESSION:
|
|
88
|
-
return {
|
|
89
|
-
content: customColorText(
|
|
90
|
-
t('text_notification_content_expire_parking_session'),
|
|
91
|
-
arrParams
|
|
92
|
-
),
|
|
93
|
-
redirect: () =>
|
|
94
|
-
navigation.navigate(Routes.SmartParkingStack, {
|
|
95
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
96
|
-
params: { id: booking_id },
|
|
97
|
-
}),
|
|
98
|
-
};
|
|
99
|
-
case NOTIFICATION_TYPES.REMIND_TO_SCAN_QR_CODE:
|
|
100
|
-
return {
|
|
101
|
-
content: customColorText(
|
|
102
|
-
t('text_notification_content_remind_to_scan_qr_code'),
|
|
103
|
-
arrParams
|
|
104
|
-
),
|
|
105
|
-
redirect: () =>
|
|
106
|
-
navigation.navigate(Routes.SmartParkingStack, {
|
|
107
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
108
|
-
params: { id: booking_id },
|
|
109
|
-
}),
|
|
110
|
-
};
|
|
111
|
-
case NOTIFICATION_TYPES.USER_CANCEL:
|
|
112
|
-
return {
|
|
113
|
-
content: customColorText(
|
|
114
|
-
t('text_notification_content_user_cancel'),
|
|
115
|
-
arrParams
|
|
116
|
-
),
|
|
117
|
-
redirect: () =>
|
|
118
|
-
navigation.navigate(Routes.SmartParkingStack, {
|
|
119
|
-
screen: Routes.MyBookingList,
|
|
120
|
-
params: { tab: 1 },
|
|
121
|
-
}),
|
|
122
|
-
};
|
|
123
|
-
case NOTIFICATION_TYPES.SYSTEM_CANCEL_NO_PAYMENT:
|
|
124
|
-
return {
|
|
125
|
-
content: customColorText(
|
|
126
|
-
t('text_notification_content_system_cancel_no_payment'),
|
|
127
|
-
arrParams
|
|
128
|
-
),
|
|
129
|
-
redirect: () =>
|
|
130
|
-
navigation.navigate(Routes.SmartParkingStack, {
|
|
131
|
-
screen: Routes.MyBookingList,
|
|
132
|
-
params: { tab: 1 },
|
|
133
|
-
}),
|
|
134
|
-
};
|
|
135
|
-
case NOTIFICATION_TYPES.BOOKING_SUCCESSFULLY:
|
|
136
|
-
return {
|
|
137
|
-
content: customColorText(
|
|
138
|
-
t('text_notification_content_booking_successfully'),
|
|
139
|
-
arrParams
|
|
140
|
-
),
|
|
141
|
-
redirect: () =>
|
|
142
|
-
navigation.navigate(Routes.SmartParkingStack, {
|
|
143
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
144
|
-
params: { id: booking_id },
|
|
145
|
-
}),
|
|
146
|
-
};
|
|
147
|
-
case NOTIFICATION_TYPES.PARKING_COMPLETED:
|
|
148
|
-
return {
|
|
149
|
-
content: customColorText(
|
|
150
|
-
t('text_notification_content_parking_completed'),
|
|
151
|
-
arrParams
|
|
152
|
-
),
|
|
153
|
-
redirect: () =>
|
|
154
|
-
navigation.navigate(Routes.SmartParkingStack, {
|
|
155
|
-
screen: Routes.MyBookingList,
|
|
156
|
-
params: { tab: 1 },
|
|
157
|
-
}),
|
|
158
|
-
};
|
|
159
|
-
case NOTIFICATION_TYPES.BOOKING_EXPIRED_AND_VIOLATION_CREATED:
|
|
160
|
-
return {
|
|
161
|
-
content: customColorText(
|
|
162
|
-
t(
|
|
163
|
-
'text_notification_content_not_move_car_after_parking_session_expire'
|
|
164
|
-
),
|
|
165
|
-
arrParams
|
|
166
|
-
),
|
|
167
|
-
redirect: () =>
|
|
168
|
-
navigation.navigate(Routes.SmartParkingStack, {
|
|
169
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
170
|
-
params: { id: params?.violated_booking_id || booking_id },
|
|
171
|
-
}),
|
|
172
|
-
};
|
|
173
|
-
case NOTIFICATION_TYPES.MOVE_CAR_WITHOUT_PAY_VIOLATION:
|
|
174
|
-
return {
|
|
175
|
-
content: customColorText(
|
|
176
|
-
t('text_notification_content_move_car_without_pay_violation'),
|
|
177
|
-
arrParams
|
|
178
|
-
),
|
|
179
|
-
redirect: () =>
|
|
180
|
-
navigation.navigate(Routes.SmartParkingStack, {
|
|
181
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
182
|
-
params: { id: booking_id },
|
|
183
|
-
}),
|
|
184
|
-
};
|
|
185
|
-
case NOTIFICATION_TYPES.PAY_FINE_SUCCESSFULLY:
|
|
186
|
-
return {
|
|
187
|
-
content: customColorText(
|
|
188
|
-
t('text_notification_content_pay_fine_successfully'),
|
|
189
|
-
arrParams
|
|
190
|
-
),
|
|
191
|
-
redirect: () =>
|
|
192
|
-
navigation.navigate(Routes.SmartParkingStack, {
|
|
193
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
194
|
-
params: { id: booking_id },
|
|
195
|
-
}),
|
|
196
|
-
};
|
|
197
|
-
case NOTIFICATION_TYPES.PAY_FINE_AND_EXTEND_SUCCESSFULLY:
|
|
198
|
-
return {
|
|
199
|
-
content: customColorText(
|
|
200
|
-
t('text_notification_content_pay_fine_and_extend_successfully'),
|
|
201
|
-
arrParams
|
|
202
|
-
),
|
|
203
|
-
redirect: () =>
|
|
204
|
-
navigation.navigate(Routes.SmartParkingStack, {
|
|
205
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
206
|
-
params: { id: params?.booking_id_new },
|
|
207
|
-
}),
|
|
208
|
-
};
|
|
209
|
-
case NOTIFICATION_TYPES.STOP_VIOLATION_FREE_PARKING_ZONE:
|
|
210
|
-
return {
|
|
211
|
-
content: customColorText(
|
|
212
|
-
t('text_notification_content_stop_violation_free_parking_zone'),
|
|
213
|
-
arrParams
|
|
214
|
-
),
|
|
215
|
-
redirect: () =>
|
|
216
|
-
navigation.navigate(Routes.SmartParkingStack, {
|
|
217
|
-
screen: Routes.SmartParkingBookingDetails,
|
|
218
|
-
params: { id: booking_id },
|
|
219
|
-
}),
|
|
220
|
-
};
|
|
221
66
|
case NOTIFICATION_TYPES.NOTIFY_INDICATOR:
|
|
222
67
|
switch (params?.sensor_type) {
|
|
223
68
|
case SENSOR_TYPE.AIR_QUALITY:
|
|
224
69
|
return {
|
|
225
70
|
content: customColorText(
|
|
226
|
-
t('text_notification_content_air_quality_high')
|
|
227
|
-
arrParams
|
|
71
|
+
t('text_notification_content_air_quality_high')
|
|
228
72
|
),
|
|
229
73
|
redirect: () =>
|
|
230
74
|
navigation.navigate(Routes.UnitStack, {
|
|
@@ -239,8 +83,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
239
83
|
case SENSOR_TYPE.TURBIDITY:
|
|
240
84
|
return {
|
|
241
85
|
content: customColorText(
|
|
242
|
-
t('text_notification_content_turbility_high')
|
|
243
|
-
arrParams
|
|
86
|
+
t('text_notification_content_turbility_high')
|
|
244
87
|
),
|
|
245
88
|
redirect: () =>
|
|
246
89
|
navigation.navigate(Routes.UnitStack, {
|
|
@@ -255,8 +98,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
255
98
|
case SENSOR_TYPE.PH:
|
|
256
99
|
return {
|
|
257
100
|
content: customColorText(
|
|
258
|
-
t('text_notification_content_pH_index_high')
|
|
259
|
-
arrParams
|
|
101
|
+
t('text_notification_content_pH_index_high')
|
|
260
102
|
),
|
|
261
103
|
redirect: () =>
|
|
262
104
|
navigation.navigate(Routes.UnitStack, {
|
|
@@ -270,10 +112,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
270
112
|
};
|
|
271
113
|
case SENSOR_TYPE.CLO:
|
|
272
114
|
return {
|
|
273
|
-
content: customColorText(
|
|
274
|
-
t('text_notification_content_clo_high'),
|
|
275
|
-
arrParams
|
|
276
|
-
),
|
|
115
|
+
content: customColorText(t('text_notification_content_clo_high')),
|
|
277
116
|
redirect: () =>
|
|
278
117
|
navigation.navigate(Routes.UnitStack, {
|
|
279
118
|
screen: Routes.UnitSummary,
|
|
@@ -287,8 +126,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
287
126
|
case SENSOR_TYPE.UV:
|
|
288
127
|
return {
|
|
289
128
|
content: customColorText(
|
|
290
|
-
t('text_notification_content_uv_index_high')
|
|
291
|
-
arrParams
|
|
129
|
+
t('text_notification_content_uv_index_high')
|
|
292
130
|
),
|
|
293
131
|
redirect: () =>
|
|
294
132
|
navigation.navigate(Routes.UnitStack, {
|
|
@@ -302,10 +140,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
302
140
|
};
|
|
303
141
|
case SENSOR_TYPE.SMOKE:
|
|
304
142
|
return {
|
|
305
|
-
content: customColorText(
|
|
306
|
-
t('text_notification_content_smoke'),
|
|
307
|
-
arrParams
|
|
308
|
-
),
|
|
143
|
+
content: customColorText(t('text_notification_content_smoke')),
|
|
309
144
|
redirect: () =>
|
|
310
145
|
navigation.navigate(Routes.UnitStack, {
|
|
311
146
|
screen: Routes.DeviceDetail,
|
|
@@ -318,10 +153,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
318
153
|
};
|
|
319
154
|
case SENSOR_TYPE.FIRE:
|
|
320
155
|
return {
|
|
321
|
-
content: customColorText(
|
|
322
|
-
t('text_notification_content_fire'),
|
|
323
|
-
arrParams
|
|
324
|
-
),
|
|
156
|
+
content: customColorText(t('text_notification_content_fire')),
|
|
325
157
|
redirect: () =>
|
|
326
158
|
navigation.navigate(Routes.UnitStack, {
|
|
327
159
|
screen: Routes.DeviceDetail,
|
|
@@ -335,8 +167,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
335
167
|
case SENSOR_TYPE.SOS:
|
|
336
168
|
return {
|
|
337
169
|
content: customColorText(
|
|
338
|
-
t('text_notification_content_active_sos')
|
|
339
|
-
arrParams
|
|
170
|
+
t('text_notification_content_active_sos')
|
|
340
171
|
),
|
|
341
172
|
redirect: () =>
|
|
342
173
|
navigation.navigate(Routes.UnitStack, {
|
|
@@ -351,8 +182,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
351
182
|
case SENSOR_TYPE.FILTER_WATER:
|
|
352
183
|
return {
|
|
353
184
|
content: customColorText(
|
|
354
|
-
t('text_notification_content_replace_water_filter')
|
|
355
|
-
arrParams
|
|
185
|
+
t('text_notification_content_replace_water_filter')
|
|
356
186
|
),
|
|
357
187
|
redirect: () =>
|
|
358
188
|
navigation.navigate(Routes.UnitStack, {
|
|
@@ -379,8 +209,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
379
209
|
content: customColorText(
|
|
380
210
|
params?.unit_owner_name
|
|
381
211
|
? t('text_notification_content_remove_unit_to_member')
|
|
382
|
-
: t('text_notification_content_remove_unit_to_owner')
|
|
383
|
-
arrParams
|
|
212
|
+
: t('text_notification_content_remove_unit_to_owner')
|
|
384
213
|
),
|
|
385
214
|
redirect: () => null,
|
|
386
215
|
iconContent: (
|
|
@@ -390,8 +219,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
390
219
|
case NOTIFICATION_TYPES.NOTIFY_REMOVE_MEMBER:
|
|
391
220
|
return {
|
|
392
221
|
content: customColorText(
|
|
393
|
-
t('text_notification_content_remove_member')
|
|
394
|
-
arrParams
|
|
222
|
+
t('text_notification_content_remove_member')
|
|
395
223
|
),
|
|
396
224
|
redirect: () => null,
|
|
397
225
|
iconContent: (
|
|
@@ -401,8 +229,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
401
229
|
case NOTIFICATION_TYPES.NOTIFY_MEMBER_LEAVE_UNIT:
|
|
402
230
|
return {
|
|
403
231
|
content: customColorText(
|
|
404
|
-
t('text_notification_content_member_leave_unit')
|
|
405
|
-
arrParams
|
|
232
|
+
t('text_notification_content_member_leave_unit')
|
|
406
233
|
),
|
|
407
234
|
redirect: () => null,
|
|
408
235
|
iconContent: (
|
|
@@ -411,10 +238,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
411
238
|
};
|
|
412
239
|
case NOTIFICATION_TYPES.NOTIFY_RENAME_UNIT:
|
|
413
240
|
return {
|
|
414
|
-
content: customColorText(
|
|
415
|
-
t('text_notification_content_rename_unit'),
|
|
416
|
-
arrParams
|
|
417
|
-
),
|
|
241
|
+
content: customColorText(t('text_notification_content_rename_unit')),
|
|
418
242
|
redirect: () => {
|
|
419
243
|
navigation.navigate(Routes.UnitStack, {
|
|
420
244
|
screen: Routes.UnitDetail,
|
|
@@ -430,8 +254,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
430
254
|
case NOTIFICATION_TYPES.NOTIFY_DEVICE_DISCONNECT:
|
|
431
255
|
return {
|
|
432
256
|
content: customColorText(
|
|
433
|
-
t('text_notification_content_divice_disconnect')
|
|
434
|
-
arrParams
|
|
257
|
+
t('text_notification_content_divice_disconnect')
|
|
435
258
|
),
|
|
436
259
|
redirect: () => {
|
|
437
260
|
navigation.navigate(Routes.UnitStack, {
|
|
@@ -446,8 +269,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
446
269
|
case NOTIFICATION_TYPES.NOTIFY_UPDATE_ADDRESS:
|
|
447
270
|
return {
|
|
448
271
|
content: customColorText(
|
|
449
|
-
t('text_notification_content_update_address')
|
|
450
|
-
arrParams
|
|
272
|
+
t('text_notification_content_update_address')
|
|
451
273
|
),
|
|
452
274
|
redirect: () => {
|
|
453
275
|
navigation.navigate(Routes.UnitStack, {
|
|
@@ -464,8 +286,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
464
286
|
case NOTIFICATION_TYPES.NOTIFY_RENAME_SUB_UNIT:
|
|
465
287
|
return {
|
|
466
288
|
content: customColorText(
|
|
467
|
-
t('text_notification_content_rename_sub_unit')
|
|
468
|
-
arrParams
|
|
289
|
+
t('text_notification_content_rename_sub_unit')
|
|
469
290
|
),
|
|
470
291
|
redirect: () => {
|
|
471
292
|
navigation.navigate(Routes.UnitStack, {
|
|
@@ -483,8 +304,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
483
304
|
case NOTIFICATION_TYPES.NOTIFY_REMOVE_SUB_UNIT:
|
|
484
305
|
return {
|
|
485
306
|
content: customColorText(
|
|
486
|
-
t('text_notification_content_remove_sub_unit')
|
|
487
|
-
arrParams
|
|
307
|
+
t('text_notification_content_remove_sub_unit')
|
|
488
308
|
),
|
|
489
309
|
redirect: () => null,
|
|
490
310
|
iconContent: (
|
|
@@ -494,8 +314,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
494
314
|
case NOTIFICATION_TYPES.NOTIFY_REMOVE_DEVICE:
|
|
495
315
|
return {
|
|
496
316
|
content: customColorText(
|
|
497
|
-
t('text_notification_content_remove_device')
|
|
498
|
-
arrParams
|
|
317
|
+
t('text_notification_content_remove_device')
|
|
499
318
|
),
|
|
500
319
|
redirect: () => null,
|
|
501
320
|
iconContent: (
|
|
@@ -507,8 +326,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
507
326
|
case EMERGENCY_TYPE.CREATED:
|
|
508
327
|
return {
|
|
509
328
|
content: customColorText(
|
|
510
|
-
t('text_notification_content_emergency')
|
|
511
|
-
arrParams
|
|
329
|
+
t('text_notification_content_emergency')
|
|
512
330
|
),
|
|
513
331
|
redirect: () =>
|
|
514
332
|
navigation.navigate(Routes.UnitStack, {
|
|
@@ -523,8 +341,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
523
341
|
case EMERGENCY_TYPE.RESOLVE:
|
|
524
342
|
return {
|
|
525
343
|
content: customColorText(
|
|
526
|
-
t('text_notification_content_emergency_resolve')
|
|
527
|
-
arrParams
|
|
344
|
+
t('text_notification_content_emergency_resolve')
|
|
528
345
|
),
|
|
529
346
|
redirect: () =>
|
|
530
347
|
navigation.navigate(Routes.UnitStack, {
|
|
@@ -552,7 +369,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
552
369
|
iconContent: <Image source={Images.logo} style={styles.logo} />,
|
|
553
370
|
};
|
|
554
371
|
}
|
|
555
|
-
}, [
|
|
372
|
+
}, [content_code, customColorText, navigation, params, t]);
|
|
556
373
|
|
|
557
374
|
const { content, redirect, iconContent } = renderItem() || {};
|
|
558
375
|
|