@eohjsc/react-native-smart-city 0.3.31 → 0.3.32

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 (351) hide show
  1. package/package.json +7 -5
  2. package/src/commons/Action/ItemQuickAction.js +2 -3
  3. package/src/commons/Action/__test__/ItemQuickAction.test.js +17 -9
  4. package/src/commons/ActionGroup/CurtainButtonTemplate.js +6 -6
  5. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +4 -4
  6. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +5 -2
  7. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +10 -4
  8. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +4 -4
  9. package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +2 -2
  10. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +1 -1
  11. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +2 -2
  12. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +2 -2
  13. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
  14. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +12 -6
  15. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +8 -4
  16. package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +4 -6
  17. package/src/commons/ActionGroup/OneBigButtonTemplate.js +1 -1
  18. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +10 -4
  19. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +25 -9
  20. package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/ControlPlay.test.js +13 -7
  21. package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/RectangleButton.test.js +9 -5
  22. package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/SmartTiviActionTemplate.test.js +25 -9
  23. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +16 -6
  24. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +10 -4
  25. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/RectangleButton.js +7 -3
  26. package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -2
  27. package/src/commons/ActionGroup/ThreeButtonTemplate.js +5 -5
  28. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +4 -4
  29. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +7 -7
  30. package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +3 -3
  31. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +3 -3
  32. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +9 -5
  33. package/src/commons/ActionGroup/__test__/index.test.js +5 -3
  34. package/src/commons/AlertAction/index.js +2 -2
  35. package/src/commons/Auth/AccountItem.js +9 -3
  36. package/src/commons/Auth/__test__/AccountItem.test.js +6 -3
  37. package/src/commons/Automate/ItemAutomate.js +13 -3
  38. package/src/commons/BackDefault/index.js +2 -2
  39. package/src/commons/BottomButtonView/index.js +4 -5
  40. package/src/commons/Button/index.js +0 -2
  41. package/src/commons/ButtonPopup/index.js +3 -3
  42. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +3 -2
  43. package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +4 -2
  44. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +6 -3
  45. package/src/commons/Dashboard/MyUnit/index.js +5 -3
  46. package/src/commons/Device/ConnectedViewHeader.js +2 -2
  47. package/src/commons/Device/DeviceAlertStatus.js +2 -2
  48. package/src/commons/Device/DisconnectedView.js +2 -2
  49. package/src/commons/Device/Emergency/EmergencyButton.js +2 -2
  50. package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +3 -2
  51. package/src/commons/Device/FlatListItems.js +2 -2
  52. package/src/commons/Device/ItemAddNew/index.js +7 -12
  53. package/src/commons/Device/ItemDevice.js +16 -11
  54. package/src/commons/Device/SensorConnectedStatus.js +5 -2
  55. package/src/commons/Device/WindDirection/Compass/index.js +5 -2
  56. package/src/commons/Device/__test__/DeviceAlertStatus.test.js +8 -4
  57. package/src/commons/Device/__test__/FlatListItems.test.js +3 -2
  58. package/src/commons/Device/__test__/SensorConnectedStatus.test.js +4 -2
  59. package/src/commons/Explore/ActivityIndicator/index.js +5 -2
  60. package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +3 -3
  61. package/src/commons/Explore/SearchBox/index.js +2 -2
  62. package/src/commons/FieldTemplate/ChooseUserField/ChoosePopup.js +4 -4
  63. package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +11 -8
  64. package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
  65. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -2
  66. package/src/commons/FieldTemplate/PasscodeField/index.js +2 -2
  67. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +12 -7
  68. package/src/commons/Form/TextInput.js +2 -2
  69. package/src/commons/Form/TextInputPassword.js +2 -2
  70. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +5 -3
  71. package/src/commons/GroupCheckBox/index.js +2 -2
  72. package/src/commons/HeaderAni/index.js +2 -3
  73. package/src/commons/MediaPlayerDetail/index.js +2 -2
  74. package/src/commons/MenuActionList/index.js +2 -2
  75. package/src/commons/MenuActionMore/index.js +2 -3
  76. package/src/commons/NavBar/index.js +2 -3
  77. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +11 -5
  78. package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +7 -3
  79. package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +4 -2
  80. package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +11 -8
  81. package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +9 -5
  82. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +5 -3
  83. package/src/commons/Popover/index.js +2 -13
  84. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +5 -3
  85. package/src/commons/PreventAccess/index.js +3 -3
  86. package/src/commons/{Connecting → Processing}/__test__/Connecting.test.js +5 -4
  87. package/src/commons/Processing/index.js +93 -0
  88. package/src/commons/{Connecting → Processing}/styles.js +9 -1
  89. package/src/commons/SelectGateway/index.js +105 -0
  90. package/src/commons/SelectGateway/styles.js +55 -0
  91. package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +106 -0
  92. package/src/commons/SelectSubUnit/index.js +124 -0
  93. package/src/commons/SelectSubUnit/styles.js +55 -0
  94. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +120 -0
  95. package/src/commons/SelectUnit/index.js +106 -0
  96. package/src/commons/SelectUnit/styles.js +54 -0
  97. package/src/commons/Sharing/WrapHeaderScrollable.js +2 -2
  98. package/src/commons/SubUnit/OneTap/ItemOneTap.js +4 -4
  99. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +25 -10
  100. package/src/commons/SubUnit/OneTap/index.js +9 -4
  101. package/src/commons/SubUnit/ShortDetail.js +11 -29
  102. package/src/commons/SubUnit/__test__/ShortDetail.test.js +15 -10
  103. package/src/commons/SummaryItem/index.js +2 -2
  104. package/src/commons/Unit/HeaderUnit/index.js +4 -5
  105. package/src/commons/Unit/SharedUnit.js +10 -8
  106. package/src/commons/Unit/__test__/HeaderUnit.test.js +13 -5
  107. package/src/commons/Unit/__test__/SharedUnit.test.js +30 -11
  108. package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +13 -8
  109. package/src/commons/UnitSummary/AirQuality/index.js +7 -3
  110. package/src/commons/UnitSummary/TotalPowerBox.js +2 -2
  111. package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -2
  112. package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +3 -2
  113. package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +4 -2
  114. package/src/commons/ViewButtonBottom/index.js +4 -4
  115. package/src/commons/WheelDateTimePicker/index.js +5 -3
  116. package/src/commons/WrapParallaxScrollView/index.js +2 -1
  117. package/src/configs/API.js +6 -14
  118. package/src/configs/AccessibilityLabel.js +608 -0
  119. package/src/configs/Constants.js +1 -604
  120. package/src/context/actionType.ts +7 -3
  121. package/src/context/mockStore.ts +6 -3
  122. package/src/context/reducer.ts +23 -8
  123. package/src/hoc/withRemoteControl.js +1 -0
  124. package/src/hooks/Common/index.js +2 -2
  125. package/src/hooks/Common/{useGGHomeDeviceConnected.js → useHomeAssistantDeviceConnected.js} +3 -3
  126. package/src/hooks/Common/usePopover.js +6 -1
  127. package/src/hooks/IoT/__test__/{useGGHomeConnection.test.js → useHomeAssistantConnection.test.js} +18 -18
  128. package/src/hooks/IoT/__test__/useRemoteControl.test.js +17 -12
  129. package/src/hooks/IoT/index.js +2 -2
  130. package/src/hooks/IoT/useHomeAssistantConnection.js +91 -0
  131. package/src/hooks/IoT/useRemoteControl.js +6 -6
  132. package/src/iot/RemoteControl/{GoogleHome.js → HomeAssistant.js} +21 -17
  133. package/src/iot/RemoteControl/LG.js +2 -1
  134. package/src/iot/RemoteControl/__test__/{GoogleHome.test.js → HomeAssistant.test.js} +30 -30
  135. package/src/navigations/AddDeviceStack.js +0 -14
  136. package/src/navigations/AddGatewayStack.js +51 -21
  137. package/src/navigations/Main.js +2 -2
  138. package/src/navigations/SmartIrStack.js +3 -3
  139. package/src/navigations/UnitStack.js +1 -1
  140. package/src/screens/AQIGuide/__test__/AQIGuide.test.js +5 -3
  141. package/src/screens/AQIGuide/index.js +5 -3
  142. package/src/screens/ActivityLog/FilterPopup.js +2 -2
  143. package/src/screens/ActivityLog/__test__/FilterPopup.test.js +2 -2
  144. package/src/screens/ActivityLog/__test__/index.test.js +3 -2
  145. package/src/screens/ActivityLog/index.js +3 -3
  146. package/src/screens/AddCommon/SelectSubUnit.js +44 -191
  147. package/src/screens/AddCommon/SelectUnit.js +51 -204
  148. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +7 -50
  149. package/src/screens/AddCommon/__test__/SelectUnit.test.js +28 -26
  150. package/src/screens/AddLocationMaps/__test__/index.test.js +13 -7
  151. package/src/screens/AddLocationMaps/index.js +3 -3
  152. package/src/screens/AddNewAction/Device/index.js +2 -2
  153. package/src/screens/AddNewAction/SelectAction.js +6 -6
  154. package/src/screens/AddNewAction/SelectSensorDevices.js +3 -3
  155. package/src/screens/AddNewAction/__test__/SelectAction.test.js +2 -2
  156. package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +8 -3
  157. package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +11 -7
  158. package/src/screens/AddNewAutoSmart/index.js +9 -12
  159. package/src/screens/AddNewDevice/ConnectingDevices.js +1 -1
  160. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +7 -4
  161. package/src/screens/AddNewDevice/index.js +4 -4
  162. package/src/screens/AddNewGateway/ConnectingDevice.js +40 -0
  163. package/src/screens/AddNewGateway/ConnectingModbusDevice.js +61 -0
  164. package/src/screens/AddNewGateway/ConnectingWifiDevice.js +70 -0
  165. package/src/screens/AddNewGateway/ConnectingZigbeeDevice.js +60 -0
  166. package/src/screens/AddNewGateway/PlugAndPlay/FirstWarning.js +21 -8
  167. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +23 -4
  168. package/src/screens/AddNewGateway/RenameNewDevices.js +141 -0
  169. package/src/screens/AddNewGateway/RenameNewDevicesStyles.js +75 -0
  170. package/src/screens/AddNewGateway/ScanGatewayQR.js +57 -0
  171. package/src/screens/AddNewGateway/ScanModbusQR.js +53 -0
  172. package/src/screens/AddNewGateway/ScanWifiDeviceQR.js +55 -0
  173. package/src/screens/AddNewGateway/SelectDeviceSubUnit.js +31 -0
  174. package/src/screens/AddNewGateway/SelectDeviceType.js +52 -0
  175. package/src/screens/AddNewGateway/SelectDeviceUnit.js +29 -0
  176. package/src/screens/AddNewGateway/SelectModbusGateway.js +34 -0
  177. package/src/screens/AddNewGateway/SelectZigbeeGateway.js +34 -0
  178. package/src/screens/AddNewGateway/ShareWifiPassword.js +302 -0
  179. package/src/screens/AddNewGateway/ShareWifiPasswordStyles.js +44 -0
  180. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -4
  181. package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +63 -0
  182. package/src/screens/AddNewGateway/__test__/{SelectGateway.test.js → ConnectingWifiDevice.test.js} +15 -10
  183. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +62 -0
  184. package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +191 -0
  185. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +73 -0
  186. package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +75 -0
  187. package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +73 -0
  188. package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +47 -0
  189. package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +89 -0
  190. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +48 -0
  191. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +77 -0
  192. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +77 -0
  193. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +294 -0
  194. package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +1 -1
  195. package/src/screens/AddNewGateway/index.js +4 -4
  196. package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +5 -4
  197. package/src/screens/AddNewOneTap/index.js +4 -4
  198. package/src/screens/Automate/__test__/index.test.js +2 -2
  199. package/src/screens/Automate/index.js +6 -2
  200. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +3 -2
  201. package/src/screens/ConfirmUnitDeletion/index.js +3 -3
  202. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +5 -5
  203. package/src/screens/Device/EditDevice/index.js +3 -3
  204. package/src/screens/Device/__test__/detail.test.js +38 -22
  205. package/src/screens/Device/components/SensorConnectStatusViewHeader.js +6 -6
  206. package/src/screens/Device/components/SensorDisplayItem.js +2 -2
  207. package/src/screens/Device/detail.js +28 -22
  208. package/src/screens/Device/hooks/useEvaluateValue.js +0 -2
  209. package/src/screens/DeviceInfo/__test__/index.test.js +8 -4
  210. package/src/screens/DeviceInfo/index.js +10 -6
  211. package/src/screens/Drawer/index.js +21 -9
  212. package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +8 -4
  213. package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -1
  214. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +5 -3
  215. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +9 -5
  216. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +7 -3
  217. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -3
  218. package/src/screens/EmergencySetting/__test__/DropDownItem.test.js +3 -2
  219. package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
  220. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +6 -3
  221. package/src/screens/EnterPassword/index.js +5 -3
  222. package/src/screens/GuestInfo/__test__/index.test.js +18 -12
  223. package/src/screens/GuestInfo/components/AccessScheduleItem.js +2 -2
  224. package/src/screens/GuestInfo/components/AccessScheduleSheet.js +3 -3
  225. package/src/screens/GuestInfo/components/HeaderGuestInfo.js +2 -2
  226. package/src/screens/GuestInfo/components/RecurringDetail.js +4 -4
  227. package/src/screens/GuestInfo/components/TemporaryDetail.js +3 -3
  228. package/src/screens/GuestInfo/index.js +1 -1
  229. package/src/screens/HanetCamera/Detail.js +10 -4
  230. package/src/screens/HanetCamera/ManageAccess.js +4 -4
  231. package/src/screens/HanetCamera/MemberInfo.js +1 -1
  232. package/src/screens/HanetCamera/__test__/Detail.test.js +5 -3
  233. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +10 -4
  234. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +4 -2
  235. package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
  236. package/src/screens/ManageAccess/index.js +1 -1
  237. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +4 -4
  238. package/src/screens/MoveToAnotherSubUnit/index.js +2 -2
  239. package/src/screens/PlayBackCamera/__test__/index.test.js +9 -6
  240. package/src/screens/PlayBackCamera/index.js +6 -6
  241. package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
  242. package/src/screens/ScanChipQR/components/QRScan/index.js +10 -3
  243. package/src/screens/ScriptDetail/__test__/index.test.js +8 -4
  244. package/src/screens/ScriptDetail/index.js +7 -6
  245. package/src/screens/SelectUnit/__test__/index.test.js +4 -3
  246. package/src/screens/SelectUnit/index.js +3 -3
  247. package/src/screens/SetSchedule/index.js +1 -1
  248. package/src/screens/Sharing/Components/SensorItem.js +2 -2
  249. package/src/screens/Sharing/Components/__test__/SensorItem.test.js +4 -2
  250. package/src/screens/Sharing/InfoMemberUnit.js +7 -6
  251. package/src/screens/Sharing/MemberList.js +4 -4
  252. package/src/screens/Sharing/SelectPermission.js +9 -4
  253. package/src/screens/Sharing/SelectUser.js +9 -5
  254. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +3 -2
  255. package/src/screens/Sharing/__test__/SelectUser.test.js +7 -4
  256. package/src/screens/SideMenuDetail/__test__/index.test.js +11 -7
  257. package/src/screens/SideMenuDetail/index.js +2 -2
  258. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +4 -2
  259. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +5 -5
  260. package/src/screens/SmartIr/__test__/SmartIr.test.js +14 -6
  261. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +4 -2
  262. package/src/screens/SmartIr/components/{SelectDeviceType.js → SelectIrDeviceType.js} +2 -2
  263. package/src/screens/SmartIr/index.js +1 -1
  264. package/src/screens/SubUnit/AddSubUnit.js +7 -3
  265. package/src/screens/SubUnit/Detail.js +6 -6
  266. package/src/screens/SubUnit/EditSubUnit.js +10 -6
  267. package/src/screens/SubUnit/ManageSubUnit.js +2 -2
  268. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +6 -3
  269. package/src/screens/SubUnit/__test__/Detail.test.js +5 -3
  270. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +9 -5
  271. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +3 -2
  272. package/src/screens/SyncLGDevice/AddLGDevice.js +4 -4
  273. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -4
  274. package/src/screens/TDSGuide/__test__/TDSGuide.test.js +4 -2
  275. package/src/screens/TDSGuide/index.js +2 -2
  276. package/src/screens/Template/EditTemplate.js +2 -1
  277. package/src/screens/Template/__test__/detail.test.js +9 -1
  278. package/src/screens/Template/index.js +0 -1
  279. package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +3 -2
  280. package/src/screens/UVIndexGuide/index.js +2 -2
  281. package/src/screens/Unit/AddMenu.js +6 -20
  282. package/src/screens/Unit/ChooseLocation.js +1 -1
  283. package/src/screens/Unit/Detail.js +10 -10
  284. package/src/screens/Unit/ManageUnit.js +21 -15
  285. package/src/screens/Unit/MyAllUnit/index.js +1 -1
  286. package/src/screens/Unit/SelectAddToFavorites.js +7 -8
  287. package/src/screens/Unit/SelectAddress.js +4 -4
  288. package/src/screens/Unit/SmartAccountItem.js +3 -3
  289. package/src/screens/Unit/Station/__test__/index.test.js +1 -1
  290. package/src/screens/Unit/Station/index.js +2 -2
  291. package/src/screens/Unit/Summaries.js +2 -2
  292. package/src/screens/Unit/__test__/CheckSendEmail.test.js +6 -6
  293. package/src/screens/Unit/__test__/Detail.test.js +17 -12
  294. package/src/screens/Unit/__test__/ManageUnit.test.js +40 -18
  295. package/src/screens/Unit/__test__/SelectAddress.test.js +15 -8
  296. package/src/screens/Unit/__test__/SmartAccountItem.test.js +4 -3
  297. package/src/screens/Unit/components/AutomateScript/index.js +5 -2
  298. package/src/screens/Unit/components/ListMyAllUnit/index.js +1 -1
  299. package/src/screens/Unit/components/MyAllUnit/__test__/Header.test.js +9 -5
  300. package/src/screens/Unit/components/MyAllUnit/index.js +1 -1
  301. package/src/screens/Unit/components/MyUnitDevice/index.js +8 -5
  302. package/src/screens/Unit/components/SharedUnit/index.js +12 -6
  303. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
  304. package/src/screens/Unit/components/__test__/SharedUnit.test.js +24 -9
  305. package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +25 -11
  306. package/src/screens/UnitSummary/__test__/index.test.js +4 -2
  307. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +4 -2
  308. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -2
  309. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +4 -2
  310. package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -2
  311. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +5 -4
  312. package/src/screens/UnitSummary/components/RunningDevices/index.js +6 -3
  313. package/src/screens/UnitSummary/components/TotalPowerBox/index.js +2 -2
  314. package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -2
  315. package/src/screens/UnitSummary/components/__test__/TotalPowerBox.test.js +3 -2
  316. package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +4 -2
  317. package/src/screens/UnitSummary/index.js +10 -8
  318. package/src/screens/WaterQualityGuide/__test__/index.test.js +17 -12
  319. package/src/screens/WaterQualityGuide/index.js +26 -10
  320. package/src/utils/Apis/axios.js +1 -0
  321. package/src/utils/I18n/translations/en.json +9 -9
  322. package/src/utils/I18n/translations/vi.json +8 -8
  323. package/src/utils/Route/index.js +16 -10
  324. package/src/commons/Connecting/index.js +0 -67
  325. package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +0 -28
  326. package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +0 -41
  327. package/src/commons/ConnectingProcess/__test__/Connecting.test.js +0 -163
  328. package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +0 -19
  329. package/src/commons/ConnectingProcess/index.js +0 -213
  330. package/src/commons/ConnectingProcess/styles.js +0 -69
  331. package/src/hooks/IoT/useGGHomeConnection.js +0 -91
  332. package/src/iot/RemoteControl/index.js +0 -55
  333. package/src/screens/AddNewDevice/ConnectDevices.js +0 -184
  334. package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +0 -131
  335. package/src/screens/AddNewGateway/ConnectedGateway.js +0 -139
  336. package/src/screens/AddNewGateway/ConnectingGateway.js +0 -137
  337. package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +0 -214
  338. package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +0 -319
  339. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +0 -75
  340. package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +0 -130
  341. package/src/screens/AddNewGateway/SelectGateway.js +0 -133
  342. package/src/screens/AddNewGateway/SetupGatewayWifi.js +0 -207
  343. package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +0 -71
  344. package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +0 -96
  345. package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +0 -120
  346. package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +0 -115
  347. package/src/screens/ScanChipQR/hooks/index.js +0 -120
  348. package/src/screens/ScanChipQR/index.js +0 -29
  349. package/src/screens/ScanSensorQR/__test__/ScanSensorQR.test.js +0 -111
  350. package/src/screens/ScanSensorQR/hooks/index.js +0 -40
  351. package/src/screens/ScanSensorQR/index.js +0 -39
