@eohjsc/react-native-smart-city 0.2.85 → 0.2.88

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.
Files changed (148) hide show
  1. package/assets/images/Common/Calendar.svg +3 -0
  2. package/assets/images/Common/SmartPhone.svg +3 -0
  3. package/assets/images/Device/button-lock.svg +3 -0
  4. package/assets/images/Device/button-unlock.svg +3 -0
  5. package/assets/images/Hanet/CaptureFaceID.svg +25 -0
  6. package/assets/images/Hanet/FaceFrame.svg +6 -0
  7. package/assets/images/brightnessBlack.svg +12 -0
  8. package/index.js +4 -0
  9. package/package.json +2 -2
  10. package/src/Images/SmartIr/AC.svg +14 -0
  11. package/src/Images/SmartIr/DIY.svg +3 -0
  12. package/src/Images/SmartIr/Fan.svg +10 -0
  13. package/src/Images/SmartIr/Fridge.svg +5 -0
  14. package/src/Images/SmartIr/Remote.svg +15 -0
  15. package/src/Images/SmartIr/SmartIr.svg +4 -0
  16. package/src/Images/SmartIr/TV.svg +10 -0
  17. package/src/Images/SmartIr/Union.svg +9 -0
  18. package/src/Images/SmartIr/WM.svg +11 -0
  19. package/src/Images/SmartIr/index.js +10 -0
  20. package/src/commons/ActionGroup/ColorPickerTemplate.js +51 -0
  21. package/src/commons/ActionGroup/ColorPickerTemplateStyles.js +17 -0
  22. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/AutoLockStyles.js +40 -0
  23. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +65 -0
  24. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapperStyles.js +43 -0
  25. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +48 -0
  26. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +57 -0
  27. package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +48 -0
  28. package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLockStyle.js +51 -0
  29. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +48 -0
  30. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscodeStyles.js +42 -0
  31. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/PasscodeListStyles.js +49 -0
  32. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +66 -0
  33. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +96 -0
  34. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/SetupGeneratePasscodeStyles.js +98 -0
  35. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +62 -0
  36. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +249 -0
  37. package/src/commons/ActionGroup/OnOffTemplate/index.js +4 -2
  38. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -1
  39. package/src/commons/ActionGroup/SliderRangeTemplate.js +64 -0
  40. package/src/commons/ActionGroup/{LightActionTemplateStyles.js → SliderRangeTemplateStyles.js} +0 -8
  41. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +167 -186
  42. package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -1
  43. package/src/commons/ActionGroup/index.js +9 -3
  44. package/src/commons/BottomSheet/index.js +2 -1
  45. package/src/commons/ConnectingProcess/index.js +5 -2
  46. package/src/commons/Device/DisconnectedView.js +7 -1
  47. package/src/commons/Device/Hanet/ItemHanetDevice.js +109 -0
  48. package/src/commons/Device/HistoryChart.js +2 -2
  49. package/src/commons/Device/HorizontalBarChart.js +7 -0
  50. package/src/commons/Device/ItemDevice.js +24 -16
  51. package/src/commons/Device/LinearChart.js +14 -41
  52. package/src/commons/Device/__test__/DisconnectedView.test.js +13 -2
  53. package/src/commons/MediaPlayer/__test__/index.test.js +45 -0
  54. package/src/commons/RowItem/index.js +12 -7
  55. package/src/commons/SubUnit/Favorites/index.js +2 -2
  56. package/src/commons/SubUnit/ShortDetail.js +48 -41
  57. package/src/commons/SubUnit/__test__/ShortDetail.test.js +57 -48
  58. package/src/commons/WheelDateTimePicker/index.js +18 -4
  59. package/src/configs/API.js +24 -2
  60. package/src/configs/Colors.js +1 -0
  61. package/src/configs/Constants.js +61 -0
  62. package/src/configs/SCConfig.js +1 -1
  63. package/src/context/actionType.ts +4 -0
  64. package/src/context/mockStore.ts +3 -0
  65. package/src/context/reducer.ts +20 -0
  66. package/src/iot/RemoteControl/Bluetooth.js +3 -22
  67. package/src/iot/RemoteControl/index.js +0 -1
  68. package/src/navigations/HanetCameraStack.js +41 -0
  69. package/src/navigations/SmartIrStack.js +31 -0
  70. package/src/navigations/SmartLockStack.js +51 -0
  71. package/src/navigations/UnitStack.js +46 -4
  72. package/src/screens/ActivityLog/hooks/index.js +17 -3
  73. package/src/screens/ActivityLog/index.js +3 -0
  74. package/src/screens/AddCommon/SelectSubUnit.js +1 -0
  75. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +1 -1
  76. package/src/screens/AddNewAction/SelectSensorDevices.js +4 -2
  77. package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +88 -73
  78. package/src/screens/AddNewGateway/PlugAndPlay/FirstWarning.js +4 -2
  79. package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +155 -27
  80. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +65 -0
  81. package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +26 -2
  82. package/src/screens/AddNewOneTap/index.js +32 -17
  83. package/src/screens/Automate/index.js +2 -2
  84. package/src/screens/Device/EditDevice/index.js +5 -3
  85. package/src/screens/Device/__test__/detail.test.js +0 -10
  86. package/src/screens/Device/components/SensorConnectStatusViewHeader.js +13 -2
  87. package/src/screens/Device/components/SensorDisplayItem.js +3 -0
  88. package/src/screens/Device/detail.js +119 -38
  89. package/src/screens/Device/hooks/useDisconnectedDevice.js +28 -16
  90. package/src/screens/GuestInfo/components/AccessScheduleItem.js +9 -2
  91. package/src/screens/GuestInfo/components/RecurringDetail.js +3 -2
  92. package/src/screens/GuestInfo/components/TemporaryDetail.js +3 -2
  93. package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +3 -0
  94. package/src/screens/HanetCamera/CaptureFaceID.js +210 -0
  95. package/src/screens/HanetCamera/Detail.js +252 -0
  96. package/src/screens/HanetCamera/ManageAccess.js +173 -0
  97. package/src/screens/HanetCamera/MemberInfo.js +208 -0
  98. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +133 -0
  99. package/src/screens/HanetCamera/__test__/Detail.test.js +185 -0
  100. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +152 -0
  101. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +178 -0
  102. package/src/screens/HanetCamera/components/CheckinHeader.js +37 -0
  103. package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +151 -0
  104. package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +71 -0
  105. package/src/screens/HanetCamera/hooks/index.js +5 -0
  106. package/src/screens/HanetCamera/hooks/useHanetCheckinData.js +116 -0
  107. package/src/screens/HanetCamera/hooks/useHanetPlaceMembers.js +86 -0
  108. package/src/screens/HanetCamera/hooks/useStateAlertAction.js +62 -0
  109. package/src/screens/HanetCamera/styles/captureFaceIDStyles.js +50 -0
  110. package/src/screens/HanetCamera/styles/checkinHeaderStyles.js +24 -0
  111. package/src/screens/HanetCamera/styles/detailStyles.js +107 -0
  112. package/src/screens/HanetCamera/styles/manageAccessStyles.js +49 -0
  113. package/src/screens/HanetCamera/styles/memberInfoStyles.js +73 -0
  114. package/src/screens/HanetCamera/utils/Monitor.js +52 -0
  115. package/src/screens/Notification/__test__/NotificationItem.test.js +16 -3
  116. package/src/screens/Notification/components/NotificationItem.js +68 -8
  117. package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +1 -0
  118. package/src/screens/ScanChipQR/hooks/index.js +90 -44
  119. package/src/screens/ScriptDetail/index.js +1 -6
  120. package/src/screens/SelectUnit/index.js +1 -0
  121. package/src/screens/SharedUnit/index.js +1 -1
  122. package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +31 -0
  123. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +80 -0
  124. package/src/screens/SmartIr/__test__/SelectBrand.test.js +65 -0
  125. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +57 -0
  126. package/src/screens/SmartIr/__test__/SmartIr.test.js +62 -0
  127. package/src/screens/SmartIr/components/GroupButtonByType/ButtonsBottom.js +45 -0
  128. package/src/screens/SmartIr/components/GroupButtonByType/ButtonsBottomStyles.js +31 -0
  129. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +208 -0
  130. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByTypeStyles.js +113 -0
  131. package/src/screens/SmartIr/components/SelectBrand.js +61 -0
  132. package/src/screens/SmartIr/components/SelectBrandStyles.js +14 -0
  133. package/src/screens/SmartIr/components/SelectDeviceType.js +96 -0
  134. package/src/screens/SmartIr/components/SelectDeviceTypeStyles.js +30 -0
  135. package/src/screens/SmartIr/index.js +28 -0
  136. package/src/screens/SmartIr/styles.js +14 -0
  137. package/src/screens/Unit/AddMenu.js +4 -1
  138. package/src/screens/Unit/Detail.js +8 -12
  139. package/src/screens/Unit/__test__/Detail.test.js +0 -10
  140. package/src/screens/Unit/components/MyUnitDevice/index.js +2 -4
  141. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +38 -9
  142. package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/__test__/index.test.js +32 -1
  143. package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/index.js +1 -1
  144. package/src/utils/I18n/translations/en.json +59 -2
  145. package/src/utils/I18n/translations/vi.json +59 -2
  146. package/src/utils/Route/index.js +14 -0
  147. package/src/commons/ActionGroup/LightActionTemplate.js +0 -103
  148. package/src/commons/ActionGroup/__test__/LightActionTemplate.test.js +0 -59
