@eohjsc/react-native-smart-city 0.2.81 → 0.2.84

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 (72) hide show
  1. package/assets/images/Event.svg +9 -0
  2. package/package.json +2 -2
  3. package/src/commons/ActionGroup/CurtainButtonTemplate.js +32 -21
  4. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +8 -6
  5. package/src/commons/ActionGroup/OnOffTemplate/index.js +11 -3
  6. package/src/commons/ActionGroup/OneBigButtonTemplate.js +10 -7
  7. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +5 -2
  8. package/src/commons/ActionGroup/StatesGridActionTemplate.js +7 -3
  9. package/src/commons/ActionGroup/ThreeButtonTemplate.js +33 -24
  10. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +18 -6
  11. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +9 -1
  12. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +25 -13
  13. package/src/commons/ActionGroup/__test__/index.test.js +48 -14
  14. package/src/commons/Automate/ItemAutomate.js +1 -1
  15. package/src/commons/Automate/ItemAutomateStyles.js +5 -1
  16. package/src/commons/Device/HorizontalBarChart.js +7 -1
  17. package/src/commons/Device/ItemDevice.js +8 -5
  18. package/src/commons/Device/WaterQualitySensor/ListQualityIndicator.js +1 -1
  19. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +1 -1
  20. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
  21. package/src/commons/EmergencyButton/AlertSent.js +2 -2
  22. package/src/commons/FullLoading/index.js +35 -0
  23. package/src/commons/ImagePicker/__test__/ImagePicker.test.js +24 -3
  24. package/src/commons/MediaPlayerDetail/index.js +1 -0
  25. package/src/commons/SubUnit/Favorites/index.js +2 -0
  26. package/src/commons/SubUnit/OneTap/ItemOneTap.js +3 -0
  27. package/src/commons/SubUnit/ShortDetail.js +7 -1
  28. package/src/commons/index.js +2 -0
  29. package/src/configs/API.js +4 -4
  30. package/src/configs/Constants.js +13 -0
  31. package/src/iot/RemoteControl/Internet.js +8 -1
  32. package/src/iot/RemoteControl/index.js +4 -2
  33. package/src/screens/AddCommon/SelectSubUnit.js +6 -0
  34. package/src/screens/AddNewAction/SelectAction.js +46 -28
  35. package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +3 -3
  36. package/src/screens/AddNewAutoSmart/index.js +18 -1
  37. package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +21 -12
  38. package/src/screens/AllCamera/index.js +76 -44
  39. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +2 -2
  40. package/src/screens/Device/EditDevice/index.js +2 -2
  41. package/src/screens/Device/__test__/detail.test.js +18 -11
  42. package/src/screens/Device/components/SensorConnectStatusViewHeader.js +2 -2
  43. package/src/screens/Device/components/SensorDisplayItem.js +2 -2
  44. package/src/screens/Device/detail.js +58 -20
  45. package/src/screens/Device/styles.js +2 -0
  46. package/src/screens/Notification/__test__/NotificationItem.test.js +186 -14
  47. package/src/screens/Notification/components/NotificationItem.js +147 -3
  48. package/src/screens/Notification/index.js +4 -1
  49. package/src/screens/Notification/styles/NotificationItemStyles.js +3 -3
  50. package/src/screens/ScanChipQR/hooks/index.js +3 -19
  51. package/src/screens/Sharing/SelectUser.js +17 -10
  52. package/src/screens/Sharing/__test__/SelectUser.test.js +73 -0
  53. package/src/screens/SubUnit/AddSubUnit.js +4 -1
  54. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +148 -0
  55. package/src/screens/Unit/Detail.js +28 -4
  56. package/src/screens/Unit/ManageUnit.js +87 -31
  57. package/src/screens/Unit/ManageUnitStyles.js +14 -0
  58. package/src/screens/Unit/SmartAccount.js +11 -3
  59. package/src/screens/Unit/Summaries.js +2 -2
  60. package/src/screens/Unit/__test__/CheckSendEmail.test.js +10 -0
  61. package/src/screens/Unit/__test__/Detail.test.js +53 -0
  62. package/src/screens/Unit/__test__/ManageUnit.test.js +69 -0
  63. package/src/screens/Unit/__test__/SmartAccount.test.js +37 -8
  64. package/src/screens/Unit/components/__test__/SharedUnit.test.js +21 -2
  65. package/src/screens/Unit/hook/useStateAlertRemove.js +1 -1
  66. package/src/screens/UnitSummary/__test__/index.test.js +3 -3
  67. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +2 -2
  68. package/src/screens/UnitSummary/index.js +52 -9
  69. package/src/utils/Apis/axios.js +7 -2
  70. package/src/utils/I18n/translations/en.json +11 -1
  71. package/src/utils/I18n/translations/vi.json +11 -1
  72. package/src/{screens/Notification → utils}/Monitor.js +1 -1
