@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
@@ -0,0 +1,10 @@
1
+ <svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_2900_24288)">
3
+ <path d="M15 2.5C10.1625 2.5 6.25 6.4125 6.25 11.25C6.25 13.425 6.875 15.4625 8.0125 17.3C9.2 19.225 10.7625 20.875 11.9625 22.8C12.55 23.7375 12.975 24.6125 13.425 25.625C13.75 26.3125 14.0125 27.5 15 27.5C15.9875 27.5 16.25 26.3125 16.5625 25.625C17.025 24.6125 17.4375 23.7375 18.025 22.8C19.225 20.8875 20.7875 19.2375 21.975 17.3C23.125 15.4625 23.75 13.425 23.75 11.25C23.75 6.4125 19.8375 2.5 15 2.5ZM15 14.6875C13.275 14.6875 11.875 13.2875 11.875 11.5625C11.875 9.8375 13.275 8.4375 15 8.4375C16.725 8.4375 18.125 9.8375 18.125 11.5625C18.125 13.2875 16.725 14.6875 15 14.6875Z" fill="#BFBFBF"/>
4
+ </g>
5
+ <defs>
6
+ <clipPath id="clip0_2900_24288">
7
+ <rect width="30" height="30" fill="white"/>
8
+ </clipPath>
9
+ </defs>
10
+ </svg>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.7.3-rc9",
4
+ "version": "0.7.4",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -59,6 +59,7 @@
59
59
  "license": "MIT",
60
60
  "licenseFilename": "LICENSE",
61
61
  "dependencies": {
62
+ "@ant-design/icons-react-native": "^2.3.2",
62
63
  "@babel/core": "^7.12.9",
63
64
  "@babel/helper-environment-visitor": "^7.16.7",
64
65
  "@babel/plugin-proposal-class-properties": "^7.18.6",
@@ -118,6 +119,7 @@
118
119
  "lodash": "^4.17.19",
119
120
  "lottie-react-native": "^6.7.2",
120
121
  "metro-react-native-babel-preset": "0.73.9",
122
+ "md5": "^2.3.0",
121
123
  "moment": "^2.27.0",
122
124
  "moment-timezone": "^0.5.32",
123
125
  "node-html-parser": "^2.0.2",
@@ -173,7 +175,7 @@
173
175
  "react-native-reanimated": "3.8.1",
174
176
  "react-native-responsive-fontsize": "^0.5.1",
175
177
  "react-native-safe-area-context": "^3.1.1",
176
- "react-native-screens": "^3.32.0",
178
+ "react-native-screens": "3.32.0",
177
179
  "react-native-super-grid": "^4.0.3",
178
180
  "react-native-svg": "^12.1.0",
179
181
  "react-native-svg-transformer": "^0.14.3",
@@ -1,8 +1,8 @@
1
+ import { IconOutline } from '@ant-design/icons-react-native';
1
2
  import { factory } from 'factory-girl';
2
3
  import React from 'react';
3
4
  import { TouchableOpacity } from 'react-native';
4
5
  import Toast from 'react-native-toast-message';
5
- import AntDesign from 'react-native-vector-icons/AntDesign';
6
6
  import { act, create } from 'react-test-renderer';
7
7
  import { Colors } from '../../../configs';
8
8
  import { AccessibilityLabel } from '../../../configs/Constants';
@@ -94,7 +94,7 @@ describe('Test ItemQuickAction', () => {
94
94
  await buttonOnActionPress.props.onPress();
95
95
  });
96
96
 
97
- const icon = instance.findByType(AntDesign);
97
+ const icon = instance.findByType(IconOutline);
98
98
  expect(icon.props.color).toEqual(Colors.TextGray);
99
99
  });
100
100
 
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useEffect, useState } from 'react';
2
2
  import { View, TouchableOpacity, ActivityIndicator } 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
  import Text from '../Text';