@@ -0,0 +1,50 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { Colors } from '../../../configs';
3
+
4
+ export default StyleSheet.create({
5
+ container: {
6
+ flex: 1,
7
+ backgroundColor: Colors.White,
8
+ },
9
+ center: {
10
+ flex: 1,
11
+ alignItems: 'center',
12
+ justifyContent: 'center',
13
+ },
14
+ textDes: {
15
+ marginTop: 30,
16
+ fontSize: 18,
17
+ },
18
+ wrapCamera: {
19
+ flex: 1,
20
+ },
21
+ camera: {
22
+ height: '90%',
23
+ width: '100%',
24
+ alignItems: 'center',
25
+ justifyContent: 'flex-end',
26
+ },
27
+ maskOutter: {
28
+ position: 'absolute',
29
+ alignSelf: 'center',
30
+ top: '12%',
31
+ },
32
+ wrapBottom: {
33
+ paddingBottom: 24,
34
+ paddingTop: 30,
35
+ justifyContent: 'space-between',
36
+ backgroundColor: Colors.White,
37
+ },
38
+ bottomButton: {
39
+ padding: 12,
40
+ backgroundColor: Colors.Primary,
41
+ borderRadius: 50,
42
+ alignItems: 'center',
43
+ justifyContent: 'center',
44
+ marginHorizontal: 16,
45
+ },
46
+ bottomButton2: {
47
+ backgroundColor: Colors.White,
48
+ marginTop: 8,
49
+ },
50
+ });
@@ -0,0 +1,24 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ export default StyleSheet.create({
4
+ wrap: {
5
+ flexDirection: 'row',
6
+ alignItems: 'center',
7
+ justifyContent: 'space-between',
8
+ },
9
+ row: {
10
+ flexDirection: 'row',
11
+ alignItems: 'center',
12
+ },
13
+ arrowRight: {
14
+ transform: [{ rotate: '180deg' }],
15
+ },
16
+ wrapDate: {
17
+ flexDirection: 'row',
18
+ alignItems: 'center',
19
+ marginHorizontal: 24,
20
+ },
21
+ marginRight10: {
22
+ marginRight: 10,
23
+ },
24
+ });
@@ -0,0 +1,107 @@
1
+ import { StyleSheet, Platform } from 'react-native';
2
+ import { Colors } from '../../../configs';
3
+
4
+ export default StyleSheet.create({
5
+ container: {
6
+ flex: 1,
7
+ backgroundColor: Colors.White,
8
+ },
9
+ contentContainerStyle: {
10
+ paddingBottom: 60,
11
+ },
12
+ headerRight: {
13
+ flexDirection: 'row',
14
+ },
15
+ button: {
16
+ marginRight: 10,
17
+ justifyContent: 'center',
18
+ alignItems: 'center',
19
+ },
20
+ menuAction: {
21
+ borderRadius: 10,
22
+ borderBottomRightRadius: 10,
23
+ borderBottomLeftRadius: 10,
24
+ marginTop: Platform.select({
25
+ ios: 0,
26
+ android: -25,
27
+ }),
28
+ },
29
+ wrapTop: {
30
+ padding: 16,
31
+ backgroundColor: Colors.White,
32
+ shadowColor: Colors.Shadow,
33
+ shadowOffset: {
34
+ width: 0,
35
+ height: 2,
36
+ },
37
+ shadowOpacity: 0.1,
38
+ shadowRadius: 4,
39
+ elevation: 3,
40
+ },
41
+ row: {
42
+ flexDirection: 'row',
43
+ alignItems: 'center',
44
+ justifyContent: 'space-between',
45
+ },
46
+ row2: {
47
+ flexDirection: 'row',
48
+ alignItems: 'center',
49
+ },
50
+ marginTop16: {
51
+ marginTop: 16,
52
+ },
53
+ marginRight10: {
54
+ marginRight: 10,
55
+ },
56
+ wrapDate: {
57
+ flexDirection: 'row',
58
+ alignItems: 'center',
59
+ marginHorizontal: 24,
60
+ },
61
+ arrowRight: {
62
+ transform: [{ rotate: '180deg' }],
63
+ },
64
+ wrapItem: {
65
+ flexDirection: 'row',
66
+ alignItems: 'center',
67
+ paddingHorizontal: 16,
68
+ height: 70,
69
+ },
70
+ wrapItemInfo: {
71
+ flex: 1,
72
+ },
73
+ avatar: {
74
+ height: 36,
75
+ width: 36,
76
+ borderRadius: 18,
77
+ marginVertical: 24,
78
+ },
79
+ verticalLine: {
80
+ height: '100%',
81
+ width: 1,
82
+ backgroundColor: Colors.Gray4,
83
+ marginHorizontal: 16,
84
+ justifyContent: 'center',
85
+ alignItems: 'center',
86
+ },
87
+ centerCircle: {
88
+ height: 12,
89
+ width: 12,
90
+ borderRadius: 5,
91
+ },
92
+ timeCheckIn: {
93
+ marginVertical: 24,
94
+ width: '20%',
95
+ },
96
+ itemDescription: {
97
+ flexDirection: 'row',
98
+ alignItems: 'center',
99
+ },
100
+ dot: {
101
+ height: 4,
102
+ width: 4,
103
+ backgroundColor: Colors.Gray7,
104
+ borderRadius: 2,
105
+ marginHorizontal: 4,
106
+ },
107
+ });
@@ -0,0 +1,49 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { Colors } from '../../../configs';
3
+
4
+ export default StyleSheet.create({
5
+ container: {
6
+ flex: 1,
7
+ backgroundColor: Colors.White,
8
+ },
9
+ headerRight: {
10
+ flexDirection: 'row',
11
+ },
12
+ contentContainerStyle: {
13
+ paddingBottom: 60,
14
+ },
15
+ wrapItem: {
16
+ height: 100,
17
+ width: '100%',
18
+ flexDirection: 'row',
19
+ alignItems: 'center',
20
+ padding: 16,
21
+ borderBottomWidth: 1,
22
+ borderBottomColor: Colors.Gray3,
23
+ },
24
+ itemAvatar: {
25
+ height: 48,
26
+ width: 48,
27
+ borderRadius: 24,
28
+ borderWidth: 1,
29
+ borderColor: Colors.Gray3,
30
+ },
31
+ itemName: {
32
+ marginLeft: 16,
33
+ flex: 1,
34
+ },
35
+ addMemberModal: {
36
+ paddingBottom: 50,
37
+ },
38
+ row: {
39
+ flexDirection: 'row',
40
+ alignItems: 'center',
41
+ paddingVertical: 16,
42
+ marginHorizontal: 16,
43
+ borderBottomColor: Colors.Gray3,
44
+ borderBottomWidth: 1,
45
+ },
46
+ textOption: {
47
+ marginLeft: 18,
48
+ },
49
+ });
@@ -0,0 +1,73 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { Colors } from '../../../configs';
3
+
4
+ export default StyleSheet.create({
5
+ container: {
6
+ flex: 1,
7
+ backgroundColor: Colors.White,
8
+ },
9
+ headerRight: {
10
+ flexDirection: 'row',
11
+ },
12
+ wrapAvatar: {
13
+ alignItems: 'center',
14
+ marginTop: 24,
15
+ marginBottom: 52,
16
+ },
17
+ avatar: {
18
+ height: 88,
19
+ width: 88,
20
+ borderRadius: 44,
21
+ borderWidth: 1,
22
+ borderColor: Colors.Gray3,
23
+ },
24
+ row: {
25
+ flexDirection: 'row',
26
+ alignItems: 'center',
27
+ borderBottomWidth: 1,
28
+ borderBottomColor: Colors.Gray3,
29
+ height: 64,
30
+ marginHorizontal: 16,
31
+ },
32
+ textSetPhoto: {
33
+ flex: 1,
34
+ marginLeft: 16,
35
+ lineHeight: 24,
36
+ },
37
+ photoID: {
38
+ width: 42,
39
+ height: 42,
40
+ borderRadius: 6,
41
+ borderWidth: 1,
42
+ borderColor: Colors.Gray3,
43
+ },
44
+ spaceBetween: {
45
+ justifyContent: 'space-between',
46
+ },
47
+ buttonRemove: {
48
+ position: 'absolute',
49
+ alignItems: 'center',
50
+ padding: 32,
51
+ bottom: 0,
52
+ left: 0,
53
+ right: 0,
54
+ },
55
+ textInput: {
56
+ margin: 16,
57
+ marginTop: 0,
58
+ borderWidth: 0,
59
+ paddingLeft: 0,
60
+ paddingTop: 0,
61
+ borderBottomWidth: 2,
62
+ borderBottomColor: Colors.Primary,
63
+ fontSize: 16,
64
+ color: Colors.Gray9,
65
+ },
66
+ bottomButton: {
67
+ paddingBottom: 24,
68
+ },
69
+ textError: {
70
+ marginHorizontal: 16,
71
+ marginTop: 4,
72
+ },
73
+ });
@@ -0,0 +1,52 @@
1
+ import { API } from '../../../configs';
2
+ import Pusher from 'pusher-js/react-native';
3
+ import { SCConfig } from '../../../configs/SCConfig';
4
+ import { axiosPost } from '../../../utils/Apis/axios';
5
+
6
+ Pusher.logToConsole = true;
7
+ let pusher = null;
8
+
9
+ const getPusher = () => {
10
+ if (!pusher) {
11
+ pusher = new Pusher(SCConfig.pusherAppKey, {
12
+ cluster: SCConfig.pusherAppCluste,
13
+ authorizer: function (channel, option) {
14
+ return {
15
+ // eslint-disable-next-line promise/prefer-await-to-callbacks
16
+ authorize: async function (socketId, callback) {
17
+ const { success, data } = await axiosPost(
18
+ API.CAMERA.HANET.PUSHER_AUTH(),
19
+ {
20
+ channel_name: channel.name,
21
+ socket_id: socketId,
22
+ }
23
+ );
24
+ if (success) {
25
+ // eslint-disable-next-line promise/prefer-await-to-callbacks
26
+ callback(null, data);
27
+ }
28
+ },
29
+ };
30
+ },
31
+ });
32
+ }
33
+ return pusher;
34
+ };
35
+
36
+ const destroyPusher = () => {
37
+ pusher.disconnect();
38
+ pusher = null;
39
+ };
40
+
41
+ // eslint-disable-next-line promise/prefer-await-to-callbacks
42
+ export const watchHanetCheckinData = (hanetCamera, callback) => {
43
+ const channel = getPusher().subscribe(
44
+ `private-hanet-camera-${hanetCamera.device_id}`
45
+ );
46
+ channel.bind('new-checkin-data', callback);
47
+ };
48
+
49
+ export const unwatchHanetCheckinData = (hanetCamera) => {
50
+ getPusher().unsubscribe(`private-hanet-camera-${hanetCamera.device_id}`);
51
+ destroyPusher();
52
+ };
@@ -6,7 +6,7 @@ import axios from 'axios';
6
6
  import { SCProvider } from '../../../context';