@@ -75,6 +75,9 @@ describe('Test ActionGroup', () => {
75
75
  id: 20,
76
76
  key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
77
77
  };
78
+ const sensor = {
79
+ name: 'Sensor name',
80
+ };
78
81
  let actionGroupData;
79
82
  let wrapper;
80
83
 
@@ -154,7 +157,9 @@ describe('Test ActionGroup', () => {
154
157
  const actionGroup = actionGroupData;
155
158
  const mockDoAction = jest.fn();
156
159
  await act(() => {
157
- wrapper = renderer.create(wrapComponent(actionGroup, mockDoAction));
160
+ wrapper = renderer.create(
161
+ wrapComponent(actionGroup, mockDoAction, sensor)
162
+ );
158
163
  });
159
164
  const instance = wrapper.root;
160
165
  const buttons = instance.findAllByType(TouchableOpacity);
@@ -170,21 +175,27 @@ describe('Test ActionGroup', () => {
170
175
  });
171
176
  expect(mockDoAction).toHaveBeenCalledTimes(1);
172
177
  expect(mockDoAction).toHaveBeenCalledWith(
173
- actionGroup.configuration.action1_data
178
+ actionGroup.configuration.action1_data,
179
+ null,
180
+ 'Sensor name up'
174
181
  );
175
182
  act(() => {
176
183
  buttons[1].props.onPress();
177
184
  });
178
185
  expect(mockDoAction).toHaveBeenCalledTimes(2);
179
186
  expect(mockDoAction).toHaveBeenCalledWith(
180
- actionGroup.configuration.action2_data
187
+ actionGroup.configuration.action2_data,
188
+ null,
189
+ 'Sensor name stop'
181
190
  );
182
191
  act(() => {
183
192
  buttons[2].props.onPress();
184
193
  });
185
194
  expect(mockDoAction).toHaveBeenCalledTimes(3);
186
195
  expect(mockDoAction).toHaveBeenCalledWith(
187
- actionGroup.configuration.action3_data
196
+ actionGroup.configuration.action3_data,
197
+ null,
198
+ 'Sensor name down'
188
199
  );
189
200
  });
190
201
 
@@ -220,7 +231,9 @@ describe('Test ActionGroup', () => {
220
231
  };
221
232
  const mockDoAction = jest.fn();
222
233
  await act(() => {
223
- wrapper = renderer.create(wrapComponent(actionGroup, mockDoAction));
234
+ wrapper = renderer.create(
235
+ wrapComponent(actionGroup, mockDoAction, sensor)
236
+ );
224
237
  });
225
238
  const instance = wrapper.root;
226
239
  const buttons = instance.findAllByType(TouchableOpacity);
@@ -236,21 +249,27 @@ describe('Test ActionGroup', () => {
236
249
  });
237
250
  expect(mockDoAction).toHaveBeenCalledTimes(1);
238
251
  expect(mockDoAction).toHaveBeenCalledWith(
239
- actionGroup.configuration.action1_data
252
+ actionGroup.configuration.action1_data,
253
+ null,
254
+ 'Sensor name up'
240
255
  );
241
256
  act(() => {
242
257
  buttons[1].props.onPress();
243
258
  });
244
259
  expect(mockDoAction).toHaveBeenCalledTimes(2);
245
260
  expect(mockDoAction).toHaveBeenCalledWith(
246
- actionGroup.configuration.action2_data
261
+ actionGroup.configuration.action2_data,
262
+ null,
263
+ 'Sensor name stop'
247
264
  );
248
265
  act(() => {
249
266
  buttons[2].props.onPress();
250
267
  });
251
268
  expect(mockDoAction).toHaveBeenCalledTimes(3);
252
269
  expect(mockDoAction).toHaveBeenCalledWith(
253
- actionGroup.configuration.action3_data
270
+ actionGroup.configuration.action3_data,
271
+ null,
272
+ 'Sensor name down'
254
273
  );
255
274
  });
