@eohjsc/react-native-smart-city 0.7.3-rc9 → 0.7.4

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 (166) hide show
  1. package/assets/images/Map/LocationPin.svg +10 -0
  2. package/package.json +4 -2
  3. package/src/commons/Action/__test__/ItemQuickAction.test.js +2 -2
  4. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
  5. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +3 -3
  6. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
  7. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
  8. package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
  9. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
  10. package/src/commons/ActionGroup/SliderRangeTemplate.js +7 -7
  11. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +2 -2
  12. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +5 -5
  13. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +5 -5
  14. package/src/commons/ActionGroup/TerminalBoxTemplate.js +2 -2
  15. package/src/commons/ActionGroup/TextBoxTemplate.js +2 -2
  16. package/src/commons/ActionGroup/TimerActionTemplate.js +6 -3
  17. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
  18. package/src/commons/ActionGroup/__test__/index.test.js +2 -2
  19. package/src/commons/ActionGroup/index.js +2 -2
  20. package/src/commons/Automate/ItemAutomate.js +9 -41
  21. package/src/commons/Automate/ItemConditionScriptDetail.js +109 -0
  22. package/src/commons/Automate/ItemConditionScriptDetailStyles.js +46 -0
  23. package/src/commons/Automate/__test__/ItemAutomate.test.js +0 -21
  24. package/src/commons/BackDefault/index.js +2 -2
  25. package/src/commons/BottomButtonView/index.js +1 -0
  26. package/src/commons/ButtonPopup/index.js +3 -2
  27. package/src/commons/DateTimeRangeChange/DateTimeButton.js +3 -3
  28. package/src/commons/Device/ConnectedViewHeader.js +2 -2
  29. package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
  30. package/src/commons/Device/FlatListItems.js +3 -3
  31. package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
  32. package/src/commons/Device/HorizontalBarChart.js +54 -34
  33. package/src/commons/Device/ItemAddNew/index.js +2 -2
  34. package/src/commons/Device/ItemDevice.js +2 -2
  35. package/src/commons/Device/SonosSpeaker/index.js +3 -3
  36. package/src/commons/Device/WaterPurifierStatus/AlertStatusMachine.js +2 -2
  37. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +6 -2
  38. package/src/commons/DisplayChecking/index.js +2 -2
  39. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
  40. package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
  41. package/src/commons/FlatListDnD/index.js +12 -9
  42. package/src/commons/Grid/GridItem.js +10 -2
  43. package/src/commons/Header/HeaderCustom.js +2 -2
  44. package/src/commons/HeaderAni/index.js +2 -2
  45. package/src/commons/IconComponent/index.js +4 -4
  46. package/src/commons/NavBar/index.js +2 -2
  47. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
  48. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +4 -4
  49. package/src/commons/SearchLocation/index.js +3 -3
  50. package/src/commons/SelectActionCard/index.js +2 -2
  51. package/src/commons/SelectSubUnit/index.js +6 -2
  52. package/src/commons/Sharing/BtnRemoveMember.js +2 -2
  53. package/src/commons/Sharing/StationDevicePermissions.js +2 -2
  54. package/src/commons/SubUnit/DeviceTemplate/ConfigAndEvaluation/ConfigAndEvaluation.js +2 -2
  55. package/src/commons/SubUnit/DeviceTemplate/ConfigValue/ConfigValue.js +2 -2
  56. package/src/commons/SubUnit/DeviceTemplate/EvaluationOverConfig/EvaluationOverConfig.js +2 -2
  57. package/src/commons/SubUnit/OneTap/ItemOneTap.js +3 -4
  58. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +0 -2
  59. package/src/commons/SubUnit/OneTap/index.js +9 -8
  60. package/src/commons/Unit/HeaderUnit/index.js +3 -3
  61. package/src/commons/Unit/SharedUnit.js +7 -7
  62. package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +4 -15
  63. package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +29 -18
  64. package/src/configs/API.js +1 -1
  65. package/src/configs/AccessibilityLabel.js +1 -0
  66. package/src/configs/Theme.js +1 -1
  67. package/src/hooks/IoT/__test__/useRemoteControl.test.js +14 -7
  68. package/src/hooks/IoT/useRemoteControl.js +18 -7
  69. package/src/hooks/useMqtt.js +2 -2
  70. package/src/iot/RemoteControl/Bluetooth.js +19 -22
  71. package/src/iot/RemoteControl/Internet.js +11 -3
  72. package/src/navigations/EmergencyContactsStack.js +4 -3
  73. package/src/navigations/SharedStack.js +2 -0
  74. package/src/navigations/UnitStack.js +56 -57
  75. package/src/screens/AQIGuide/index.js +0 -2
  76. package/src/screens/ActivityLog/index.js +2 -2
  77. package/src/screens/AddLocationMaps/index.js +16 -19
  78. package/src/screens/AddLocationMaps/indexStyle.js +1 -0
  79. package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
  80. package/src/screens/AddNewGateway/SelectDeviceType.js +1 -1
  81. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +25 -9
  82. package/src/screens/Automate/AddNewAction/ChooseAction.js +17 -3
  83. package/src/screens/Automate/AddNewAction/ChooseConfig.js +7 -6
  84. package/src/screens/Automate/AddNewAction/NewActionWrapper.js +8 -8
  85. package/src/screens/Automate/AddNewAction/SelectControlDevices.js +30 -20
  86. package/src/screens/Automate/AddNewAction/SelectMonitorDevices.js +17 -10
  87. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +58 -44
  88. package/src/screens/Automate/AddNewAction/SetupScriptDelay.js +1 -1
  89. package/src/screens/Automate/AddNewAction/SetupScriptNotify.js +3 -3
  90. package/src/screens/Automate/AddNewAction/Styles/SetupSensorStyles.js +20 -4
  91. package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +1 -1
  92. package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +14 -8
  93. package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +13 -7
  94. package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +54 -15
  95. package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +29 -0
  96. package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +10 -10
  97. package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +2 -0
  98. package/src/screens/Automate/Components/InputName.js +10 -7
  99. package/src/screens/Automate/EditActionsList/index.js +19 -17
  100. package/src/screens/Automate/MultiUnits.js +19 -22
  101. package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +12 -2
  102. package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +9 -1
  103. package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +14 -6
  104. package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +4 -7
  105. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +42 -17
  106. package/src/screens/Automate/ScriptDetail/index.js +33 -22
  107. package/src/screens/Automate/SetSchedule/__test__/index.test.js +21 -10
  108. package/src/screens/Automate/SetSchedule/components/RowItem.js +5 -5
  109. package/src/screens/Automate/SetSchedule/index.js +8 -7
  110. package/src/screens/Automate/Styles/indexStyles.js +1 -1
  111. package/src/screens/Automate/__test__/MultiUnits.test.js +1 -4
  112. package/src/screens/Automate/__test__/index.test.js +0 -1
  113. package/src/screens/Automate/index.js +36 -34
  114. package/src/screens/ChangePosition/index.js +2 -1
  115. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +4 -4
  116. package/src/screens/Device/EditDevice/index.js +4 -4
  117. package/src/screens/Device/__test__/BluetoothDevice.test.js +300 -0
  118. package/src/screens/Device/__test__/detail.test.js +3 -3
  119. package/src/screens/Device/components/BluetoothDevice.js +135 -0
  120. package/src/screens/Device/components/SensorDisplayItem.js +4 -3
  121. package/src/screens/Device/detail.js +70 -62
  122. package/src/screens/Device/hooks/useEvaluateValue.js +1 -1
  123. package/src/screens/Drawer/index.js +3 -3
  124. package/src/screens/EmergencyContacts/EmergencyContactsList.js +8 -4
  125. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
  126. package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
  127. package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
  128. package/src/screens/GuestInfo/index.js +2 -2
  129. package/src/screens/HanetCamera/ManageAccess.js +3 -3
  130. package/src/screens/HanetCamera/MemberInfo.js +2 -2
  131. package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
  132. package/src/screens/ManageAccess/index.js +3 -3
  133. package/src/screens/Notification/components/NotificationItem.js +3 -3
  134. package/src/screens/Notification/index.js +3 -3
  135. package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
  136. package/src/screens/SelectUnit/__test__/index.test.js +1 -1
  137. package/src/screens/SelectUnit/index.js +4 -4
  138. package/src/screens/SharedUnit/TabHeader.js +2 -2
  139. package/src/screens/Sharing/Components/EndDevice.js +3 -3
  140. package/src/screens/Sharing/UnitMemberList.js +2 -2
  141. package/src/screens/SmartAccount/SuccessfullyConnected/index.js +2 -2
  142. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +3 -2
  143. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +2 -2
  144. package/src/screens/SmartIr/components/SelectBrand.js +2 -2
  145. package/src/screens/SubUnit/AddSubUnit.js +28 -24
  146. package/src/screens/SubUnit/AddSubUnitStyles.js +10 -4
  147. package/src/screens/SubUnit/EditSubUnit.js +12 -11
  148. package/src/screens/SubUnit/ManageSubUnit.js +3 -3
  149. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +13 -13
  150. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +3 -3
  151. package/src/screens/Template/EditTemplate.js +6 -4
  152. package/src/screens/UVIndexGuide/index.js +2 -4
  153. package/src/screens/Unit/SelectAddToFavorites.js +2 -2
  154. package/src/screens/Unit/SelectAddress.js +16 -12
  155. package/src/screens/Unit/components/AutomateScript/index.js +2 -2
  156. package/src/screens/Unit/components/ButtonWrapper/index.js +3 -3
  157. package/src/screens/Unit/components/Header/index.js +2 -2
  158. package/src/screens/Unit/components/SharedUnit/index.js +5 -5
  159. package/src/screens/UnitSummary/components/AirQuality/index.js +6 -11
  160. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +6 -6
  161. package/src/screens/UnitSummary/index.js +3 -3
  162. package/src/utils/Apis/axios.js +5 -5
  163. package/src/utils/Functions/ShortEmail.js +1 -0
  164. package/src/utils/I18n/translations/en.js +6 -3
  165. package/src/utils/I18n/translations/vi.js +8 -4
  166. package/src/utils/bluetooth.js +3 -0