7
7
  import { mockSCStore } from '../../../context/mockStore';
8
8
  import NotificationItem from '../components/NotificationItem';
9
- import { NOTIFICATION_TYPES } from '../../../configs/Constants';
9
+ import { NOTIFICATION_TYPES, SENSOR_TYPE } from '../../../configs/Constants';
10
10
  import Routes from '../../../utils/Route';
11
11
  import { API } from '../../../configs';
12
12
 
@@ -130,6 +130,8 @@ describe('test NotificationItem', () => {
130
130
  NOTIFICATION_TYPES.NOTIFY_REMOVE_UNIT,
131
131
  NOTIFICATION_TYPES.NOTIFY_REMOVE_MEMBER,
132
132
  NOTIFICATION_TYPES.NOTIFY_MEMBER_LEAVE_UNIT,
133
+ NOTIFICATION_TYPES.NOTIFY_REMOVE_SUB_UNIT,
134
+ NOTIFICATION_TYPES.NOTIFY_REMOVE_DEVICE,
133
135
  'default case',
134
136
  ];
135
137
 
@@ -148,7 +150,13 @@ describe('test NotificationItem', () => {
148
150
  });
149
151
  }
150
152
 
151
- const listSensorType = ['air_quality', 'turbidity', 'ph', 'clo', 'uv'];
153
+ const listSensorType = [
154
+ SENSOR_TYPE.AIR_QUALITY,
155
+ SENSOR_TYPE.TURBIDITY,
156
+ SENSOR_TYPE.PH,
157
+ SENSOR_TYPE.CLO,
158
+ SENSOR_TYPE.UV,
159
+ ];
152
160
  for (const sensorType of listSensorType) {
153
161
  test(`create ItemNotification NOTIFY_INDICATOR sensor_type ${sensorType}`, () => {
154
162
  item.content_code = NOTIFICATION_TYPES.NOTIFY_INDICATOR;
@@ -179,7 +187,12 @@ describe('test NotificationItem', () => {
179
187
  });
180
188
  }
181
189
 
182
- const listSensorType2 = ['smoke', 'fire'];
190
+ const listSensorType2 = [
191
+ SENSOR_TYPE.SMOKE,
192
+ SENSOR_TYPE.FIRE,
193
+ SENSOR_TYPE.SOS,
194
+ SENSOR_TYPE.FILTER_WATER,
195
+ ];
183
196
  for (const sensorType of listSensorType2) {
184
197
  test(`create ItemNotification NOTIFY_INDICATOR sensor_type ${sensorType}`, () => {
185
198
  item.content_code = NOTIFICATION_TYPES.NOTIFY_INDICATOR;
@@ -7,7 +7,7 @@ import styles from '../styles/NotificationItemStyles';
7
7
  import Text from '../../../commons/Text';
8
8
  import { Colors, API, Images } from '../../../configs';
9
9
  import IconComponent from '../../../commons/IconComponent';
10
- import { NOTIFICATION_TYPES } from '../../../configs/Constants';
10
+ import { NOTIFICATION_TYPES, SENSOR_TYPE } from '../../../configs/Constants';
11
11
  import { useTranslations } from '../../../hooks/Common/useTranslations';
12
12
  import { axiosPost } from '../../../utils/Apis/axios';
13
13
  import Routes from '../../../utils/Route';
@@ -224,7 +224,7 @@ const NotificationItem = memo(({ item }) => {
224
224
  case NOTIFICATION_TYPES.NOTIFY_INDICATOR:
225
225
  const { sensor_type, summary_id } = paramsJSON;
226
226
  switch (sensor_type) {
227
- case 'air_quality':
227
+ case SENSOR_TYPE.AIR_QUALITY:
228
228
  return {
229
229
  content: customColorText(
230
230
  t('text_notification_content_air_quality_high'),
@@ -240,7 +240,7 @@ const NotificationItem = memo(({ item }) => {
240
240
  }),
241
241
  iconContent: <Image source={Images.logo} style={styles.logo} />,
242
242
  };
243
- case 'turbidity':
243
+ case SENSOR_TYPE.TURBIDITY:
244
244
  return {
245
245
  content: customColorText(
246
246
  t('text_notification_content_turbility_high'),
@@ -256,7 +256,7 @@ const NotificationItem = memo(({ item }) => {
256
256
  }),
257
257
  iconContent: <Image source={Images.logo} style={styles.logo} />,
258
258
  };
259
- case 'ph':
259
+ case SENSOR_TYPE.PH:
260
260
  return {
261
261
  content: customColorText(
262
262
  t('text_notification_content_pH_index_high'),
@@ -272,7 +272,7 @@ const NotificationItem = memo(({ item }) => {
272
272
  }),
273
273
  iconContent: <Image source={Images.logo} style={styles.logo} />,
274
274
  };
275
- case 'clo':
275
+ case SENSOR_TYPE.CLO:
276
276
  return {
277
277
  content: customColorText(
278
278
  t('text_notification_content_clo_high'),
@@ -288,7 +288,7 @@ const NotificationItem = memo(({ item }) => {
288
288
  }),
289
289
  iconContent: <Image source={Images.logo} style={styles.logo} />,
290
290
  };
291
- case 'uv':
291
+ case SENSOR_TYPE.UV:
292
292
  return {
293
293
  content: customColorText(
294
294
  t('text_notification_content_uv_index_high'),
@@ -304,7 +304,7 @@ const NotificationItem = memo(({ item }) => {
304
304
  }),
305
305
  iconContent: <Image source={Images.logo} style={styles.logo} />,
306
306
  };
307
- case 'smoke':
307
+ case SENSOR_TYPE.SMOKE:
308
308
  return {
309
309
  content: customColorText(
310
310
  t('text_notification_content_smoke'),
@@ -320,7 +320,7 @@ const NotificationItem = memo(({ item }) => {
320
320
  }),
321
321
  iconContent: <Image source={Images.logo} style={styles.logo} />,
322
322
  };
323
- case 'fire':
323
+ case SENSOR_TYPE.FIRE:
324
324
  return {
325
325
  content: customColorText(
326
326
  t('text_notification_content_fire'),
@@ -336,6 +336,38 @@ const NotificationItem = memo(({ item }) => {
336
336
  }),
337
337
  iconContent: <Image source={Images.logo} style={styles.logo} />,
338
338
  };
339
+ case SENSOR_TYPE.SOS:
340
+ return {
341
+ content: customColorText(
342
+ t('text_notification_content_active_sos'),
343
+ arrParams
344
+ ),
345
+ redirect: () =>
346
+ navigation.navigate(Routes.UnitStack, {
347
+ screen: Routes.DeviceDetail,
348
+ params: {
349
+ unitId,
350
+ sensorId,
351
+ },
352
+ }),
353
+ iconContent: <Image source={Images.logo} style={styles.logo} />,
354
+ };
355
+ case SENSOR_TYPE.FILTER_WATER:
356
+ return {
357
+ content: customColorText(
358
+ t('text_notification_content_replace_water_filter'),
359
+ arrParams
360
+ ),
361
+ redirect: () =>
362
+ navigation.navigate(Routes.UnitStack, {
363
+ screen: Routes.DeviceDetail,
364
+ params: {
365
+ unitId,
366
+ sensorId,
367
+ },
368
+ }),
369
+ iconContent: <Image source={Images.logo} style={styles.logo} />,
370
+ };
339
371
  default:
340
372
  return {
341
373
  content: customColorText(
@@ -428,6 +460,9 @@ const NotificationItem = memo(({ item }) => {
428
460
  },
429
461
  });
430
462
  },
463
+ iconContent: (
464
+ <IconComponent icon={'home'} style={styles.backgroundSummer} />
465
+ ),
431
466
  };
432
467
  case NOTIFICATION_TYPES.NOTIFY_RENAME_SUB_UNIT:
433
468
  const stationId = paramsJSON?.sub_unit_id;
@@ -445,6 +480,31 @@ const NotificationItem = memo(({ item }) => {
445
480
  },
446
481
  });
447
482
  },
483
+ iconContent: (
484
+ <IconComponent icon={'home'} style={styles.backgroundSummer} />
485
+ ),
486
+ };
487
+ case NOTIFICATION_TYPES.NOTIFY_REMOVE_SUB_UNIT:
488
+ return {
489
+ content: customColorText(
490
+ t('text_notification_content_remove_sub_unit'),
491
+ arrParams
492
+ ),
493
+ redirect: () => null,
494
+ iconContent: (
495
+ <IconComponent icon={'home'} style={styles.backgroundSummer} />
496
+ ),
497
+ };
498
+ case NOTIFICATION_TYPES.NOTIFY_REMOVE_DEVICE:
499
+ return {
500
+ content: customColorText(
501
+ t('text_notification_content_remove_device'),
502
+ arrParams
503
+ ),
504
+ redirect: () => null,
505
+ iconContent: (
506
+ <IconComponent icon={'home'} style={styles.backgroundSummer} />
507
+ ),
448
508
  };
449
509
  default:
450
510
  return {
@@ -43,6 +43,7 @@ describe('test ScanChipQR', () => {
43
43
  station_id: 1,
44
44
  phoneNumber: '0909123456',
45
45
  chipName: 'Chip name',
46
+ isNewFlow: true,
46
47
  },
47
48
  };
48
49
  });