@eohjsc/react-native-smart-city 0.3.66 → 0.3.68

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 (40) hide show
  1. package/package.json +3 -4
  2. package/src/commons/Action/ItemQuickAction.js +1 -2
  3. package/src/commons/Action/__test__/ItemQuickAction.test.js +2 -21
  4. package/src/commons/ActionGroup/CurtainButtonTemplate.js +7 -2
  5. package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +19 -6
  6. package/src/commons/ActionGroup/OnOffTemplate/index.js +31 -57
  7. package/src/commons/ActionGroup/OneBigButtonTemplate.js +2 -2
  8. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +6 -17
  9. package/src/commons/ActionGroup/StatesGridActionTemplate.js +4 -8
  10. package/src/commons/ActionGroup/StatesGridActionTemplateStyle.js +1 -1
  11. package/src/commons/ActionGroup/ThreeButtonTemplate.js +6 -2
  12. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +36 -23
  13. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +16 -10
  14. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +0 -2
  15. package/src/commons/ActionGroup/__test__/index.test.js +0 -26
  16. package/src/commons/ActionTemplate/index.js +6 -6
  17. package/src/commons/Device/LinearChart.js +2 -2
  18. package/src/commons/Device/PMSensor/{PMSensorIndicatior.js → PMSensorIndicator.js} +5 -4
  19. package/src/commons/IconComponent/index.js +31 -14
  20. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +6 -6
  21. package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +6 -6
  22. package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +3 -3
  23. package/src/commons/SubUnit/OneTap/ItemOneTap.js +7 -1
  24. package/src/commons/UnitSummary/ConfigHistoryChart/index.js +1 -1
  25. package/src/configs/API.js +2 -0
  26. package/src/configs/Constants.js +15 -1
  27. package/src/iot/RemoteControl/Internet.js +3 -0
  28. package/src/screens/AddNewAction/SelectAction.js +69 -15
  29. package/src/screens/AddNewAction/SelectSensorDevices.js +3 -0
  30. package/src/screens/AddNewAutoSmart/index.js +2 -0
  31. package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +1 -1
  32. package/src/screens/AllGateway/GatewayDetail/index.js +2 -2
  33. package/src/screens/Device/components/SensorDisplayItem.js +2 -5
  34. package/src/screens/Device/detail.js +17 -47
  35. package/src/screens/Notification/components/NotificationItem.js +2 -1
  36. package/src/screens/ScriptDetail/index.js +7 -3
  37. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -2
  38. package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -2
  39. package/src/utils/I18n/translations/en.json +2 -1
  40. package/src/utils/I18n/translations/vi.json +2 -1
@@ -49,7 +49,6 @@ import { AlertAction, ButtonPopup, MenuActionMore } from '../../commons';
49
49
  import { SensorDisplayItem } from './components/SensorDisplayItem';
50
50
  import { EmergencyCountdown } from './components/EmergencyCountdown';
51
51
  import { SensorConnectStatusViewHeader } from './components/SensorConnectStatusViewHeader';
52
- import { Card } from '../../commons/CardShadow';
53
52
  import PreventAccess from '../../commons/PreventAccess';
54
53
 
55
54
  import styles from './styles';
@@ -601,21 +600,7 @@ const DeviceDetail = ({ route }) => {
601
600
  });
602
601
  }, [navigation, unit?.group, unit?.id]);
603
602
 
604
- const isHaveColorSliderTemplate = useMemo(() => {
605
- let isFlag = false;
606
- display?.items.some((item) => {
607
- switch (item?.configuration?.template) {
608
- case 'color_picker_template':
609
- case 'slider_range_template':
610
- return (isFlag = true);
611
- default:
612
- return (isFlag = false);
613
- }
614
- });
615
- return isFlag;
616
- }, [display]);
617
603
  // replace isConnected=True to see template