@@ -1,5 +1,5 @@
1
1
  import React, { useRef } from 'react';
2
- import AntDesign from 'react-native-vector-icons/AntDesign';
2
+ import { IconOutline } from '@ant-design/icons-react-native';
3
3
  import { View, TouchableOpacity } from 'react-native';
4
4
 
5
5
  import styles from './NavBarStyles';
@@ -40,7 +40,7 @@ const NavBar = ({
40
40
  ref={refMenuAction}
41
41
  accessibilityLabel={idLabelIconBars}
42
42
  >
43
- <AntDesign name={'bars'} size={19} color={Colors.Black} />
43
+ <IconOutline name={'bars'} size={19} color={Colors.Black} />
44
44
  </TouchableOpacity>
45
45
  </View>
46
46
  <MenuActionMore
@@ -1,6 +1,6 @@
1
1
  import React, { memo, useState, useCallback, useEffect } from 'react';
2
2
  import { View, TouchableOpacity } from 'react-native';
3
- import AntDesign from 'react-native-vector-icons/AntDesign';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
4
 
5
5
  import { useTranslations } from '../../hooks/Common/useTranslations';
6
6
  import styles from './NumberUpDownActionTemplateStyles';
@@ -118,7 +118,7 @@ const NumberUpDownActionTemplate = ({ device, item = {}, onSelectAction }) => {
118
118
  AccessibilityLabel.NUMBER_UP_DOWN_ACTION_DOWN
119
119
  }
120
120
  >
121
- <AntDesign name="down" size={32} color={Colors.Primary} />
121
+ <IconOutline name="down" size={32} color={Colors.Primary} />
122
122
  </TouchableOpacity>
123
123
  <Text
124
124
  type="H2"
@@ -134,7 +134,7 @@ const NumberUpDownActionTemplate = ({ device, item = {}, onSelectAction }) => {
134
134
  onPress={onPressUp}
135
135
  accessibilityLabel={AccessibilityLabel.NUMBER_UP_DOWN_ACTION_UP}
136
136
  >
137
- <AntDesign name="up" size={32} color={Colors.Primary} />
137
+ <IconOutline name="up" size={32} color={Colors.Primary} />
138
138
  </TouchableOpacity>
139
139
  </View>
140
140
  <View style={styles.wrapButton}>
@@ -27,7 +27,7 @@ describe('Test StatesGridActionTemplate', () => {
27
27
  config: 1024,
28
28
  is_on_value: 1,
29
29
  action: '800ff454-4e2a-4a38-bad6-1bded728193e',
30
- icon: 'upcircle',
30
+ icon: 'up-circle',
31
31
  icon_kit: 41,
32
32
  text: 'Auto',
33
33
  },
@@ -35,7 +35,7 @@ describe('Test StatesGridActionTemplate', () => {
35
35
  config: 1024,
36
36
  is_on_value: 2,
37
37
  action: '4e43da81-469e-4d23-a66b-2656db7cf196',
38
- icon: 'upcircle',
38
+ icon: 'up-circle',
39
39
  icon_kit: 42,
40
40
  text: 'Cool',
41
41
  },
@@ -43,7 +43,7 @@ describe('Test StatesGridActionTemplate', () => {
43
43
  config: 1024,
44
44
  is_on_value: 3,
45
45
  action: '63f1bbfa-0e42-4401-9ea2-4aa07327ff26',
46
- icon: 'upcircle',
46
+ icon: 'up-circle',
47
47
  icon_kit: 44,
48
48
  text: 'Dry',
49
49
  },
@@ -51,7 +51,7 @@ describe('Test StatesGridActionTemplate', () => {
51
51
  config: 1024,
52
52
  is_on_value: 4,
53
53
  action: '8ba3e471-dd84-478b-87f3-6008aead8804',
54
- icon: 'upcircle',
54
+ icon: 'up-circle',
55
55
  icon_kit: 43,
56
56
  text: 'Fan Only',
57
57
  },
@@ -1,6 +1,6 @@
1
1
  import React, { memo } from 'react';
2
2
  import { View, TextInput } from 'react-native';
3
- import AntDesign from 'react-native-vector-icons/AntDesign';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
4
  import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
 
6
6
  import { Colors } from '../../configs';
@@ -10,8 +10,8 @@ const SearchBarLocation = memo(({ input, onTextInput }) => {
10
10
  const t = useTranslations();
11
11
  return (
12
12
  <View style={styles.container}>
13
- <AntDesign
14
- name="search1"
13
+ <IconOutline
14
+ name="search"
15
15
  size={24}
16
16
  color={Colors.Gray6}
17
17
  accessibilityLabel="icon-search"
@@ -1,6 +1,6 @@
1
1
  import React, { memo } from 'react';
2
2
  import { View, TouchableOpacity } from 'react-native';
3
- import AntDesign from 'react-native-vector-icons/AntDesign';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
4
 
5
5
  import { Card } from '../CardShadow';
6
6
  import Text from '../Text';
@@ -20,7 +20,7 @@ const SelectActionCard = memo(({ title, action, onPress }) => {
20
20
  {action}
21
21
  </Text>
22
22
  </View>
23
- <AntDesign name="right" size={20} />
23
+ <IconOutline name="right" size={20} />
24
24
  </View>
25
25
  </TouchableOpacity>
26
26
  </Card>
@@ -2,7 +2,7 @@ import React, { memo, useCallback, useEffect, useMemo, useState } from 'react';
2
2
  import { useIsFocused, useNavigation } from '@react-navigation/native';
3
3
  import { useTranslations } from '../../hooks/Common/useTranslations';
4
4
  import { ScrollView, TouchableOpacity, View } from 'react-native';
5
- import AntDesign from 'react-native-vector-icons/AntDesign';
5
+ import { IconOutline } from '@ant-design/icons-react-native';
6
6
 
7
7
  import { API, Colors } from '../../configs';
8
8
  import { RadioCircle, Section, ViewButtonBottom } from '../../commons';
@@ -98,7 +98,11 @@ const SelectSubUnit = ({ unitId, title, subTitle, onPressNext, route }) => {
98
98
  />
99
99
  ))}
100
100
  <TouchableOpacity style={styles.rowContainer} onPress={addSubUnit}>
101
- <AntDesign name="plus-circle" size={20} color={Colors.Primary} />
101
+ <IconOutline
102
+ name="plus-circle"
103
+ size={20}
104
+ color={Colors.Primary}
105
+ />
102
106
  <View style={styles.row}>
103
107
  <Text type="H4" color={Colors.Primary}>
104
108
  {t('add_new_sub_unit')}
@@ -1,6 +1,6 @@
1
1
  import React, { memo, useCallback } from 'react';
2
2
  import { TouchableOpacity, StyleSheet } from 'react-native';
3
- import AntDesign from 'react-native-vector-icons/AntDesign';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
4
  import { Colors } from '../../configs';
5
5
 
6
6
  const BtnRemoveMember = memo(({ member, onPressRemove }) => {
@@ -9,7 +9,7 @@ const BtnRemoveMember = memo(({ member, onPressRemove }) => {
9
9
  }, [member, onPressRemove]);
10
10
  return (
11
11
  <TouchableOpacity style={styles.buttonRemove} onPress={onPress}>
12
- <AntDesign name={'minus'} size={20} color={Colors.Gray8} />
12
+ <IconOutline name={'minus'} size={20} color={Colors.Gray8} />
13
13
  </TouchableOpacity>
14
14
  );
15
15
  });
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useCallback } from 'react';
2
2
  import { View, StyleSheet, TouchableOpacity } from 'react-native';
3
- import AntDesign from 'react-native-vector-icons/AntDesign';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
4
  import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
  import { Colors } from '../../configs';
6
6
  import Text from '../../commons/Text';
@@ -86,7 +86,7 @@ const StationDevicePermissions = ({ dataStation, onselectSensor }) => {
86
86
  <View style={styles.infoContainer}>
87
87
  <Text style={styles.text}>{sensor.name}</Text>
88
88
  <View style={styles.rightImage}>
89
- <AntDesign
89
+ <IconOutline
90
90
  name={expandedIndex === index ? 'up' : 'down'}
91
91
  size={20}
92
92
  color={Colors.Gray6}
@@ -5,7 +5,7 @@ import Text from '../../../Text';
5
5
  import LastUpdatedText from '../../../Device/LastUpdatedText';
6
6
  import { EvaluationConfigWrapper } from '../EvaluationOverConfig/EvaluationOverConfig';
7
7
  import IconComponent from '../../../IconComponent';
8
- import AntDesign from 'react-native-vector-icons/AntDesign';
8
+ import { IconOutline } from '@ant-design/icons-react-native';
9
9
 
10
10
  const ConfigAndEvaluationDisplay = memo(
11
11
  ({ device, valueEvaluation, stationItem, configValue }) => {
@@ -44,7 +44,7 @@ const ConfigAndEvaluationDisplay = memo(
44
44
  lastUpdated={configValue?.last_updated}
45
45
  format={'DDMMYYYY'}
46
46
  />
47
- <AntDesign style={styles.marginTop10} name="right" size={12} />
47
+ <IconOutline style={styles.marginTop10} name="right" size={12} />
48
48
  </View>
49
49
  )}
50
50
  </>
@@ -5,7 +5,7 @@ import Text from '../../../Text';
5
5
  import { useConfigGlobalState } from '../../../../iot/states';
6
6
  import LastUpdatedText from '../../../Device/LastUpdatedText';
7
7
  import IconComponent from '../../../IconComponent';
8
- import AntDesign from 'react-native-vector-icons/AntDesign';
8
+ import { IconOutline } from '@ant-design/icons-react-native';
9
9
 
10
10
  const ConfigValue = ({ device, stationItem }) => {
11
11
  const [configValues] = useConfigGlobalState('configValues');
@@ -40,7 +40,7 @@ const ConfigValue = ({ device, stationItem }) => {
40
40
  lastUpdated={configValue?.last_updated}
41
41
  format={'DDMMYYYY'}
42
42
  />
43
- <AntDesign style={styles.marginTop10} name="right" size={12} />
43
+ <IconOutline style={styles.marginTop10} name="right" size={12} />
44
44
  </View>
45
45
  )}
46
46
  </View>
@@ -9,7 +9,7 @@ import {
9
9
  } from '../../../../screens/Device/hooks/useEvaluateValue';
10
10
  import LastUpdatedText from '../../../Device/LastUpdatedText';
11
11
  import IconComponent from '../../../IconComponent';
12
- import AntDesign from 'react-native-vector-icons/AntDesign';
12
+ import { IconOutline } from '@ant-design/icons-react-native';
13
13
 
14
14
  export const EvaluationConfigWrapper = memo(
15
15
  ({ device, stationItem, Child }) => {
@@ -69,7 +69,7 @@ const EvaluationOverConfigDisplay = memo(
69
69
  lastUpdated={configValue?.last_updated}
70
70
  format={'DDMMYYYY'}
71
71
  />
72
- <AntDesign style={styles.marginTop10} name="right" size={12} />
72
+ <IconOutline style={styles.marginTop10} name="right" size={12} />
73
73
  </View>
74
74
  )}
75
75
  </View>
@@ -1,6 +1,6 @@
1
1
  import React, { memo, useCallback } from 'react';
2
2
  import { TouchableOpacity, TouchableWithoutFeedback, View } from 'react-native';
3
- import AntDesign from 'react-native-vector-icons/AntDesign';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
4
  import moment from 'moment';
5
5
  import Text from '../../Text';
6
6
  import { API, Colors } from '../../../configs';
@@ -27,10 +27,9 @@ const ItemOneTap = memo(({ automate = {}, wrapSyles, onPressItem }) => {
27
27
 
28
28
  const goToDetail = useCallback(() => {
29
29
  navigate(Routes.ScriptDetail, {
30
- id,
31
30
  preAutomate: automate,
32
31
  });
33
- }, [automate, navigate, id]);
32
+ }, [automate, navigate]);
34
33
 
35
34
  const handleScriptAction = useCallback(async () => {
36
35
  const { success } = await axiosPost(API.AUTOMATE.ACTION_ONE_TAP(id));
@@ -107,7 +106,7 @@ const ItemOneTap = memo(({ automate = {}, wrapSyles, onPressItem }) => {
107
106
  >
108
107
  {activateAt && t('activated_time', { time: activateAt })}
109
108
  </Text>
110
- <AntDesign name="right" size={12} />
109
+ <IconOutline name="right" size={12} />
111
110
  </View>
112
111
  </TouchableOpacity>
113
112
  </View>
@@ -107,7 +107,6 @@ describe('test Item', () => {
107
107
  await goDetail[0].props.onPress();
108
108
  });
109
109
  expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail, {
110
- id: 1,
111
110
  preAutomate: data.listAutomate[0].data[0],
112
111
  });
113
112
 
@@ -194,7 +193,6 @@ describe('test Item', () => {
194
193
  await goDetail[0].props.onPress();
195
194
  });
196
195
  expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail, {
197
- id: 1,
198
196
  preAutomate: data.listAutomate[0].data[0],
199
197
  });
200
198
  });
@@ -7,22 +7,22 @@ import React, {
7
7
  } from 'react';
8
8
  import { TouchableOpacity, View } from 'react-native';
9
9
 
10
- import { Section } from '../..';
11
- import ItemAddNew from '../../Device/ItemAddNew';
12
- import ItemOneTap from './ItemOneTap';
13
- import { useTranslations } from '../../../hooks/Common/useTranslations';
14
10
  import { useNavigation, useRoute } from '@react-navigation/native';
15
- import Routes from '../../../utils/Route/index.js';
11
+ import { Section } from '../..';
16
12
  import {
17
- AUTOMATE_TYPE,
18
13
  AccessibilityLabel,
19
14
  AUTOMATE_TABS,
15
+ AUTOMATE_TYPE,
20
16
  } from '../../../configs/Constants';
17
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
18
+ import Routes from '../../../utils/Route/index.js';
19
+ import ItemAddNew from '../../Device/ItemAddNew';
21
20
  import Text from '../../Text/index.js';
21
+ import ItemOneTap from './ItemOneTap';
22
22
 
23
- import styles from './OneTapStyles.js';
24
- import { ToastBottomHelper } from '../../../utils/Utils';
25
23
  import { useBackendPermission } from '../../../utils/Permission/backend';
24
+ import { ToastBottomHelper } from '../../../utils/Utils';
25
+ import styles from './OneTapStyles.js';
26
26
 
27
27
  const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
28
28
  const t = useTranslations();
@@ -57,6 +57,7 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
57
57
  type: AUTOMATE_TYPE.ONE_TAP,
58
58
  unit: unit?.id,
59
59
  },
60
+ unitId: unit?.id,
60
61
  closeScreen: currentScreen,
61
62
  });
62
63
  break;
@@ -1,6 +1,6 @@
1
1
  import React, { memo, useCallback, useMemo, useRef } from 'react';
2
2
  import { StatusBar, StyleSheet, TouchableOpacity, View } from 'react-native';
3
- import AntDesign from 'react-native-vector-icons/AntDesign';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
4
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
5
5
  import { useNavigation, useRoute } from '@react-navigation/native';
6
6
  import { getStatusBarHeight } from 'react-native-iphone-x-helper';
@@ -53,7 +53,7 @@ const HeaderUnit = memo(({ transparent, unit }) => {
53
53
  onPress={handleGoBack}
54
54
  >
55
55
  <View style={styles.btnLeft}>
56
- <AntDesign name={'left'} size={27} color={colorHeader} />
56
+ <IconOutline name={'left'} size={27} color={colorHeader} />
57
57
  </View>
58
58
  </TouchableOpacity>
59
59
  {!transparent && (
@@ -71,7 +71,7 @@ const HeaderUnit = memo(({ transparent, unit }) => {
71
71
  onPress={setShowAdd}
72
72
  >
73
73
  <View style={styles.btnAdd}>
74
- <AntDesign name={'plus'} size={27} color={colorHeader} />
74
+ <IconOutline name={'plus'} size={27} color={colorHeader} />
75
75
  </View>
76
76
  </TouchableOpacity>
77
77
  )}
@@ -1,7 +1,7 @@
1
1
  import React, { Fragment, useCallback } from 'react';
2
2
  import { View, Image, TouchableOpacity } from 'react-native';
3
3
  import { useTranslations } from '../../hooks/Common/useTranslations';
4
- import AntDesign from 'react-native-vector-icons/AntDesign';
4
+ import { IconFill, IconOutline } from '@ant-design/icons-react-native';
5
5
 
6
6
  import { API, Colors, Images } from '../../configs';
7
7
  import Text from '../../commons/Text';
@@ -91,7 +91,7 @@ const SharedUnit = ({
91
91
  {isOptions && (
92
92
  <Fragment>
93
93
  {item.is_pin ? (
94
- <AntDesign
94
+ <IconFill
95
95
  name="pushpin"
96
96
  size={20}
97
97
  color={Colors.Blue10}
@@ -99,15 +99,15 @@ const SharedUnit = ({
99
99
  accessibilityLabel={`${AccessibilityLabel.ICON_REMOVE_PIN_SHARED_UNIT}-${item.id}`}
100
100
  />
101
101
  ) : (
102
- <AntDesign
103
- name="pushpino"
102
+ <IconOutline
103
+ name="pushpin"
104
104
  size={20}
105
105
  onPress={addPinSharedUnit}
106
106
  accessibilityLabel={`${AccessibilityLabel.ICON_ADD_PIN_SHARED_UNIT}-${item.id}`}
107
107
  />
108
108
  )}
109
109
  {item.is_star ? (
110
- <AntDesign
110
+ <IconFill
111
111
  name="star"
112
112
  size={20}
113
113
  color={Colors.Yellow6}
@@ -115,8 +115,8 @@ const SharedUnit = ({
115
115
  accessibilityLabel={`${AccessibilityLabel.ICON_REMOVE_STAR_SHARED_UNIT}-${item.id}`}
116
116
  />
117
117
  ) : (
118
- <AntDesign
119
- name="staro"
118
+ <IconOutline
119
+ name="star"
120
120
  size={20}
121
121
  onPress={addStarSharedUnit}
122
122
  accessibilityLabel={`${AccessibilityLabel.ICON_ADD_STAR_SHARED_UNIT}-${item.id}`}
@@ -9,16 +9,10 @@ import { useFetchConfigHistory } from '../../UnitSummary/ConfigHistoryChart';
9
9
  import API from '../../../configs/API';
10
10
  import WebView from 'react-native-webview';
11
11
  import { TouchableOpacity, View } from 'react-native';
12
- import { useRemoteControl } from '../../../hooks/IoT';
13
- import { useSCContextSelector } from '../../../context';
14
12
 
15
13
  const IFrameWithConfig = memo(
16
- ({ item = {}, widgetStyle, isWidgetBox, isSetting, isEditing }) => {
14
+ ({ item = {}, widgetStyle, isWidgetBox, isSetting, isEditing, doAction }) => {
17
15
  const ref = useRef();
18
- const sendRemoteCommand = useRemoteControl();
19
- const userId = useSCContextSelector(
20
- (state) => state?.auth?.account?.user?.id
21
- );
22
16
 
23
17
  const { configuration } = item;
24
18
  const { url } = configuration || {};
@@ -73,7 +67,7 @@ const IFrameWithConfig = memo(
73
67
  }, [item?.id, url]);
74
68
 
75
69
  const triggerAction = useCallback(
76
- async ({ actionKey, actionIndex, data }) => {
70
+ async ({ actionKey, actionIndex, data, interrupted = false, silent }) => {
77
71
  let action = null;
78
72
  if (!configuration?.actions) {
79
73
  return;
@@ -90,14 +84,9 @@ const IFrameWithConfig = memo(
90
84
  if (!action) {
91
85
  return;
92
86
  }
93
- await sendRemoteCommand(
94
- action.action_data.end_device,
95
- action.action_data,
96
- data,
97
- userId
98
- );
87
+ await doAction(action.action_data, data, interrupted, silent);
99
88
  },
100
- [configuration?.actions, sendRemoteCommand, userId]
89
+ [configuration?.actions, doAction]
101
90
  );
102
91
 
103
92
  const onMessage = useCallback(
@@ -12,13 +12,6 @@ import { TouchableOpacity, View } from 'react-native';
12
12
  import { refFunctions } from '../../../../../__mocks__/react-native-webview';
13
13
 
14
14
  const mockDoAction = jest.fn();
15
- jest.mock('../../../../hooks/IoT', () => {
16
- return {
17
- ...jest.requireActual('../../../../hooks/IoT'),
18
- useRemoteControl: () => mockDoAction,
19
- };
20
- });
21
-
22
15
  jest.mock('../../../../iot/states', () => {
23
16
  return {
24
17
  ...jest.requireActual('../../../../iot/states'),
@@ -48,7 +41,9 @@ describe('Test IFrame With Config', () => {
48
41
  });
49
42
 
50
43
  test('test with widget box', async () => {
51
- const { root } = await render(<IFrameWithConfig isWidgetBox item={item} />);
44
+ const { root } = await render(
45
+ <IFrameWithConfig doAction={mockDoAction} isWidgetBox item={item} />
46
+ );
52
47
 
53
48
  const iframes = root.findAllByType(WebView);
54
49
  expect(iframes).toHaveLength(1);
@@ -60,7 +55,9 @@ describe('Test IFrame With Config', () => {
60
55
 
61
56
  test('test with query string', async () => {
62
57
  item.configuration.url = 'http://localhost:3000/?test=1';
63
- const { root } = await render(<IFrameWithConfig isWidgetBox item={item} />);
58
+ const { root } = await render(
59
+ <IFrameWithConfig isWidgetBox doAction={mockDoAction} item={item} />
60
+ );
64
61
 
65
62
  const iframes = root.findAllByType(WebView);
66
63
  expect(iframes).toHaveLength(1);
@@ -71,7 +68,9 @@ describe('Test IFrame With Config', () => {
71
68
  });
72
69
 
73
70
  test('test reload', async () => {
74
- const { root } = await render(<IFrameWithConfig isWidgetBox item={item} />);
71
+ const { root } = await render(
72
+ <IFrameWithConfig isWidgetBox doAction={mockDoAction} item={item} />
73
+ );
75
74
 
76
75
  const buttons = root.findAllByType(TouchableOpacity);
77
76
  expect(buttons).toHaveLength(1);
@@ -84,7 +83,9 @@ describe('Test IFrame With Config', () => {
84
83
  });
85
84
 
86
85
  test('test iframe is ready', async () => {
87
- const { root } = await render(<IFrameWithConfig isWidgetBox item={item} />);
86
+ const { root } = await render(
87
+ <IFrameWithConfig isWidgetBox doAction={mockDoAction} item={item} />
88
+ );
88
89
  const webview = root.findByType(WebView);
89
90
 
90
91
  await act(async () => {
@@ -129,7 +130,9 @@ describe('Test IFrame With Config', () => {
129
130
  });
130
131
 
131
132
  test('test iframe request more height', async () => {
132
- const { root } = await render(<IFrameWithConfig isWidgetBox item={item} />);
133
+ const { root } = await render(
134
+ <IFrameWithConfig isWidgetBox doAction={mockDoAction} item={item} />
135
+ );
133
136
  const webview = root.findByType(WebView);
134
137
 
135
138
  await act(async () => {
@@ -151,7 +154,9 @@ describe('Test IFrame With Config', () => {
151
154
  });
152
155
 
153
156
  test('test iframe receive message from unexpected origin', async () => {
154
- const { root } = await render(<IFrameWithConfig isWidgetBox item={item} />);
157
+ const { root } = await render(
158
+ <IFrameWithConfig isWidgetBox doAction={mockDoAction} item={item} />
159
+ );
155
160
  const webview = root.findByType(WebView);
156
161
 
157
162
  await act(async () => {
@@ -187,7 +192,9 @@ describe('Test IFrame With Config', () => {
187
192
  item.configuration.history_configs = [{ id: 1 }];
188
193
  item.configuration.realtime_configs = [];
189
194
 
190
- const { root } = await render(<IFrameWithConfig isWidgetBox item={item} />);
195
+ const { root } = await render(
196
+ <IFrameWithConfig isWidgetBox doAction={mockDoAction} item={item} />
197
+ );
191
198
  const webview = root.findByType(WebView);
192
199
 
193
200
  await act(async () => {
@@ -226,7 +233,9 @@ describe('Test IFrame With Config', () => {
226
233
  item.configuration.history_configs = [{ id: 1 }];
227
234
  item.configuration.realtime_configs = [];
228
235
 
229
- const { root } = await render(<IFrameWithConfig isWidgetBox item={item} />);
236
+ const { root } = await render(
237
+ <IFrameWithConfig isWidgetBox doAction={mockDoAction} item={item} />
238
+ );
230
239
  const webview = root.findByType(WebView);
231
240
 
232
241
  await act(async () => {
@@ -303,7 +312,9 @@ describe('Test IFrame With Config', () => {
303
312
  ]
304
313
  ) => {
305
314
  item.configuration.actions = actions;
306
- const { root } = await render(<IFrameWithConfig isWidgetBox item={item} />);
315
+ const { root } = await render(
316
+ <IFrameWithConfig isWidgetBox doAction={mockDoAction} item={item} />
317
+ );
307
318
  const webview = root.findByType(WebView);
308
319
 
309
320
  await act(async () => {
@@ -324,9 +335,9 @@ describe('Test IFrame With Config', () => {
324
335
  test('test iframe trigger action', async () => {
325
336
  await triggerAction({ actionKey: 'xxx' });
326
337
  expect(mockDoAction).toHaveBeenCalledWith(
327
- item.configuration.actions[0].action_data.end_device,
328
338
  item.configuration.actions[0].action_data,
329
339
  undefined,
340
+ false,
330
341
  undefined
331
342
  );
332
343
  });
@@ -334,9 +345,9 @@ describe('Test IFrame With Config', () => {
334
345
  test('test iframe trigger by index', async () => {
335
346
  await triggerAction({ actionIndex: 0 });
336
347
  expect(mockDoAction).toHaveBeenCalledWith(
337
- item.configuration.actions[0].action_data.end_device,
338
348
  item.configuration.actions[0].action_data,
339
349
  undefined,
350
+ false,
340
351
  undefined
341
352
  );
342
353
  });
@@ -54,7 +54,7 @@ const API = {
54
54
  JSON_CONFIGURATION: '/chip_manager/chips/json_configuration/',
55
55
  },
56
56
  DEVICE: {
57
- SENSOR_DETAIL: (id) => `/property_manager/devices/${id}/`,
57
+ DEVICE_DETAIL: (id) => `/property_manager/devices/${id}/`,
58
58
  DISPLAY: (id) => `/property_manager/devices/${id}/display/`,
59
59
  SIDE_MENU_DETAIL: (id, side_menu_id) =>
60
60
  `/property_manager/devices/${id}/display/side_menu/${side_menu_id}/`,
@@ -239,6 +239,7 @@ export default {
239
239
  BUTTON_ADD_SCRIPT_ACTION: 'BUTTON_ADD_SCRIPT_ACTION',
240
240
  ICON_CLOSE: 'ICON_CLOSE',
241
241
  ICON_MORE: 'ICON_MORE',
242
+ ICON_MENU_POPUP: 'ICON_MENU_POPUP',
242
243
  ICON_ARROW_RIGHT: 'ICON_ARROW_RIGHT',
243
244
  TEXT_AUTOMATE_NAME: 'TEXT_AUTOMATE_NAME',
244
245
  AUTOMATE_LIST_SCRIPT_ACTION: 'AUTOMATE_LIST_SCRIPT_ACTION',
@@ -86,7 +86,7 @@ export default StyleSheet.create({
86
86
  alignItems: 'center',
87
87
  },
88
88
  menuIcon: {
89
- paddingLeft: 16,
89
+ paddingRight: 10,
90
90
  height: '100%',
91
91
  justifyContent: 'center',
92
92
  },
@@ -81,7 +81,8 @@ describe('Test useRemoteControl', () => {
81
81
  sensor,
82
82
  action,
83
83
  data,
84
- userId
84
+ userId,
85
+ false
85
86
  );
86
87
  expect(sendCommandOverInternet).not.toBeCalled();
87
88
  expect(sendCommandOverHomeAssistant).not.toBeCalled();
@@ -106,13 +107,15 @@ describe('Test useRemoteControl', () => {
106
107
  sensor,
107
108
  action,
108
109
  data,
109
- userId
110
+ userId,
111
+ false
110
112
  );
111
113
  expect(sendCommandOverInternet).toBeCalledWith(
112
114
  sensor,
113
115
  action,
114
116
  data,
115
- 'bluetooth'
117
+ 'bluetooth',
118
+ false
116
119
  );
117
120
  expect(sendCommandOverInternet).toBeCalledTimes(1);
118
121
  expect(sendCommandOverHomeAssistant).not.toBeCalled();
@@ -143,7 +146,8 @@ describe('Test useRemoteControl', () => {
143
146
  sensor,
144
147
  action,
145
148
  data,
146
- userId
149
+ userId,
150
+ false
147
151
  );
148
152
  expect(sendCommandOverInternet).not.toBeCalled();
149
153
  expect(sendCommandOverHomeAssistant).not.toBeCalled();
@@ -181,7 +185,8 @@ describe('Test useRemoteControl', () => {
181
185
  sensor,
182
186
  action,
183
187
  data,
184
- userId
188
+ userId,
189
+ false
185
190
  );
186
191
  expect(sendCommandOverHomeAssistant).not.toBeCalled();
187
192
  });
@@ -202,7 +207,8 @@ describe('Test useRemoteControl', () => {
202
207
  sensor,
203
208
  action,
204
209
  data,
205
- 'internet'
210
+ 'internet',
211
+ false
206
212
  );
207
213
  expect(sendCommandOverInternet).toBeCalledTimes(1);
208
214
  expect(sendCommandOverBluetooth).not.toBeCalled();
@@ -303,7 +309,8 @@ describe('Test useRemoteControl', () => {
303
309
  sensor,
304
310
  action,
305
311
  data,
306
- 'bluetooth'
312
+ 'bluetooth',
313
+ false
307
314
  );
308
315
  expect(sendCommandOverBluetooth).toBeCalledTimes(6);
309
316
  expect(sendCommandOverInternet).toBeCalledTimes(1);