@@ -116,7 +116,7 @@ const NumberUpDownActionTemplate = ({
116
116
  onPress={doActionDown}
117
117
  accessibilityLabel={AccessibilityLabel.NUMBER_ACTION_DOWN}
118
118
  >
119
- <AntDesign name="down" size={32} color={Colors.Primary} />
119
+ <IconOutline name="down" size={32} color={Colors.Primary} />
120
120
  </TouchableOpacity>
121
121
 
122
122
  <Text accessibilityLabel={'text_format'} type="H2">
@@ -132,7 +132,7 @@ const NumberUpDownActionTemplate = ({
132
132
  onPress={doActionUp}
133
133
  accessibilityLabel={AccessibilityLabel.NUMBER_ACTION_UP}
134
134
  >
135
- <AntDesign name="up" size={32} color={Colors.Primary} />
135
+ <IconOutline name="up" size={32} color={Colors.Primary} />
136
136
  </TouchableOpacity>
137
137
  </View>
138
138
  </View>
@@ -1,5 +1,5 @@
1
1
  import React, { memo } from 'react';
2
- import AntDesign from 'react-native-vector-icons/AntDesign';
2
+ import { IconOutline } from '@ant-design/icons-react-native';
3
3
  import { Switch, View } from 'react-native';
4
4
  import styles from './ButtonWrapperStyles';
5
5
  import Text from '../../../Text';
@@ -28,7 +28,7 @@ const ButtonWrapper = memo(
28
28
  </View>
29
29
  ) : (
30
30
  <View style={styles.wrapHeadline}>
31
- <AntDesign name={'lock'} size={20} color={Colors.Gray9} />
31
+ <IconOutline name={'lock'} size={20} color={Colors.Gray9} />
32
32
  <Text style={styles.textAutoLock}>
33
33
  {isButtonEnable ? t('auto_lock_enabled') : t('auto_lock_when')}
34
34
  </Text>
@@ -49,7 +49,7 @@ const ButtonWrapper = memo(
49
49
  <Text type="Body" style={styles.textValue}>
50
50
  {t('instant')}
51
51
  </Text>
52
- <AntDesign name="right" size={20} color={Colors.Gray7} />
52
+ <IconOutline name="right" size={20} color={Colors.Gray7} />
53
53
  </View>
54
54
  )}
55
55
  {isButtonReLockTiming && (
@@ -1,6 +1,6 @@
1
1
  import React, { memo, useCallback, useMemo } from 'react';
2
2
  import { TextInput, 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
  import { useNavigation } from '@react-navigation/native';
5
5
 
6
6
  import Text from '../../../Text';
@@ -39,7 +39,7 @@ const PasscodeList = memo(() => {
39
39
  <View style={styles.wrap}>
40
40
  <View style={styles.searchBox}>
41
41
  <View>
42
- <AntDesign name="search" size={24} style={styles.search} />
42
+ <IconOutline name="search" size={24} style={styles.search} />
43
43
  </View>
44
44
  <TextInput
45
45
  placeholder={t('search')}
@@ -58,7 +58,7 @@ const PasscodeList = memo(() => {
58
58
  <Text style={styles.textCode}>{item.code}</Text>
59
59
  <Text style={styles.textName}>{item.name}</Text>
60
60
  </View>
61
- <AntDesign name="right" size={20} color={Colors.Gray8} />
61
+ <IconOutline name="right" size={20} color={Colors.Gray8} />
62
62
  </TouchableOpacity>
63
63
  ))}
64
64
  </View>
@@ -1,5 +1,5 @@
1
1
  import React, { memo } from 'react';
2
- import AntDesign from 'react-native-vector-icons/AntDesign';
2
+ import { IconOutline } from '@ant-design/icons-react-native';
3
3
  import { Text, TouchableOpacity, View } from 'react-native';
4
4
 
5
5
  import { RadioCircle } from '../../..';
@@ -50,7 +50,7 @@ const ButtonWrapper = memo(
50
50
  {isButtonChooseUser && (
51
51
  <TouchableOpacity style={styles.buttonValue}>
52
52
  <Text style={styles.value}>{value}</Text>
53
- <AntDesign name="right" size={20} color={Colors.Gray8} />
53
+ <IconOutline name="right" size={20} color={Colors.Gray8} />
54
54
  </TouchableOpacity>
55
55
  )}
56
56
  {isButtonSetTime && (
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { View, Switch } 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 Text from '../../Text';
6
6
  import styles from './OnOffSimpleTemplateStyle';
@@ -15,7 +15,7 @@ const OnOffSimpleTemplate = ({
15
15
  return (
16
16
  <View style={styles.wrap}>
17
17
  <View style={styles.iconAndText}>
18
- <AntDesign name="poweroff" size={20} style={styles.marginRight} />
18
+ <IconOutline name="poweroff" size={20} style={styles.marginRight} />
19
19
  <Text type="H4">{actionGroup.title}</Text>
20
20
  </View>
21
21
  {isOn !== null && (
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
2
  import { View, TouchableOpacity, ScrollView } 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
  import Text from '../../commons/Text';
@@ -139,7 +139,7 @@ const OptionsDropdownActionTemplate = ({
139
139
  >
140
140
  {displaySelected}
141
141
  </Text>
142
- <AntDesign name="right" size={20} />
142
+ <IconOutline name="right" size={20} />
143
143
  </TouchableOpacity>
144
144
  <AlertAction
145
145
  visible={stateAlert.visible}
@@ -48,18 +48,20 @@ const SliderRangeTemplate = memo(
48
48
  clearTimeout(timeout.current);
49
49
  if (value) {
50
50
  const data = parseInt(value, 10);
51
+ const numericValue = Math.min(max_value, Math.max(min_value, data));
52
+ setValue(numericValue);
51
53
  await doAction(
52
54
  action_data,
53
55
  JSON.stringify({
54
- value_brness: data,
55
- value: data,
56
+ value_brness: numericValue,
57
+ value: numericValue,
56
58
  })
57
59
  );
58
60
  }
59
61
  timeout.current = setTimeout(() => {
60
62
  setProcessing(false);
61
63
  }, 3000);
62
- }, [action_data, doAction, value]);
64
+ }, [action_data, doAction, max_value, min_value, value]);
63
65
 
64
66
  useEffect(() => {
65
67
  if (!processing) {
@@ -72,12 +74,10 @@ const SliderRangeTemplate = memo(
72
74
 
73
75
  const onInputChange = (text) => {
74
76
  if (text === '' || isNaN(text)) {
75
- setValue(min_value);
77
+ setValue(0);
76
78
  return;
77
79
  }
78
-
79
- const numericValue = Number(text);
80
- setValue(Math.min(max_value, Math.max(min_value, numericValue)));
80
+ setValue(Number(text));
81
81
  };
82
82
 
83
83
  return (
@@ -5,7 +5,7 @@ import styles from './SmartTiviActionTemplateStyles';
5
5
  import Text from '../../Text';
6
6
  import { Colors } from '../../../configs';
7
7
  import { SMART_TIVI_BUTTON } from '../../../configs/Constants';
8
- import AntDesign from 'react-native-vector-icons/AntDesign';
8
+ import { IconOutline } from '@ant-design/icons-react-native';
9
9
  import CircleButton from './component/CircleButton';
10
10
  import RectangleButton from './component/RectangleButton';
11
11
  import ControlPlay from './component/ControlPlay';
@@ -97,7 +97,7 @@ const SmartTiviActionTemplate = memo(
97
97
  <CircleButton
98
98
  type="small"
99
99
  icon={
100
- <AntDesign
100
+ <IconOutline
101
101
  name="poweroff"
102
102
  size={20}
103
103
  color={Colors.Gray6}
@@ -3,7 +3,7 @@ import { TouchableOpacity, View, Image } from 'react-native';
3
3
  import styles from './CircleButtonStyles';
4
4
  import Text from '../../../Text';
5
5
  import { Colors, Images } from '../../../../configs';
6
- import AntDesign from 'react-native-vector-icons/AntDesign';
6
+ import { IconOutline } from '@ant-design/icons-react-native';
7
7
  import { AccessibilityLabel } from '../../../../configs/Constants';
8
8
 
9
9
  const CircleButton = memo(
@@ -46,7 +46,7 @@ const CircleButton = memo(
46
46
  AccessibilityLabel.SMART_TIVI_TEMPLATE.UP_BUTTON
47
47
  }
48
48
  >
49
- <AntDesign size={14} name={'caretup'} />
49
+ <IconOutline size={14} name={'caret-up'} />
50
50
  </TouchableOpacity>
51
51
  </View>
52
52
  <View style={styles.bodyMultipleButton}>
@@ -57,7 +57,7 @@ const CircleButton = memo(
57
57
  AccessibilityLabel.SMART_TIVI_TEMPLATE.LEFT_BUTTON
58
58
  }
59
59
  >
60
- <AntDesign size={14} name={'caretleft'} />
60
+ <IconOutline size={14} name={'caret-left'} />
61
61
  </TouchableOpacity>
62
62
  <TouchableOpacity
63
63
  style={[styles.okButton]}
@@ -77,7 +77,7 @@ const CircleButton = memo(
77
77
  AccessibilityLabel.SMART_TIVI_TEMPLATE.RIGHT_BUTTON
78
78
  }
79
79
  >
80
- <AntDesign size={14} name={'caret-right'} />
80
+ <IconOutline size={14} name={'caret-right'} />
81
81
  </TouchableOpacity>
82
82
  </View>
83
83
  <View style={styles.footerMultipleButton}>
@@ -88,7 +88,7 @@ const CircleButton = memo(
88
88
  AccessibilityLabel.SMART_TIVI_TEMPLATE.DOWN_BUTTON
89
89
  }
90
90
  >
91
- <AntDesign size={14} name={'caretdown'} />
91
+ <IconOutline size={14} name={'caret-down'} />
92
92
  </TouchableOpacity>
93
93
  </View>
94
94
  </View>
@@ -6,7 +6,7 @@ import styles from './ControlPlayStyles';
6
6
  import { Pause } from './Icon';
7
7
  import { AccessibilityLabel } from '../../../../configs/Constants';
8
8
 
9
- import AntDesign from 'react-native-vector-icons/AntDesign';
9
+ import { IconOutline } from '@ant-design/icons-react-native';
10
10
 
11
11
  const ControlPlay = memo(
12
12
  ({ onPressPrev, onPressStop, onPressNext, wrapStyle }) => {
@@ -19,9 +19,9 @@ const ControlPlay = memo(
19
19
  AccessibilityLabel.SMART_TIVI_TEMPLATE.PREV_BUTTON
20
20
  }
21
21
  >
22
- <AntDesign
22
+ <IconOutline
23
23
  size={32}
24
- name={'stepbackward'}
24
+ name={'backward'}
25
25
  color={Colors.Gray9}
26
26
  style={[styles.button]}
27
27
  />
@@ -42,9 +42,9 @@ const ControlPlay = memo(
42
42
  AccessibilityLabel.SMART_TIVI_TEMPLATE.NEXT_BUTTON
43
43
  }
44
44
  >
45
- <AntDesign
45
+ <IconOutline
46
46
  size={32}
47
- name={'stepforward'}
47
+ name={'forward'}
48
48
  color={Colors.Gray9}
49
49
  style={[styles.button]}
50
50
  />
@@ -6,7 +6,7 @@ import React, {
6
6
  useState,
7
7
  } from 'react';
8
8
  import { View, TouchableOpacity } from 'react-native';
9
- import AntDesign from 'react-native-vector-icons/AntDesign';
9
+ import { IconOutline } from '@ant-design/icons-react-native';
10
10
  import Text from '../../commons/Text';
11
11
  import { useConfigGlobalState } from '../../iot/states';
12
12
  import styles from './TerminalBoxTemplateStyle';
@@ -174,7 +174,7 @@ const TerminalBoxTemplate = ({ item, doAction, isWidgetOrder }) => {
174
174
  accessibilityLabel={AccessibilityLabel.TERMINAL_BOX_BUTTON_SEND}
175
175
  disabled={!value}
176
176
  >
177
- <AntDesign name="send" size={25} />
177
+ <IconOutline name="send" size={25} />
178
178
  </TouchableOpacity>
179
179
  </View>
180
180
  </View>
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useMemo, useState } 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
  import Text from '../../commons/Text';
5
5
  import { AlertAction } from '../../commons';
6
6
  import { useDropdownAction } from './hooks/useDropdownAction';
@@ -48,7 +48,7 @@ const TextBoxTemplate = ({ item, doAction, isWidgetOrder }) => {
48
48
  onPress={onShowAlert}
49
49
  accessibilityLabel={AccessibilityLabel.TEXT_BOX_BUTTON_EDIT}
50
50
  >
51
- <AntDesign name="edit" size={25} />
51
+ <IconOutline name="edit" size={25} />
52
52
  </TouchableOpacity>
53
53
  </View>
54
54
  <AlertAction
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useMemo, useState } from 'react';
2
2
  import { Switch, 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 DateTimePickerModal from 'react-native-modal-datetime-picker';
5
5
  import moment from 'moment';
6
6
  import { watchMultiConfigs } from '../../iot/Monitor';
@@ -183,7 +183,10 @@ const TimerActionTemplate = ({ item = {}, doAction, sensor = {} }) => {
183
183
  <Text>{title}</Text>
184
184
  {configuration.config_hour && configuration.config_minute && (
185
185
  <View style={styles.wrapTimer}>
186
- <AntDesign style={styles.iconClockCircle} name={'clock-circle'} />
186
+ <IconOutline
187
+ style={styles.iconClockCircle}
188
+ name={'clock-circle'}
189
+ />
187
190
  <Text type="Label" color={Colors.Gray7}>
188
191
  {textTimer ? textTimer : t('set_time')}
189
192
  </Text>
@@ -193,7 +196,7 @@ const TimerActionTemplate = ({ item = {}, doAction, sensor = {} }) => {
193
196
  {configuration.config_hour && !configuration.config_minute && (
194
197
  <View style={styles.timerButton}>
195
198
  <Text style={styles.textTimerEndLine}>{textTimer}</Text>
196
- <AntDesign name="right" size={20} />
199
+ <IconOutline name="right" size={20} />
197
200
  </View>
198
201
  )}
199
202
  </TouchableOpacity>
@@ -1,4 +1,4 @@
1
- import AntDesign from 'react-native-vector-icons/AntDesign';
1
+ import { IconOutline } from '@ant-design/icons-react-native';
2
2
  import React, { memo, useState, useCallback, useEffect } from 'react';
3
3
  import { TouchableOpacity, View } from 'react-native';
4
4
 
@@ -122,7 +122,7 @@ const TwoButtonTemplate = memo(({ item = {}, doAction, sensor = {} }) => {
122
122
  key={index}
123
123
  >
124
124
  <View style={styles.smallCircle}>
125
- <AntDesign
125
+ <IconOutline
126
126
  name={button?.isCheckOnOff ? button?.icon_on : button?.icon_off}
127
127
  size={44}
128
128
  color={button?.isCheckOnOff ? Colors.Green7 : Colors.Gray6}
@@ -413,7 +413,7 @@ describe('Test ActionGroup', () => {
413
413
  config: 5,
414
414
  is_on_value: 0,
415
415
  action: 'action1-47b3-43f6-ba45-83cd1cf5d8f2',
416
- icon: 'upcircle',
416
+ icon: 'up-circle',
417
417
  text: 'Text',
418
418
  action_data: actionData,
419
419
  },
@@ -421,7 +421,7 @@ describe('Test ActionGroup', () => {
421
421
  config: 6,
422
422
  is_on_value: 0,
423
423
  action: 'action2-47b3-43f6-ba45-83cd1cf5d8f2',
424
- icon: 'upcircle',
424
+ icon: 'up-circle',
425
425
  text: 'Text',
426
426
  action_data: actionData,
427
427
  },
@@ -1,4 +1,4 @@
1
- import React, { memo, useMemo } from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import Text from '../Text';
3
3
  import OneBigButtonTemplate from './OneBigButtonTemplate';
4
4
  import ThreeButtonTemplate from './ThreeButtonTemplate';
@@ -74,4 +74,4 @@ const ActionGroup = (params = {}) => {
74
74
  );
75
75
  };
76
76
 
77
- export default memo(ActionGroup);
77
+ export default ActionGroup;
@@ -1,72 +1,40 @@
1
- import React, { useCallback, useMemo } from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import { View, TouchableOpacity } from 'react-native';
3
3
  import Text from '../Text';
4
4
  import { Colors } from '../../configs';
5
5
  import styles from './ItemAutomateStyles';
6
6
  import { AUTOMATES } from '../../configs/Constants';
7
7
  import { useTranslations } from '../../hooks/Common/useTranslations';
8
- import { generateAutomationConditionText } from '../../screens/Automate/ScriptDetail/utils';
9
- import { useGetEvaluateValue } from '../../screens/Device/hooks/useEvaluateValue';
10
8
 
11
9
  const ItemAutomate = ({
12
10
  automate,
13
11
  isSelected = false,
14
- disabledOnPress = false,
15
12
  index,
16
13
  setSelectedIndex,
17
- onPress,
18
- enableScript = true,
19
14
  }) => {
20
15
  const t = useTranslations();
21
- const item = AUTOMATES[automate?.type];
22
- const isItemOneTap = AUTOMATES[automate?.type] === AUTOMATES.one_tap;
23
- const Icon = item?.icon;
24
- const valueEvaluations = useGetEvaluateValue(automate?.config, automate.unit);
25
-
26
- const textCondition = useMemo(() => {
27
- return generateAutomationConditionText(automate, valueEvaluations, t);
28
- }, [automate, t, valueEvaluations]);
29
-
30
- const renderText = useMemo(() => {
31
- if (textCondition) {
32
- return textCondition;
33
- } else if (isSelected && isItemOneTap) {
34
- return t('quick_button_create_at_dashboard');
35
- } else {
36
- return t(item?.explanation);
37
- }
38
- }, [isItemOneTap, isSelected, item?.explanation, t, textCondition]);
16
+ const { type } = automate;
17
+ const item = AUTOMATES[type];
18
+ /* istanbul ignore next */
19
+ const { icon: Icon, title, explanation } = item || {};
39
20
 
40
21
  const handleSelectIndex = useCallback(() => {
41
- if (onPress) {
42
- onPress();
43
- return;
44
- }
45
- if (!setSelectedIndex) {
46
- return;
47
- }
48
-
49
22
  setSelectedIndex(index);
50
- }, [index, setSelectedIndex, onPress]);
23
+ }, [index, setSelectedIndex]);
51
24
 
52
25
  return (
53
26
  <TouchableOpacity
54
27
  onPress={handleSelectIndex}
55
- disabled={disabledOnPress}
56
28
  style={[styles.wrap, isSelected && styles.active]}
57
29
  >
58
30
  <View style={styles.row}>
59
31
  <View style={styles.wrapIcon}>{!!Icon && <Icon />}</View>
60
32
  <View style={styles.wrapTitle}>
61
- <Text
62
- type="H4"
63
- bold
64
- color={enableScript ? Colors.Black : Colors.Gray7}
65
- >
66
- {t(item?.title)}
33
+ <Text type="H4" bold color={Colors.Black}>
34
+ {t(title)}
67
35
  </Text>
68
36
  <Text type="Label" color={Colors.Gray8} numberOfLines={1}>
69
- {renderText}
37
+ {t(explanation)}
70
38
  </Text>
71
39
  </View>
72
40
  </View>
@@ -0,0 +1,109 @@
1
+ import React, { useCallback, useMemo, useRef } from 'react';
2
+ import { View, TouchableOpacity, Platform } from 'react-native';
3
+ import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
4
+ import Text from '../Text';
5
+ import { Colors } from '../../configs';
6
+ import styles from './ItemConditionScriptDetailStyles';
7
+ import { AccessibilityLabel, AUTOMATES } from '../../configs/Constants';
8
+ import { useTranslations } from '../../hooks/Common/useTranslations';
9
+ import { generateAutomationConditionText } from '../../screens/Automate/ScriptDetail/utils';
10
+ import { useGetEvaluateValue } from '../../screens/Device/hooks/useEvaluateValue';
11
+ import MenuActionMore from '../MenuActionMore';
12
+ import { usePopover } from '../../hooks/Common';
13
+ import Routes from '../../utils/Route';
14
+ import { useNavigation } from '@react-navigation/native';
15
+ import { PopoverMode } from 'react-native-popover-view';
16
+
17
+ const ItemConditionScriptDetail = ({
18
+ automate,
19
+ onPress,
20
+ enableScript = true,
21
+ }) => {
22
+ const t = useTranslations();
23
+ const refMenuAction = useRef();
24
+ const { navigate } = useNavigation();
25
+ const { type, config, unit, value_change } = automate;
26
+ const { end_device_id, unit_id } = value_change || {};
27
+ /* istanbul ignore next */
28
+ const item = AUTOMATES[type] || {};
29
+ const { icon: Icon, title } = item;
30
+ const valueEvaluations = useGetEvaluateValue(config, unit);
31
+ const { childRef, showingPopover, showPopoverWithRef, hidePopover } =
32
+ usePopover();
33
+
34
+ const textCondition = useMemo(
35
+ () => generateAutomationConditionText(automate, valueEvaluations, t),
36
+ [automate, valueEvaluations, t]
37
+ );
38
+
39
+ const renderText = useMemo(() => {
40
+ if (textCondition) {
41
+ return textCondition;
42
+ }
43
+ return t('quick_button_create_at_dashboard');
44
+ }, [textCondition, t]);
45
+
46
+ const handleShowMenuAction = useCallback(() => {
47
+ showPopoverWithRef(refMenuAction);
48
+ }, [showPopoverWithRef]);
49
+
50
+ const listMenuItem = useMemo(() => {
51
+ const items = [{ text: t('edit_condition'), doAction: onPress }];
52
+ if (value_change) {
53
+ items.unshift({
54
+ text: t('device_display'),
55
+ doAction: () =>
56
+ navigate(Routes.DeviceDetail, {
57
+ unitId: unit_id,
58
+ sensorId: end_device_id,
59
+ }),
60
+ });
61
+ }
62
+ return items;
63
+ }, [value_change, t, onPress, navigate, unit_id, end_device_id]);
64
+
65
+ return (
66
+ <View style={styles.wrap}>
67
+ <View style={styles.col}>
68
+ <View style={styles.wrapIcon}>{Icon && <Icon />}</View>
69
+ <View style={styles.wrapTitle}>
70
+ <Text
71
+ type="H4"
72
+ bold
73
+ color={enableScript ? Colors.Black : Colors.Gray7}
74
+ >
75
+ {t(title)}
76
+ </Text>
77
+ <Text type="Label" color={Colors.Gray8} numberOfLines={1}>
78
+ {renderText}
79
+ </Text>
80
+ </View>
81
+ </View>
82
+ <View>
83
+ <TouchableOpacity
84
+ onPress={handleShowMenuAction}
85
+ ref={refMenuAction}
86
+ accessibilityLabel={AccessibilityLabel.ICON_MENU_POPUP}
87
+ >
88
+ <MaterialIcons name="more-vert" size={27} color={Colors.Black} />
89
+ </TouchableOpacity>
90
+ </View>
91
+ <MenuActionMore
92
+ isVisible={showingPopover}
93
+ hideMore={hidePopover}
94
+ listMenuItem={listMenuItem}
95
+ childRef={childRef}
96
+ onItemClick={(object) => object.doAction()}
97
+ isTextCenter={false}
98
+ wrapStyle={styles.wrapStyle}
99
+ mode={
100
+ /* istanbul ignore next */
101
+ Platform.OS === 'ios' ? PopoverMode.JS_MODAL : PopoverMode.RN_MODAL
102
+ }
103
+ accessibilityLabel={AccessibilityLabel.MENU_ACTION_LIST_TOUCHABLE}
104
+ />
105
+ </View>
106
+ );
107
+ };
108
+
109
+ export default ItemConditionScriptDetail;