618
-
619
604
  const renderSensorConnected = () => {
620
605
  return (
621
606
  <SensorConnectStatusViewHeader
@@ -629,16 +614,30 @@ const DeviceDetail = ({ route }) => {
629
614
  showWindDirection={showWindDirection}
630
615
  isDeviceHasBle={isDeviceHasBle}
631
616
  >
632
- {display.items.map((item) => {
617
+ {display.items.map((item, index) => {
633
618
  switch (item?.configuration?.template) {
634
619
  case 'color_picker_template':
635
620
  case 'slider_range_template':
636
- return <></>;
621
+ return (
622
+ <SensorDisplayItem
623
+ accessibilityLabel={AccessibilityLabel.SENSOR_DISPLAY_ITEM}
624
+ key={index}
625
+ item={item}
626
+ emergency={onEmergencyButtonPress}
627
+ sensor={sensor}
628
+ getData={getData}
629
+ maxValue={maxValue}
630
+ offsetTitle={offsetTitle}
631
+ setOffsetTitle={setOffsetTitle}
632
+ setShowWindDirection={setShowWindDirection}
633
+ background={station?.background}
634
+ />
635
+ );
637
636
  default:
638
637
  return (
639
638
  <SensorDisplayItem
640
639
  accessibilityLabel={AccessibilityLabel.SENSOR_DISPLAY_ITEM}
641
- key={item.id.toString()}
640
+ key={index}
642
641
  item={item}
643
642
  emergency={onEmergencyButtonPress}
644
643
  sensor={sensor}
@@ -652,35 +651,6 @@ const DeviceDetail = ({ route }) => {
652
651
  );
653
652
  }
654
653
  })}
655
- {!!isHaveColorSliderTemplate && (
656
- <Card title={t('controller')}>
657
- {display.items.map((item) => {
658
- switch (item?.configuration?.template) {
659
- case 'color_picker_template':
660
- case 'slider_range_template':
661
- return (
662
- <SensorDisplayItem
663
- accessibilityLabel={
664
- AccessibilityLabel.SENSOR_DISPLAY_ITEM
665
- }
666
- key={item.id.toString()}
667
- item={item}
668
- emergency={onEmergencyButtonPress}
669
- sensor={sensor}
670
- getData={getData}
671
- maxValue={maxValue}
672
- offsetTitle={offsetTitle}
673
- setOffsetTitle={setOffsetTitle}
674
- setShowWindDirection={setShowWindDirection}
675
- background={station?.background}
676
- />
677
- );
678
- default:
679
- return <></>;
680
- }
681
- })}
682
- </Card>
683
- )}
684
654
  </SensorConnectStatusViewHeader>
685
655
  );
686
656
  };
@@ -55,7 +55,8 @@ const NotificationItem = memo(({ item }) => {
55
55
  },
56
56
  iconContent: (
57
57
  <IconComponent
58
- icon_outlined={'usergroup-add'}
58
+ icon={'usergroup-add'}
59
+ outlined
59
60
  style={styles.backgroundSummer}
60
61
  />
61
62
  ),
@@ -357,9 +357,11 @@ const ScriptDetail = ({ route }) => {
357
357
  const isHaveScriptActions = data?.length > 0;
358
358
 
359
359
  const textCondition = useMemo(() => {
360
- if (type === AUTOMATE_TYPE.VALUE_CHANGE) {
360
+ if (
361
+ [AUTOMATE_TYPE.VALUE_CHANGE, AUTOMATE_TYPE.EVENT_SENSOR].includes(type)
362
+ ) {
361
363
  const { condition, config_name, value, sensor_type } =
362
- automate?.value_change;
364
+ automate?.value_change || automate?.event_sensor;
363
365
  const stateConditionData = STATE_VALUE_SENSOR_TYPES.find(
364
366
  (i) => i.type === sensor_type
365
367
  );
@@ -413,7 +415,9 @@ const ScriptDetail = ({ route }) => {
413
415
  const textWeekday = sortWeekday.map((item) => weekday[item]).join(', ');
414
416
  return `${textWeekday} ${t('at')} ${time}`;
415
417
  }
416
- } else if (type === AUTOMATE_TYPE.EVENT) {
418
+ } else if (
419
+ [AUTOMATE_TYPE.EVENT, AUTOMATE_TYPE.EVENT_ACTION].includes(type)
420
+ ) {
417
421
  const { action, end_device_name, config_name, sensor_type, value } =
418
422
  automate?.event;
419
423
  let textEvent = '';
@@ -5,7 +5,7 @@ import { API, Colors } from '../../../../configs';
5
5
  import moment from 'moment';
6
6
  import { Section, Today } from '../../../../commons';
7
7
  import ListQualityIndicator from '../../../../commons/Device/WaterQualitySensor/ListQualityIndicator';
8
- import PMSensorIndicatior from '../../../../commons/Device/PMSensor/PMSensorIndicatior';
8
+ import PMSensorIndicator from '../../../../commons/Device/PMSensor/PMSensorIndicator';
9
9
  import ConfigHistoryChart from '../../../../commons/UnitSummary/ConfigHistoryChart';
10
10
  import { useTranslations } from '../../../../hooks/Common/useTranslations';
11
11
  import HistoryChart from '../../../../commons/Device/HistoryChart';
@@ -243,7 +243,7 @@ const ThreePhasePowerConsumption = memo(({ summaryDetail }) => {
243
243
  {t('text_total_power_consumption')}
244
244
  </Text>
245
245
 
246
- <PMSensorIndicatior data={dataTotal} style={styles.styleTotalPower} />
246
+ <PMSensorIndicator data={dataTotal} style={styles.styleTotalPower} />
247
247
  {!!getData?.length && (
248
248
  <HistoryChart
249
249
  datas={getData}
@@ -6,7 +6,7 @@ import { API, Colors } from '../../../../configs';
6
6
  import Text from '../../../../commons/Text';
7
7
  import { Section, Today } from '../../../../commons';
8
8
  import ListQualityIndicator from '../../../../commons/Device/WaterQualitySensor/ListQualityIndicator';
9
- import PMSensorIndicatior from '../../../../commons/Device/PMSensor/PMSensorIndicatior';
9
+ import PMSensorIndicator from '../../../../commons/Device/PMSensor/PMSensorIndicator';
10
10
  import ConfigHistoryChart from '../../../../commons/UnitSummary/ConfigHistoryChart';
11
11
  import HistoryChart from '../../../../commons/Device/HistoryChart';
12
12
  import { AccessibilityLabel } from '../../../../configs/Constants';
@@ -152,7 +152,7 @@ const PowerConsumption = memo(({ summaryDetail }) => {
152
152
  {t('text_total_power_consumption')}
153
153
  </Text>
154
154
 
155
- <PMSensorIndicatior data={dataTotal} style={styles.styleTotalPower} />
155
+ <PMSensorIndicator data={dataTotal} style={styles.styleTotalPower} />
156
156
  {!!getData?.length && (
157
157
  <HistoryChart
158
158
  datas={getData}
@@ -1104,8 +1104,9 @@
1104
1104
  "text_alert_modal_popup_ct": "It’s a critical action and cannot be undone.",
1105
1105
  "text_understand_modal_popup_ct": "I fully understand that this action is critical and will lead to data loss.",
1106
1106
  "cannot_find_device_wifi": "Cannot find Device's Wifi",
1107
- "this_command_is_just_support_bluetooth_only": "This command is just support bluetooth only",
1107
+ "choose_only_one": "Choose only one condition event",
1108
1108
  "photo_request_permission_des": "To select photo from gallery, please unlock access photo permission",
1109
+ "this_command_is_just_support_bluetooth_only": "This command is just support bluetooth only",
1109
1110
  "used_pin": "Used PIN",
1110
1111
  "all_gateway": "All Gateway",
1111
1112
  "pin_number": "Pin number",
@@ -1103,8 +1103,9 @@
1103
1103
  "text_working_hard": "Chúng tôi đang làm việc chăm chỉ để làm cho điều này hoạt động",
1104
1104
  "photo_request_permission": "Quyền yêu cầu ảnh",
1105
1105
  "cannot_find_device_wifi": "Không thể tìm thấy Wifi của thiết bị",
1106
- "this_command_is_just_support_bluetooth_only": "Lệnh gửi này chỉ hỗ trợ bluetooth",
1106
+ "choose_only_one": "Chỉ chọn một điều kiện",
1107
1107
  "photo_request_permission_des": "Để chọn ảnh từ thư viện, vui lòng mở khóa quyền truy cập ảnh",
1108
+ "this_command_is_just_support_bluetooth_only": "Lệnh gửi này chỉ hỗ trợ bluetooth",
1108
1109
  "used_pin": "PIN đã sử dụng",
1109
1110
  "all_gateway": "Tất cả cổng kết nối",
1110
1111
  "pin_number": "Số PIN",