256
275
 
@@ -279,7 +298,9 @@ describe('Test ActionGroup', () => {
279
298
  },
280
299
  };
281
300
  await act(() => {
282
- wrapper = renderer.create(wrapComponent(actionGroup, mockDoAction));
301
+ wrapper = renderer.create(
302
+ wrapComponent(actionGroup, mockDoAction, sensor)
303
+ );
283
304
  });
284
305
  const instance = wrapper.root;
285
306
  const buttons = instance.findAllByType(TouchableOpacity);
@@ -288,7 +309,11 @@ describe('Test ActionGroup', () => {
288
309
  buttons[0].props.onPress();
289
310
  });
290
311
  expect(mockDoAction).toHaveBeenCalledTimes(1);
291
- expect(mockDoAction).toHaveBeenCalledWith(action_data);
312
+ expect(mockDoAction).toHaveBeenCalledWith(
313
+ action_data,
314
+ null,
315
+ 'Sensor name up'
316
+ );
292
317
  });
293
318
 
294
319
  test('render ActionGroup on_off_button_action_template', async () => {
@@ -303,9 +328,12 @@ describe('Test ActionGroup', () => {
303
328
  icon_off: 'caret-up',
304
329
  text_off: 'OFF',
305
330
  },
331
+ title: 'Power',
306
332
  };
307
333
  await act(() => {
308
- wrapper = renderer.create(wrapComponent(actionGroup, mockDoAction, {}));
334
+ wrapper = renderer.create(
335
+ wrapComponent(actionGroup, mockDoAction, sensor)
336
+ );
309
337
  });
310
338
  const instance = wrapper.root;
311
339
  const buttons = instance.findAllByType(TouchableOpacity);
@@ -329,7 +357,9 @@ describe('Test ActionGroup', () => {
329
357
  },
330
358
  };
331
359
  await act(() => {
332
- wrapper = renderer.create(wrapComponent(actionGroup, mockDoAction, {}));
360
+ wrapper = renderer.create(
361
+ wrapComponent(actionGroup, mockDoAction, sensor)
362
+ );
333
363
  });
334
364
  const instance = wrapper.root;
335
365
  const text = instance.findAllByType(Text);
@@ -366,7 +396,9 @@ describe('Test ActionGroup', () => {
366
396
  },
367
397
  };
368
398
  await act(() => {
369
- wrapper = renderer.create(wrapComponent(actionGroup, mockDoAction, {}));
399
+ wrapper = renderer.create(
400
+ wrapComponent(actionGroup, mockDoAction, sensor)
401
+ );
370
402
  });
371
403
  const instance = wrapper.root;
372
404
  const texts = instance.findAllByType(Text);
@@ -413,7 +445,9 @@ describe('Test ActionGroup', () => {
413
445
  };
414
446
  const mockDoAction = jest.fn();
415
447
  await act(() => {
416
- wrapper = renderer.create(wrapComponent(actionGroup, mockDoAction, {}));
448
+ wrapper = renderer.create(
449
+ wrapComponent(actionGroup, mockDoAction, sensor)
450
+ );
417
451
  });
418
452
  const instance = wrapper.root;
419
453
 
@@ -38,7 +38,7 @@ const ItemAutomate = ({
38
38
  <View style={styles.wrapIcon}>
39
39
  <Icon />
40
40
  </View>
41
- <View>
41
+ <View style={styles.wrapTitle}>
42
42
  <Text type="H4" bold>
43
43
  {t(item?.title)}
44
44
  </Text>
@@ -28,6 +28,10 @@ export default StyleSheet.create({
28
28
  },
29
29
  wrapIcon: {
30
30
  justifyContent: 'center',
31
- marginRight: 16,
31
+ flexDirection: 'row',
32
+ width: 50,
33
+ },
34
+ wrapTitle: {
35
+ marginLeft: 10,
32
36
  },
33
37
  });
@@ -33,6 +33,7 @@ const HorizontalBarChart = memo(({ datas, config }) => {
33
33
  },
34
34
  yAxis: {
35
35
  min: 0,
36
+ minRange: 0.5,
36
37
  title: {
37
38
  text: null,
38
39
  },
@@ -55,7 +56,12 @@ const HorizontalBarChart = memo(({ datas, config }) => {
55
56
  useHTML: true,
56
57
  formatter: function () {
57
58
  const { unit, price } = JSON.parse(this.series.name);
58
- const textColor = this.color === '#00979D' ? '#FFFFFF' : '#262626';
59
+ const textColor =
60
+ this.color === '#00979D'
61
+ ? this.y === 0
62
+ ? '#262626'
63
+ : '#FFFFFF'
64
+ : '#262626';
59
65
  const valueStyle = `color:${textColor};font-weight:normal;font-size:12px;`;
60
66
  const costStyle = valueStyle + 'font-weight:bold;';
61
67
 
@@ -30,6 +30,7 @@ const ItemDevice = memo(
30
30
  sensor,
31
31
  unit,
32
32
  station,
33
+ isNetworkConnected,
33
34
  isGGHomeConnected,
34
35
  status,
35
36
  wrapStyle,
@@ -39,9 +40,9 @@ const ItemDevice = memo(
39
40
 
40
41
  const goToSensorDisplay = useCallback(() => {
41
42
  navigation.navigate(Routes.DeviceDetail, {
42
- unit,
43
+ unitData: unit,
43
44
  station,
44
- sensor,
45
+ sensorData: sensor,
45
46
  title,
46
47
  isGGHomeConnected,
47
48
  });
@@ -56,13 +57,15 @@ const ItemDevice = memo(
56
57
  );
57
58
  };
58
59
 
59
- const isNetworkConnected =
60
- status === undefined ? sensor.is_connected : status.is_connected;
60
+ const isConnectedViaInternet =
61
+ status === undefined
62
+ ? isNetworkConnected && sensor.is_connected
63
+ : isNetworkConnected && status.is_connected;
61
64
  const isBLEConnected = isDeviceConnected(
62
65
  sensor?.remote_control_options?.bluetooth?.address
63
66
  );
64
67
  const isConnected =
65
- isNetworkConnected || isGGHomeConnected || isBLEConnected;
68
+ isConnectedViaInternet || isGGHomeConnected || isBLEConnected;
66
69
  const borderColor = isConnected ? Colors.Gray4 : Colors.Red6;
67
70
  const textConnected = isConnected ? t('connected') : t('disconnected');
68
71
 
@@ -37,7 +37,7 @@ export default ListQualityIndicator;
37
37
  const styles = StyleSheet.create({
38
38
  standard: {
39
39
  flexDirection: 'row',
40
- marginTop: 16,
40
+ marginVertical: 16,
41
41
  },
42
42
  flatlistContent: {
43
43
  paddingHorizontal: 16,
@@ -68,7 +68,7 @@ const styles = StyleSheet.create({
68
68
  borderWidth: 1,
69
69
  borderColor: Colors.Gray4,
70
70
  marginRight: 8,
71
- width: (width / 375) * 120,
71
+ width: ((width - 32) / 375) * 120,
72
72
  },
73
73
  rowFlex: {
74
74
  flexDirection: 'row',
@@ -44,9 +44,9 @@ const AlertSendConfirm = ({
44
44
  <Text
45
45
  type="Body"
46
46
  style={styles.textLocation}
47
- >{`${unit.name} - ${station.name}`}</Text>
47
+ >{`${unit?.name} - ${station?.name}`}</Text>
48
48
  <Text type="Body" style={styles.textAddress}>
49
- {unit.address}
49
+ {unit?.address}
50
50
  </Text>
51
51
  </View>
52
52
  </ButtonPopup>
@@ -58,7 +58,7 @@ const AlertSent = ({
58
58
  <Text
59
59
  type="H5"
60
60
  style={styles.location}
61
- >{`${unit.name} - ${station.name}`}</Text>
61
+ >{`${unit?.name} - ${station?.name}`}</Text>
62
62
  <IconFill name="alert" size={42} style={styles.alert} />
63
63
  <Text semibold style={styles.textAlertSent}>
64
64
  {data.title}
@@ -67,7 +67,7 @@ const AlertSent = ({
67
67
  {data.message}
68
68
  {isDashboard && (
69
69
  <Text type="H4" semibold>
70
- {` ${unit.name}: ${station.name}.`}
70
+ {` ${unit?.name}: ${station?.name}.`}
71
71
  </Text>
72
72
  )}
73
73
  </Text>
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { View, ActivityIndicator, StyleSheet } from 'react-native';
3
+
4
+ import { colorOpacity } from '../../utils/Converter/color';
5
+ import { Colors } from '../../configs';
6
+
7
+ const FullLoading = ({ wrapStyle, color = Colors.Primary, size = 'small' }) => (
8
+ <View style={[styles.wrap, wrapStyle]}>
9
+ <View style={styles.background}>
10
+ <ActivityIndicator color={color} size={size} />
11
+ </View>
12
+ </View>
13
+ );
14
+
15
+ const styles = StyleSheet.create({
16
+ wrap: {
17
+ position: 'absolute',
18
+ backgroundColor: colorOpacity(Colors.Black, 0.1),
19
+ alignItems: 'center',
20
+ justifyContent: 'center',
21
+ top: 0,
22
+ left: 0,
23
+ bottom: 0,
24
+ right: 0,
25
+ zIndex: 10,
26
+ },
27
+ background: {
28
+ backgroundColor: colorOpacity(Colors.White, 0.8),
29
+ borderRadius: 5,
30
+ paddingHorizontal: 32,
31
+ paddingVertical: 24,
32
+ },
33
+ });
34
+
35
+ export default FullLoading;
@@ -41,9 +41,9 @@ describe('Test ImagePicker', () => {
41
41
  Platform.OS = 'android';
42
42
  const options = {
43
43
  mediaType: 'photo',
44
- maxWidth: 1024,
45
- quality: 0.8,
46
- saveToPhotos: true,
44
+ compressImageMaxWidth: 1280,
45
+ compressImageMaxHeight: 720,
46
+ compressImageQuality: 0.8,
47
47
  };
48
48
  act(() => {
49
49
  tree = renderer.create(wrapComponent(options));
@@ -51,5 +51,26 @@ describe('Test ImagePicker', () => {
51
51
  const instance = tree.root;
52
52
  const textInputs = instance.findAllByType(ButtonPopup);
53
53
  expect(textInputs.length).toBe(1);
54
+ act(() => {
55
+ textInputs[0].props.onPressMain();
56
+ });
57
+ });
58
+ test('create ImagePicker onChooseFile', () => {
59
+ Platform.OS = 'android';
60
+ const options = {
61
+ mediaType: 'photo',
62
+ compressImageMaxWidth: 1280,
63
+ compressImageMaxHeight: 720,
64
+ compressImageQuality: 0.8,
65
+ };
66
+ act(() => {
67
+ tree = renderer.create(wrapComponent(options));
68
+ });
69
+ const instance = tree.root;
70
+ const textInputs = instance.findAllByType(ButtonPopup);
71
+ expect(textInputs.length).toBe(1);
72
+ act(() => {
73
+ textInputs[0].props.onPressSecondary();
74
+ });
54
75
  });
55
76
  });
@@ -164,6 +164,7 @@ const MediaPlayerDetail = ({
164
164
  activeOpacity={1}
165
165
  style={styles.videoBtn}
166
166
  onPress={onTapGoDetail}
167
+ testID={TESTID.SUB_UNIT_GO_DETAIL}
167
168
  >
168
169
  {paused ? (
169
170
  <View style={[styles.player, style]}>
@@ -15,6 +15,7 @@ const SubUnitFavorites = ({
15
15
  unit,
16
16
  isOwner,
17
17
  favorites,
18
+ isNetworkConnected,
18
19
  isGGHomeConnected,
19
20
  wrapItemStyle,
20
21
  }) => {
@@ -71,6 +72,7 @@ const SubUnitFavorites = ({
71
72
  sensor={sensor}
72
73
  unit={unit}
73
74
  station={sensor.station}
75
+ isNetworkConnected={isNetworkConnected}
74
76
  isGGHomeConnected={isGGHomeConnected}
75
77
  status={sensorsStatus.find((s) => s.id === sensor.id)}
76
78
  wrapStyle={wrapItemStyle}
@@ -7,6 +7,7 @@ import { API, Colors } from '../../../configs';
7
7
  import OneTap from '../../../../assets/images/OneTap.svg';
8
8
  import ValueChange from '../../../../assets/images/ValueChange.svg';
9
9
  import Schedule from '../../../../assets/images/Schedule.svg';
10
+ import Event from '../../../../assets/images/Event.svg';
10
11
  import CheckCircle from '../../../../assets/images/CheckCircle.svg';
11
12
  import FImage from '../../FImage';
12
13
  import { timeDifference } from '../../../utils/Converter/time';
@@ -92,6 +93,8 @@ const ItemOneTap = memo(
92
93
  return <OneTap />;
93
94
  } else if (type === AUTOMATE_TYPE.VALUE_CHANGE) {
94
95
  return <ValueChange />;
96
+ } else if (type === AUTOMATE_TYPE.EVENT) {
97
+ return <Event />;
95
98
  } else {
96
99
  return <Schedule />;
97
100
  }
@@ -19,7 +19,12 @@ const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
19
19
  Device.screenWidth - 32
20
20
  );
21
21
 
22
- const ShortDetailSubUnit = ({ unit, station, isGGHomeConnected }) => {
22
+ const ShortDetailSubUnit = ({
23
+ unit,
24
+ station,
25
+ isNetworkConnected,
26
+ isGGHomeConnected,
27
+ }) => {
23
28
  const t = useTranslations();
24
29
  const isFocused = useIsFocused();
25
30
  const { navigate } = useNavigation();
@@ -146,6 +151,7 @@ const ShortDetailSubUnit = ({ unit, station, isGGHomeConnected }) => {
146
151
  sensor={sensor}
147
152
  unit={unit}
148
153
  station={station}
154
+ isNetworkConnected={isNetworkConnected}
149
155
  isGGHomeConnected={isGGHomeConnected}
150
156
  status={sensorsStatus.find((s) => s.id === sensor.id)}
151
157
  />
@@ -15,6 +15,7 @@ import MenuActionList from './MenuActionList';
15
15
  import RadioCircle from './RadioCircle';
16
16
  import { CircleButton } from './CircleButton';
17
17
  import HorizontalPicker from './HorizontalPicker';
18
+ import FullLoading from './FullLoading';
18
19
 
19
20
  export {
20
21
  ButtonPopup,
@@ -34,4 +35,5 @@ export {
34
35
  RadioCircle,
35
36
  CircleButton,
36
37
  HorizontalPicker,
38
+ FullLoading,
37
39
  };
@@ -25,6 +25,8 @@ const API = {
25
25
  MANAGE_UNIT: (id) => SCConfig.apiRoot + `/property_manager/units/${id}/`,
26
26
  CHIP_SCAN: (id) =>
27
27
  SCConfig.apiRoot + `/property_manager/units/${id}/chip_scan/`,
28
+ CHIP_SCAN_GET_WIFI_INFO: () =>
29
+ SCConfig.apiRoot + '/property_manager/units/chip_scan_get_wifi_info/',
28
30
  MANAGE_ACCESS: (id) =>
29
31
  SCConfig.apiRoot + `/property_manager/manage_access/${id}/`,
30
32
  AUTOMATE: (id) =>
@@ -53,6 +55,8 @@ const API = {
53
55
  SCConfig.apiRoot + '/property_manager/stations/check_chip_finalized/',
54
56
  },
55
57
  SENSOR: {
58
+ SENSOR_DETAIL: (id) =>
59
+ SCConfig.apiRoot + `/property_manager/sensors/${id}/`,
56
60
  DISPLAY: (id) =>
57
61
  SCConfig.apiRoot + `/property_manager/sensors/${id}/display/`,
58
62
  DISPLAY_VALUES: (id) =>
@@ -82,10 +86,6 @@ const API = {
82
86
  `/property_manager/${unit_id}/sub_units/${station_id}/devices/${id}/remove_from_favourites/`,
83
87
  DISPLAY_ACTIONS: (id) =>
84
88
  SCConfig.apiRoot + `/property_manager/sensors/${id}/display_actions/`,
85
- RENAME_SENSOR: (id) =>
86
- SCConfig.apiRoot + `/property_manager/sensors/${id}/`,
87
- REMOVE_SENSOR: (id) =>
88
- SCConfig.apiRoot + `/property_manager/sensors/${id}/`,
89
89
  CHANGE_SUB_UNIT: (unit_id, station_id, id) =>
90
90
  SCConfig.apiRoot +
91
91
  `/property_manager/${unit_id}/sub_units/${station_id}/devices/${id}/change_sub_unit/`,
@@ -3,6 +3,7 @@ import { RFValue } from 'react-native-responsive-fontsize';
3
3
  import OneTap from '../../assets/images/OneTap.svg';
4
4
  import ValueChange from '../../assets/images/ValueChange.svg';
5
5
  import Schedule from '../../assets/images/Schedule.svg';
6
+ import Event from '../../assets/images/Event.svg';
6
7
 
7
8
  const X_WIDTH = 375;
8
9
  const X_HEIGHT = 812;
@@ -91,6 +92,7 @@ export const AUTOMATE_TYPE = {
91
92
  ONE_TAP: 'one_tap',
92
93
  VALUE_CHANGE: 'value_change',
93
94
  SCHEDULE: 'schedule',
95
+ EVENT: 'event',
94
96
  ONE_TAP_ONLY: 'one_tap_only',
95
97
  AUTOMATE: 'automate',
96
98
  AUTOMATION: 'automation',
@@ -128,6 +130,12 @@ export const AUTOMATES = {
128
130
  explanation: 'setup_the_schedule',
129
131
  icon: Schedule,
130
132
  },
133
+ event: {
134
+ value: AUTOMATE_TYPE.EVENT,
135
+ title: 'event',
136
+ explanation: 'setup_the_conditions',
137
+ icon: Event,
138
+ },
131
139
  };
132
140
 
133
141
  export const UNIT_TYPES = {
@@ -210,6 +218,7 @@ export const TESTID = {
210
218
  SUB_UNIT_STATION: 'SUB_UNIT_STATION',
211
219
  SUB_UNIT_SELECT_AUTOMATE_TYPE: 'SUB_UNIT_SELECT_AUTOMATE_TYPE',
212
220
  SUB_UNIT_TEXT_DROPDOWN: 'SUB_UNIT_TEXT_DROPDOWN',
221
+ SUB_UNIT_GO_DETAIL: 'SUB_UNIT_GO_DETAIL',
213
222
 
214
223
  // NavBar
215
224
  NAVBAR_ICON_BARS: 'NAVBAR_ICON_BARS',
@@ -339,6 +348,7 @@ export const TESTID = {
339
348
 
340
349
  // ADD SUB UNIT
341
350
  ADD_SUB_UNIT_BUTTON_CHOOSE_PHOTO: 'ADD_SUB_UNIT_BUTTON_CHOOSE_PHOTO',
351
+ ADD_SUB_UNIT_BUTTON_CHOOSE_LOCATION: 'ADD_SUB_UNIT_BUTTON_CHOOSE_LOCATION',
342
352
 
343
353
  SCANNING_RESPONSE_TITLE: 'SCANNING_RESPONSE_TITLE',
344
354
  SCANNING_RESPONSE_DESCRIPTION: 'SCANNING_RESPONSE_DESCRIPTION',
@@ -436,6 +446,7 @@ export const TESTID = {
436
446
  MANAGE_UNIT_LIST_EMERGENCY_CONTACT: 'MANAGE_UNIT_LIST_EMERGENCY_CONTACT',
437
447
  MANAGE_UNIT_DETAIL_LIST_CONTACT_BUTTON:
438
448
  'MANAGE_UNIT_DETAIL_LIST_CONTACT_BUTTON',
449
+ MANAGE_UNIT_GO_TO_SUBUNIT: 'MANAGE_UNIT_GO_TO_SUBUNIT',
439
450
 
440
451
  // Add Vehicle
441
452
  ADD_VEHICLE_TAKE_PHOTO: 'ADD_VEHICLE_TAKE_PHOTO',
@@ -632,9 +643,11 @@ export const NOTIFICATION_TYPES = {
632
643
  PARKING_COMPLETED_DUE_TO_CAR_LEAVE: 'PARKING_COMPLETED_DUE_TO_CAR_LEAVE',
633
644
  NOTIFY_INVITE_MEMBER: 'NOTIFY_INVITE_MEMBER',
634
645
  REMINDER: 'REMINDER',
646
+ NOTIFY_INDICATOR: 'NOTIFY_INDICATOR',
635
647
  NOTIFY_REMOVE_UNIT: 'NOTIFY_REMOVE_UNIT',
636
648
  NOTIFY_REMOVE_MEMBER: 'NOTIFY_REMOVE_MEMBER',
637
649
  NOTIFY_MEMBER_LEAVE_UNIT: 'NOTIFY_MEMBER_LEAVE_UNIT',
650
+ NOTIFY_RENAME_UNIT: 'NOTIFY_RENAME_UNIT',
638
651
  };
639
652
 
640
653
  export const ACTIVITY_LOG_TYPES = {
@@ -4,7 +4,13 @@ import { ToastBottomHelper } from '../../utils/Utils';
4
4
  import { axiosPost } from '../../utils/Apis/axios';
5
5
  import { API } from '../../configs';
6
6
 
7
- export const sendCommandOverInternet = async (sensor, action, data, source) => {
7
+ export const sendCommandOverInternet = async (
8
+ sensor,
9
+ action,
10
+ data,
11
+ source,
12
+ actionName
13
+ ) => {
8
14
  if (data !== null) {
9
15
  if (Number.isInteger(data)) {
10
16
  data = data.toString(16).toUpperCase();
@@ -15,6 +21,7 @@ export const sendCommandOverInternet = async (sensor, action, data, source) => {
15
21
  key: action.key,
16
22
  data,
17
23
  source,
24
+ action_name: actionName,
18
25
  });
19
26
  if (success) {
20
27
  ToastBottomHelper.success(t('Command is sent to device via internet'));
@@ -12,7 +12,8 @@ export const sendRemoteCommand = async (
12
12
  sensor,
13
13
  action,
14
14
  data,
15
- userId = null
15
+ userId = null,
16
+ actionName
16
17
  ) => {
17
18
  // No action, raise not authorized
18
19
  let result = false;
@@ -31,7 +32,8 @@ export const sendRemoteCommand = async (
31
32
  sensor,
32
33
  action,
33
34
  data,
34
- 'bluetooth'
35
+ 'bluetooth',
36
+ actionName
35
37
  );
36
38
  } else {
37
39
  throw err;
@@ -24,6 +24,8 @@ const AddCommonSelectSubUnit = ({ route }) => {
24
24
  listSelectDevice,
25
25
  smart_account_id,
26
26
  smart_account_id_from_backend,
27
+ username,
28
+ brand,
27
29
  } = route.params;
28
30
  const [selectedIndex, setSelectedIndex] = useState(-1);
29
31
  const [unit, setUnit] = useState([]);
@@ -86,6 +88,8 @@ const AddCommonSelectSubUnit = ({ route }) => {
86
88
  smart_account_id: smart_account_id,
87
89
  unit_id: unit_id,
88
90
  smart_account_id_from_backend: smart_account_id_from_backend,
91
+ username,
92
+ brand,
89
93
  });
90
94
  break;
91
95
  case 'AddVconnexDevice':
@@ -115,6 +119,8 @@ const AddCommonSelectSubUnit = ({ route }) => {
115
119
  smart_account_id,
116
120
  unit_id,
117
121
  smart_account_id_from_backend,
122
+ username,
123
+ brand,
118
124
  ]);
119
125
 
120
126
  const handleSelectIndex = (index) => {