@@ -5,7 +5,7 @@ import MockAdapter from 'axios-mock-adapter';
5
5
 
6
6
  import AddCommonSelectUnit from '../SelectUnit';
7
7
  import Text from '../../../commons/Text';
8
- import { TESTID } from '../../../configs/Constants';
8
+ import { AccessibilityLabel } from '../../../configs/Constants';
9
9
  import { SCProvider } from '../../../context';
10
10
  import { mockSCStore } from '../../../context/mockStore';
11
11
  import api from '../../../utils/Apis/axios';
@@ -37,14 +37,7 @@ describe('Test SelectUnit container', () => {
37
37
  mockedGoBack.mockClear();
38
38
  });
39
39
  let tree;
40
- const list_type = [
41
- 'AddSubUnit',
42
- 'AddDevice',
43
- 'AddMember',
44
- 'AddLGDevice',
45
- '',
46
- 'AddDeviceNewFlow',
47
- ];
40
+ const list_type = ['AddSubUnit', 'AddDevice', 'AddMember', 'AddLGDevice', ''];
48
41
  const result = [
49
42
  'Add new sub-unit',
50
43
  'Add new device',
@@ -95,7 +88,10 @@ describe('Test SelectUnit container', () => {
95
88
 
96
89
  const instance = tree.root;
97
90
  const selectUnit = instance.findAll(
98
- (item) => item.props.testID === TESTID.SELECT_UNIT_SELECT
91
+ (item) =>
92
+ item.props.accessibilityLabel?.indexOf(
93
+ AccessibilityLabel.SELECT_UNIT_SELECT
94
+ ) === 0
99
95
  );
100
96
  await act(async () => {
101
97
  selectUnit[0].props.onPress();
@@ -103,8 +99,8 @@ describe('Test SelectUnit container', () => {
103
99
 
104
100
  const next = instance.find(
105
101
  (item) =>
106
- item.props.testID ===
107
- `${TESTID.PREFIX.SELECT_UNIT}${TESTID.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
102
+ item.props.accessibilityLabel ===
103
+ `${AccessibilityLabel.PREFIX.SELECT_UNIT}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
108
104
  );
109
105
 
110
106
  await act(async () => {
@@ -132,13 +128,6 @@ describe('Test SelectUnit container', () => {
132
128
  unit_id: 1,
133
129
  });
134
130
  break;
135
- case 'AddDeviceNewFlow':
136
- expect(mockedNavigate).toBeCalledWith('AddGatewaySelectGateway', {
137
- unit_id: 1,
138
- addType: 'AddDeviceNewFlow',
139
- scan_sensor_data: undefined,
140
- });
141
- break;
142
131
  default:
143
132
  break;
144
133
  }
@@ -167,17 +156,25 @@ describe('test single SelectUnit', () => {
167
156
  const instance = tree.root;
168
157
  const unitName = instance.findAll(
169
158
  (item) =>
170
- item.props.testID === TESTID.SELECT_UNIT_NAME && item.type === Text
159
+ item.props.accessibilityLabel?.indexOf(
160
+ AccessibilityLabel.SELECT_UNIT_NAME
161
+ ) === 0 && item.type === Text
171
162
  );
172
163
  const radioButton = instance.findAll(
173
- (item) => item.props.testID === TESTID.SELECT_UNIT_RADIO_BUTTON
164
+ (item) =>
165
+ item.props.accessibilityLabel?.indexOf(
166
+ AccessibilityLabel.SELECT_UNIT_RADIO_BUTTON
167
+ ) === 0
174
168
  );
175
169
  expect(unitName[0].props.children).toBe('Unit 1');
176
170
  expect(unitName[1].props.children).toBe('Unit 2');
177
171
  expect(radioButton[0].props.active).toBeFalsy();
178
172
  expect(radioButton[1].props.active).toBeFalsy();
179
173
  const selectUnit = instance.findAll(
180
- (item) => item.props.testID === TESTID.SELECT_UNIT_SELECT
174
+ (item) =>
175
+ item.props.accessibilityLabel?.indexOf(
176
+ AccessibilityLabel.SELECT_UNIT_SELECT
177
+ ) === 0
181
178
  );
182
179
  await act(async () => {
183
180
  selectUnit[0].props.onPress();
@@ -196,10 +193,15 @@ describe('test single SelectUnit', () => {
196
193
  const instance = tree.root;
197
194
  const unitName = instance.findAll(
198
195
  (item) =>
199
- item.props.testID === TESTID.SELECT_UNIT_NAME && item.type === Text
196
+ item.props.accessibilityLabel?.indexOf(
197
+ AccessibilityLabel.SELECT_UNIT_NAME
198
+ ) === 0 && item.type === Text
200
199
  );
201
200
  const radioButton = instance.findAll(
202
- (item) => item.props.testID === TESTID.SELECT_UNIT_RADIO_BUTTON
201
+ (item) =>
202
+ item.props.accessibilityLabel?.indexOf(
203
+ AccessibilityLabel.SELECT_UNIT_RADIO_BUTTON
204
+ ) === 0
203
205
  );
204
206
  expect(unitName).toHaveLength(2);
205
207
  expect(radioButton).toHaveLength(2);
@@ -214,8 +216,8 @@ describe('test single SelectUnit', () => {
214
216
  const instance = tree.root;
215
217
  const goBack = instance.find(
216
218
  (item) =>
217
- item.props.testID ===
218
- `${TESTID.PREFIX.SELECT_UNIT}${TESTID.VIEW_BUTTON_BOTTOM_LEFT_BUTTON}`
219
+ item.props.accessibilityLabel ===
220
+ `${AccessibilityLabel.PREFIX.SELECT_UNIT}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_LEFT_BUTTON}`
219
221
  );
220
222
 
221
223
  await act(async () => {
@@ -9,7 +9,7 @@ import { SCProvider } from '../../../context';
9
9
  import { mockSCStore } from '../../../context/mockStore';
10
10
  import AddLocationMaps from '../index';
11
11
  import { API } from '../../../configs';
12
- import { TESTID } from '../../../configs/Constants';
12
+ import { AccessibilityLabel } from '../../../configs/Constants';
13
13
  import api from '../../../utils/Apis/axios';
14
14
  import {
15
15
  GEOLOCATION_ERROR,
@@ -108,7 +108,8 @@ describe('Test SelectAddress', () => {
108
108
  });
109
109
  const instance = tree.root;
110
110
  const button = instance.find(
111
- (el) => el.props.testID === TESTID.BUTTON_YOUR_LOCATION
111
+ (el) =>
112
+ el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
112
113
  );
113
114
 
114
115
  const response = {
@@ -141,7 +142,8 @@ describe('Test SelectAddress', () => {
141
142
  });
142
143
  const instance = tree.root;
143
144
  const button = instance.find(
144
- (el) => el.props.testID === TESTID.BUTTON_YOUR_LOCATION
145
+ (el) =>
146
+ el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
145
147
  );
146
148
 
147
149
  global.navigator.geolocation = {
@@ -165,7 +167,8 @@ describe('Test SelectAddress', () => {
165
167
  });
166
168
  const instance = tree.root;
167
169
  const button = instance.find(
168
- (el) => el.props.testID === TESTID.BUTTON_YOUR_LOCATION
170
+ (el) =>
171
+ el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
169
172
  );
170
173
 
171
174
  global.navigator.geolocation = {
@@ -210,7 +213,8 @@ describe('Test SelectAddress', () => {
210
213
  });
211
214
  const instance = tree.root;
212
215
  const button = instance.find(
213
- (el) => el.props.testID === TESTID.BUTTON_YOUR_LOCATION
216
+ (el) =>
217
+ el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
214
218
  );
215
219
 
216
220
  global.navigator.geolocation = {
@@ -231,7 +235,8 @@ describe('Test SelectAddress', () => {
231
235
  });
232
236
  const instance = tree.root;
233
237
  const button = instance.find(
234
- (el) => el.props.testID === TESTID.BUTTON_YOUR_LOCATION
238
+ (el) =>
239
+ el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
235
240
  );
236
241
 
237
242
  global.navigator.geolocation = {
@@ -255,7 +260,8 @@ describe('Test SelectAddress', () => {
255
260
  });
256
261
  const instance = tree.root;
257
262
  const button = instance.find(
258
- (el) => el.props.testID === TESTID.BUTTON_CHOOSE_ON_MAP
263
+ (el) =>
264
+ el.props.accessibilityLabel === AccessibilityLabel.BUTTON_CHOOSE_ON_MAP
259
265
  );
260
266
  await act(async () => {
261
267
  await button.props.onPress();
@@ -13,7 +13,7 @@ import RowLocation from '../../commons/SearchLocation/RowLocation';
13
13
  import { axiosGet } from '../../utils/Apis/axios';
14
14
  import { API, Colors, SCConfig } from '../../configs';
15
15
  import {
16
- TESTID,
16
+ AccessibilityLabel,
17
17
  MAP_INITIAL_REGION,
18
18
  EOH_LOCATION,
19
19
  } from '../../configs/Constants';
@@ -203,7 +203,7 @@ const AddLocationMaps = memo(() => {
203
203
  <TouchableOpacity
204
204
  onPress={getCurrentPosition}
205
205
  style={styles.button}
206
- testID={TESTID.BUTTON_YOUR_LOCATION}
206
+ accessibilityLabel={AccessibilityLabel.BUTTON_YOUR_LOCATION}
207
207
  >
208
208
  <IconOutline name="aim" size={27} color={Colors.Primary} />
209
209
  <Text
@@ -219,7 +219,7 @@ const AddLocationMaps = memo(() => {
219
219
  <TouchableOpacity
220
220
  onPress={chooseOnMap}
221
221
  style={styles.button}
222
- testID={TESTID.BUTTON_CHOOSE_ON_MAP}
222
+ accessibilityLabel={AccessibilityLabel.BUTTON_CHOOSE_ON_MAP}
223
223
  >
224
224
  <IconFill
225
225
  name="environment"
@@ -3,7 +3,7 @@ import { TouchableWithoutFeedback, View } from 'react-native';
3
3
  import { Colors } from '../../../configs';
4
4
  import Text from '../../../commons/Text';
5
5
  import IconComponent from '../../../commons/IconComponent';
6
- import { TESTID } from '../../../configs/Constants';
6
+ import { AccessibilityLabel } from '../../../configs/Constants';
7
7
  import styles from './DeviceStyles';
8
8
 
9
9
  const Device = memo(({ svgMain, sensor, title, isSelectDevice, onPress }) => {
@@ -16,7 +16,7 @@ const Device = memo(({ svgMain, sensor, title, isSelectDevice, onPress }) => {
16
16
  return (
17
17
  <TouchableWithoutFeedback
18
18
  onPress={onPressDevice}
19
- accessibilityLabel={`${TESTID.TOUCHABLE_ACTION_ADD_ITEM_FAVORITE}-${sensor.id}`}
19
+ accessibilityLabel={`${AccessibilityLabel.TOUCHABLE_ACTION_ADD_ITEM_FAVORITE}-${sensor.id}`}
20
20
  >
21
21
  <View style={[styles.container, isActive]}>
22
22
  <View style={styles.boxIcon}>
@@ -15,7 +15,7 @@ import { API, Images } from '../../configs';
15
15
  import {
16
16
  CONDITION_TYPES,
17
17
  STATE_VALUE_SENSOR_TYPES,
18
- TESTID,
18
+ AccessibilityLabel,
19
19
  } from '../../configs/Constants';
20
20
  import Routes from '../../utils/Route';
21
21
  import styles from './Styles/SelectActionStyles';
@@ -42,7 +42,7 @@ const SelectAction = memo(({ route }) => {
42
42
  isCreateNewAction,
43
43
  isMultiUnits,
44
44
  oldType,
45
- } = route.params;
45
+ } = route?.params || {};
46
46
  const [data, setData] = useState([]);
47
47
  const [actions, setActions] = useState([]);
48
48
  const [sensorData, setSensorData] = useState([]);
@@ -319,9 +319,9 @@ const SelectAction = memo(({ route }) => {
319
319
  const isNumberValue = !stateConditionData;
320
320
 
321
321
  if (isNumberValue) {
322
- return `${item?.name} ${
323
- item?.title ? item.title : t('is_below') + ' (<)'
324
- } ${item?.value} ${item?.unit}`;
322
+ return `${item?.name} ${item.title || t('is_below') + ' (<)'} ${
323
+ item?.value
324
+ } ${item?.unit || ''}`;
325
325
  }
326
326
  return t(stateConditionData?.stateValue[item?.value]);
327
327
  },
@@ -411,7 +411,7 @@ const SelectAction = memo(({ route }) => {
411
411
  <RenderActionItem
412
412
  data={data}
413
413
  onSelectAction={handleOnSelectAction}
414
- testID={TESTID.ACTION_ITEM}
414
+ accessibilityLabel={AccessibilityLabel.ACTION_ITEM}
415
415
  />
416
416
  )}
417
417
  {data?.length === 0 && sensorData?.length === 0 && !isfetched && (
@@ -12,7 +12,7 @@ import BottomButtonView from '../../commons/BottomButtonView';
12
12
  import { HeaderCustom } from '../../commons/Header';
13
13
  import Routes from '../../utils/Route';
14
14
  import styles from './Styles/SelectSensorDevicesStyles';
15
- import { AUTOMATE_SELECT, TESTID } from '../../configs/Constants';
15
+ import { AUTOMATE_SELECT, AccessibilityLabel } from '../../configs/Constants';
16
16
  import { popAction } from '../../navigations/utils';
17
17
  import { Icon } from '@ant-design/react-native';
18
18
 
@@ -29,7 +29,7 @@ const SelectSensorDevices = memo(({ route }) => {
29
29
  isCreateNewAction,
30
30
  isMultiUnits,
31
31
  oldType,
32
- } = route.params;
32
+ } = route?.params || {};
33
33
 
34
34
  const [listStation, setListStation] = useState([]);
35
35
  const [listMenuItem, setListMenuItem] = useState([]);
@@ -159,7 +159,7 @@ const SelectSensorDevices = memo(({ route }) => {
159
159
  <TouchableOpacity
160
160
  style={styles.buttonClose}
161
161
  onPress={onPressClose}
162
- testID={TESTID.ICON_CLOSE}
162
+ accessibilityLabel={AccessibilityLabel.ICON_CLOSE}
163
163
  >
164
164
  <Icon name={'close'} size={24} color={Colors.Black} />
165
165
  </TouchableOpacity>
@@ -6,7 +6,7 @@ import SelectAction from '../SelectAction';
6
6
  import { SCProvider } from '../../../context';
7
7
  import { mockSCStore } from '../../../context/mockStore';
8
8
  import BottomButtonView from '../../../commons/BottomButtonView';
9
- import { TESTID } from '../../../configs/Constants';
9
+ import { AccessibilityLabel } from '../../../configs/Constants';
10
10
  import api from '../../../utils/Apis/axios';
11
11
  import { API } from '../../../configs';
12
12
 
@@ -172,7 +172,7 @@ describe('Test SelectAction', () => {
172
172
  });
173
173
  const instance = tree.root;
174
174
  const renderActionItem = instance.find(
175
- (el) => el.props.testID === TESTID.ACTION_ITEM
175
+ (el) => el.props.accessibilityLabel === AccessibilityLabel.ACTION_ITEM
176
176
  );
177
177
  expect(renderActionItem.props.data.length).toBe(4);
178
178
  });
@@ -9,7 +9,10 @@ import Device from '../Device';
9
9
  import BottomButtonView from '../../../commons/BottomButtonView';
10
10
  import NavBar from '../../../commons/NavBar';
11
11
  import API from '../../../configs/API';
12
- import { AUTOMATE_SELECT, TESTID } from '../../../configs/Constants';
12
+ import {
13
+ AUTOMATE_SELECT,
14
+ AccessibilityLabel,
15
+ } from '../../../configs/Constants';
13
16
  import { TouchableOpacity } from 'react-native';
14
17
  import Routes from '../../../utils/Route';
15
18
  import api from '../../../utils/Apis/axios';
@@ -137,7 +140,8 @@ describe('Test SelectSensorDevices', () => {
137
140
  const instance = tree.root;
138
141
  const iconClose = instance.findAll(
139
142
  (el) =>
140
- el.props.testID === TESTID.ICON_CLOSE && el.type === TouchableOpacity
143
+ el.props.accessibilityLabel === AccessibilityLabel.ICON_CLOSE &&
144
+ el.type === TouchableOpacity
141
145
  );
142
146
  expect(iconClose).toHaveLength(1);
143
147
 
@@ -172,7 +176,8 @@ describe('Test SelectSensorDevices', () => {
172
176
  const instance = tree.root;
173
177
  const iconClose = instance.findAll(
174
178
  (el) =>
175
- el.props.testID === TESTID.ICON_CLOSE && el.type === TouchableOpacity
179
+ el.props.accessibilityLabel === AccessibilityLabel.ICON_CLOSE &&
180
+ el.type === TouchableOpacity
176
181
  );
177
182
  expect(iconClose).toHaveLength(1);
178
183
  await act(async () => {
@@ -3,9 +3,10 @@ import { act, create } from 'react-test-renderer';
3
3
  import AddNewAutoSmart from '..';
4
4
  import { SCProvider } from '../../../context';
5
5
  import { mockSCStore } from '../../../context/mockStore';
6
- import { AUTOMATE_TYPE, TESTID } from '../../../configs/Constants';
6
+ import { AUTOMATE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
7
7
  import ItemAutomate from '../../../commons/Automate/ItemAutomate';
8
8
  import Routes from '../../../utils/Route';
9
+ import { TouchableOpacity } from 'react-native';
9
10
 
10
11
  const wrapComponent = (route) => (
11
12
  <SCProvider initState={mockSCStore({})}>
@@ -51,16 +52,19 @@ describe('test AddNewAutoSmart', () => {
51
52
  const items = instance.findAllByType(ItemAutomate);
52
53
  expect(items).toHaveLength(3);
53
54
 
55
+ const touchItem = items[0].findByType(TouchableOpacity);
56
+
54
57
  await act(async () => {
55
- await items[0].props.onPress();
58
+ await touchItem.props.onPress();
56
59
  });
57
60
 
58
61
  const bottomButton = instance.find(
59
62
  (item) =>
60
- item.props.testID ===
61
- `${TESTID.PREFIX.BUTTON_ADD_AUTO_SMART}${TESTID.BOTTOM_VIEW_MAIN}`
63
+ item.props.accessibilityLabel ===
64
+ `${AccessibilityLabel.PREFIX.BUTTON_ADD_AUTO_SMART}${AccessibilityLabel.BOTTOM_VIEW_MAIN}`
62
65
  );
63
66
  expect(bottomButton).toBeDefined();
67
+
64
68
  await act(async () => {
65
69
  await bottomButton.props.onPress();
66
70
  });
@@ -87,14 +91,14 @@ describe('test AddNewAutoSmart', () => {
87
91
  const items = instance.findAllByType(ItemAutomate);
88
92
 
89
93
  await act(async () => {
90
- await items[1].props.onPress();
94
+ await items[1].findByType(TouchableOpacity).props.onPress();
91
95
  });
92
96
  expect(items[1].props.isSelected).toBeTruthy();
93
97
 
94
98
  const bottomButton = instance.find(
95
99
  (item) =>
96
- item.props.testID ===
97
- `${TESTID.PREFIX.BUTTON_ADD_AUTO_SMART}${TESTID.BOTTOM_VIEW_MAIN}`
100
+ item.props.accessibilityLabel ===
101
+ `${AccessibilityLabel.PREFIX.BUTTON_ADD_AUTO_SMART}${AccessibilityLabel.BOTTOM_VIEW_MAIN}`
98
102
  );
99
103
  await act(async () => {
100
104
  await bottomButton.props.onPress();
@@ -9,7 +9,7 @@ import ItemAutomate from '../../commons/Automate/ItemAutomate';
9
9
  import {
10
10
  AUTOMATE_SELECT,
11
11
  AUTOMATE_TYPE,
12
- TESTID,
12
+ AccessibilityLabel,
13
13
  } from '../../configs/Constants';
14
14
  import { useTranslations } from '../../hooks/Common/useTranslations';
15
15
  import Routes from '../../utils/Route';
@@ -24,7 +24,7 @@ const AddNewAutoSmart = memo(({ route }) => {
24
24
  isMultiUnits,
25
25
  automate = {},
26
26
  scriptName,
27
- } = route.params;
27
+ } = route?.params || {};
28
28
 
29
29
  const typeAutoSmart = {
30
30
  [AUTOMATE_TYPE.AUTOMATE]: [
@@ -122,14 +122,6 @@ const AddNewAutoSmart = memo(({ route }) => {
122
122
  navigate,
123
123
  ]);
124
124
 
125
- const handleSelectIndex = (index) => {
126
- if (index !== selectedIndex) {
127
- setSelectedIndex(index);
128
- } else {
129
- setSelectedIndex(-1);
130
- }
131
- };
132
-
133
125
  const onClose = useCallback(() => {
134
126
  goBack();
135
127
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -151,13 +143,18 @@ const AddNewAutoSmart = memo(({ route }) => {
151
143
  <ItemAutomate
152
144
  type={item.type}
153
145
  isSelected={selectedIndex === index}
154
- onPress={() => handleSelectIndex(index)}
146
+ key={item?.id?.toString()}
147
+ index={index}
148
+ selectedIndex={selectedIndex}
149
+ setSelectedIndex={setSelectedIndex}
155
150
  />
156
151
  ))}
157
152
  </View>
158
153
  </View>
159
154
  <BottomButtonView
160
- testIDPrefix={TESTID.PREFIX.BUTTON_ADD_AUTO_SMART}
155
+ accessibilityLabelPrefix={
156
+ AccessibilityLabel.PREFIX.BUTTON_ADD_AUTO_SMART
157
+ }
161
158
  onPressMain={handleOnContinue}
162
159
  style={styles.bottomButton}
163
160
  mainTitle={t('continue')}
@@ -12,7 +12,7 @@ import Routes from '../../utils/Route';
12
12
  const ConnectingDevices = memo(({ route }) => {
13
13
  const t = useTranslations();
14
14
  const { navigate } = useNavigation();
15
- const { new_sensor } = route.params || {};
15
+ const { new_sensor } = route?.params || {};
16
16
 
17
17
  useEffect(() => {
18
18
  const checkSensorConnected = setInterval(async () => {
@@ -4,7 +4,7 @@ import MockAdapter from 'axios-mock-adapter';
4
4
 
5
5
  import AddNewDevice from '../index';
6
6
  import GroupCheckBox from '../../../commons/GroupCheckBox';
7
- import { TESTID } from '../../../configs/Constants';
7
+ import { AccessibilityLabel } from '../../../configs/Constants';
8
8
  import API from '../../../configs/API';
9
9
  import { ViewButtonBottom } from '../../../commons';
10
10
  import Routes from '../../../utils/Route';
@@ -57,7 +57,7 @@ describe('Test AddNewDevice', () => {
57
57
  });
58
58
 
59
59
  const getText = (instance, id) => {
60
- return instance.find((el) => el.props.testID === id);
60
+ return instance.find((el) => el.props.accessibilityLabel === id);
61
61
  };
62
62
 
63
63
  test('create', async () => {
@@ -65,8 +65,11 @@ describe('Test AddNewDevice', () => {
65
65
  tree = await create(wrapComponent(route));
66
66
  });
67
67
  const instance = tree.root;
68
- const textAdd = getText(instance, TESTID.ADD_NEW_DEVICE_ADD);
69
- const textThen = getText(instance, TESTID.ADD_NEW_DEVICE_THEN_SELECT);
68
+ const textAdd = getText(instance, AccessibilityLabel.ADD_NEW_DEVICE_ADD);
69
+ const textThen = getText(
70
+ instance,
71
+ AccessibilityLabel.ADD_NEW_DEVICE_THEN_SELECT
72
+ );
70
73
  expect(textAdd.props.children).toEqual(
71
74
  getTranslate('en', 'add_new_device')
72
75
  );
@@ -15,11 +15,11 @@ import Text from '../../commons/Text';
15
15
  import GroupCheckBox from '../../commons/GroupCheckBox';
16
16
  import { axiosGet } from '../../utils/Apis/axios';
17
17
  import Routes from '../../utils/Route';
18
- import { TESTID } from '../../configs/Constants';
18
+ import { AccessibilityLabel } from '../../configs/Constants';
19
19
 
20
20
  const AddNewDevice = memo(({ route }) => {
21
21
  const t = useTranslations();
22
- const { unit_id } = route.params;
22
+ const { unit_id } = route?.params || {};
23
23
  const { navigate, goBack } = useNavigation();
24
24
  const [unit, setUnit] = useState({ stations: [] });
25
25
  const [stationId, setStationId] = useState(-1);
@@ -70,7 +70,7 @@ const AddNewDevice = memo(({ route }) => {
70
70
  }
71
71
  >
72
72
  <Text
73
- testID={TESTID.ADD_NEW_DEVICE_ADD}
73
+ accessibilityLabel={AccessibilityLabel.ADD_NEW_DEVICE_ADD}
74
74
  semibold
75
75
  size={20}
76
76
  color={Colors.Black}
@@ -79,7 +79,7 @@ const AddNewDevice = memo(({ route }) => {
79
79
  {t('add_new_device')}
80
80
  </Text>
81
81
  <Text
82
- testID={TESTID.ADD_NEW_DEVICE_THEN_SELECT}
82
+ accessibilityLabel={AccessibilityLabel.ADD_NEW_DEVICE_THEN_SELECT}
83
83
  size={14}
84
84
  color={Colors.Gray8}
85
85
  style={styles.txtNote}
@@ -0,0 +1,40 @@
1
+ import { useNavigation } from '@react-navigation/native';
2
+ import React, { useCallback } from 'react';
3
+ import Processing from '../../commons/Processing';
4
+ import Routes from '../../utils/Route';
5
+
6
+ const ConnectingDevice = ({
7
+ title,
8
+ fail,
9
+ initState,
10
+ onReady,
11
+ unitId,
12
+ stationId,
13
+ chipId,
14
+ sensorId,
15
+ }) => {
16
+ const { navigate } = useNavigation();
17
+
18
+ const complete = useCallback(
19
+ (deviceInfo) => {
20
+ navigate(Routes.RenameNewDevices, {
21
+ unitId,
22
+ stationId,
23
+ chipId,
24
+ sensorId,
25
+ });
26
+ },
27
+ [chipId, navigate, sensorId, stationId, unitId]
28
+ );
29
+
30
+ return (
31
+ <Processing
32
+ title={title}
33
+ initState={initState}
34
+ fail={fail}
35
+ complete={complete}
36
+ onReady={onReady}
37
+ />
38
+ );
39
+ };
40
+ export default ConnectingDevice;
@@ -0,0 +1,61 @@
1
+ import { useNavigation } from '@react-navigation/native';
2
+ import React, { useCallback, useState } from 'react';
3
+ import { Alert } from 'react-native';
4
+ import API from '../../configs/API';
5
+ import { useTranslations } from '../../hooks/Common/useTranslations';
6
+ import { axiosPost } from '../../utils/Apis/axios';
7
+ import ConnectingDevice from './ConnectingDevice';
8
+
9
+ const ConnectingModbusDevice = ({ route }) => {
10
+ const t = useTranslations();
11
+ const { unitId, stationId, chipId, qrData } = route?.params || {};
12
+ const [sensorId, setSensorId] = useState(null);
13
+ const { goBack } = useNavigation();
14
+
15
+ const addingModbusDeviceFail = useCallback(
16
+ (message) => {
17
+ Alert.alert(t('fail_add_modbus_device'), message, [
18
+ {
19
+ text: t('ok'),
20
+ onPress: goBack,
21
+ },
22
+ ]);
23
+ },
24
+ [goBack, t]
25
+ );
26
+
27
+ const onReady = useCallback(
28
+ async (channelName) => {
29
+ const { success, problem, data } = await axiosPost(
30
+ API.CHIP.SCAN_SENSOR(chipId),
31
+ {
32
+ imei: qrData.imei,
33
+ unit: unitId,
34
+ station: stationId,
35
+ channel_name: channelName,
36
+ }
37
+ );
38
+
39
+ if (!success) {
40
+ addingModbusDeviceFail(JSON.stringify(problem || data));
41
+ return;
42
+ }
43
+ setSensorId(data.id);
44
+ },
45
+ [chipId, addingModbusDeviceFail, qrData, stationId, unitId]
46
+ );
47
+
48
+ return (
49
+ <ConnectingDevice
50
+ title={t('connecting_modbus_device')}
51
+ initState={t('connecting_to_gateway')}
52
+ onReady={onReady}
53
+ fail={addingModbusDeviceFail}
54
+ unitId={unitId}
55
+ stationId={stationId}
56
+ chipId={chipId}
57
+ sensorId={sensorId}
58
+ />
59
+ );
60
+ };
61
+ export default ConnectingModbusDevice;