@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
@@ -1,22 +1,12 @@
1
- import React, { useCallback, useEffect, useState, useMemo } from 'react';
2
- import { useIsFocused, useNavigation } from '@react-navigation/native';
1
+ import React, { useCallback, useEffect, useState } from 'react';
2
+ import { useNavigation } from '@react-navigation/native';
3
3
  import { useTranslations } from '../../hooks/Common/useTranslations';
4
- import { SafeAreaView, ScrollView, TouchableOpacity, View } from 'react-native';
5
-
6
- import { API } from '../../configs';
7
- import { Section, RadioCircle, ViewButtonBottom } from '../../commons';
8
- import { axiosGet } from '../../utils/Apis/axios';
9
- import Text from '../../commons/Text';
10
4
  import Routes from '../../utils/Route';
11
- import { TESTID } from '../../configs/Constants';
12
- import styles from './SelectSubUnitStyles';
13
- import Button from '../../commons/Button';
14
- import { SCConfig } from '../../configs/SCConfig';
5
+ import SelectSubUnit from '../../commons/SelectSubUnit';
15
6
 
16
7
  const AddCommonSelectSubUnit = ({ route }) => {
17
8
  const t = useTranslations();
18
9
  const navigation = useNavigation();
19
- const isFocused = useIsFocused();
20
10
  const {
21
11
  addType,
22
12
  unit_id,
@@ -26,34 +16,15 @@ const AddCommonSelectSubUnit = ({ route }) => {
26
16
  smart_account_id_from_backend,
27
17
  username,
28
18
  brand,
29
- scan_sensor_data,
30
- gateway,
31
- devicePrefixName,
32
- wifi_ssid,
33
- wifi_pass,
34
- } = route.params;
35
- const [selectedIndex, setSelectedIndex] = useState(-1);
36
- const [unit, setUnit] = useState([]);
19
+ } = route?.params || {};
37
20
  const [title, setTitle] = useState('');
38
21
  const [subTitle, setSubTitle] = useState('');
39
- const [nameSubUnit, setNameSubUnit] = useState('');
40
22
 
41
23
  useEffect(() => {
42
24
  switch (addType) {
43
- case 'AddNewGateway':
44
- setTitle(t('add_new_gateway'));
45
- setSubTitle(t('select_a_sub_unit'));
46
- break;
47
25
  case 'AddHassiDevice':
48
26
  setTitle(t('select_a_sub_unit'));
49
27
  break;
50
- case 'AddVconnexDevice':
51
- setTitle(t('select_a_sub_unit'));
52
- break;
53
- case 'AddDeviceNewFlow':
54
- setTitle(t('text_select_sub_unit'));
55
- setSubTitle(t('select_a_sub_unit_want_add_device'));
56
- break;
57
28
  default:
58
29
  setTitle(t('add_new_gateway'));
59
30
  setSubTitle(t('select_a_sub_unit'));
@@ -61,166 +32,48 @@ const AddCommonSelectSubUnit = ({ route }) => {
61
32
  }
62
33
  }, [title, subTitle, addType, t]);
63
34
 
64
- const fetchDetails = useCallback(async () => {
65
- const { success, data } = await axiosGet(
66
- API.UNIT.UNIT_DETAIL(unit_id),
67
- {},
68
- true
69
- );
70
- if (success) {
71
- setUnit(data);
72
- }
73
- }, [unit_id]);
74
-
75
- useEffect(() => {
76
- isFocused && fetchDetails();
77
- }, [fetchDetails, isFocused]);
78
-
79
- const subUnits = useMemo(() => unit.stations || [], [unit]);
80
-
81
- const onPressNext = useCallback(() => {
82
- switch (addType) {
83
- case 'AddNewGateway':
84
- navigation.navigate(Routes.ScanChipQR, {
85
- station: subUnits[selectedIndex]?.id,
86
- unit_name: unit?.name,
87
- ...route.params,
88
- isNewFlow: false,
89
- });
90
- break;
91
- case 'AddHassiDevice':
92
- navigation.navigate(Routes.SmartAccountConnecting, {
93
- listSensorIds: route.params.listSensorIds,
94
- station: subUnits[selectedIndex]?.id,
95
- nameSubUnit: nameSubUnit,
96
- sensor_data: sensor_data,
97
- listSelectDevice: listSelectDevice,
98
- smart_account_id: smart_account_id,
99
- unit_id: unit_id,
100
- smart_account_id_from_backend: smart_account_id_from_backend,
101
- username,
102
- brand,
103
- });
104
- break;
105
- case 'AddVconnexDevice':
106
- navigation.navigate(Routes.Browser, {
107
- link: API.IOT.VCONNEX.AUTHORIZE(
108
- SCConfig.VCONNEX_CLIENT_ID,
109
- SCConfig.VCONNEX_REDIRECT_URI_APP,
110
- unit.user_id,
111
- unit_id,
112
- subUnits[selectedIndex]?.id
113
- ),
114
- });
115
- break;
116
- case 'AddDeviceNewFlow':
117
- navigation.navigate(Routes.ConnectingProcess, {
118
- station: subUnits[selectedIndex],
119
- unit: unit,
120
- scan_sensor_data: scan_sensor_data,
121
- gateway: gateway,
122
- devicePrefixName: devicePrefixName,
123
- wifi_ssid: wifi_ssid,
124
- wifi_pass: wifi_pass,
125
- });
126
- break;
127
- default:
128
- break;
129
- }
130
- }, [
131
- addType,
132
- navigation,
133
- subUnits,
134
- selectedIndex,
135
- unit,
136
- route.params,
137
- nameSubUnit,
138
- sensor_data,
139
- listSelectDevice,
140
- smart_account_id,
141
- unit_id,
142
- smart_account_id_from_backend,
143
- username,
144
- brand,
145
- scan_sensor_data,
146
- gateway,
147
- devicePrefixName,
148
- wifi_ssid,
149
- wifi_pass,
150
- ]);
151
-
152
- const handleSelectIndex = (index) => {
153
- setNameSubUnit(subUnits[index].name);
154
- if (index !== selectedIndex) {
155
- setSelectedIndex(index);
156
- } else {
157
- setSelectedIndex(-1);
158
- }
159
- };
160
- const addSubUnit = useCallback(() => {
161
- navigation.navigate(Routes.AddSubUnitStack, {
162
- screen: Routes.AddSubUnit,
163
- params: { unit, ...route.params, addType: 'AddHassiDevice' },
164
- });
165
- }, [navigation, unit, route.params]);
35
+ const onPressNext = useCallback(
36
+ (unit, subUnit) => {
37
+ switch (addType) {
38
+ case 'AddHassiDevice':
39
+ navigation.navigate(Routes.SmartAccountConnecting, {
40
+ listSensorIds: route.params.listSensorIds,
41
+ stationId: subUnit?.id,
42
+ nameSubUnit: subUnit?.name,
43
+ sensor_data: sensor_data,
44
+ listSelectDevice: listSelectDevice,
45
+ smart_account_id: smart_account_id,
46
+ unit_id: unit_id,
47
+ smart_account_id_from_backend: smart_account_id_from_backend,
48
+ username,
49
+ brand,
50
+ });
51
+ break;
52
+ default:
53
+ break;
54
+ }
55
+ },
56
+ [
57
+ addType,
58
+ navigation,
59
+ route.params,
60
+ sensor_data,
61
+ listSelectDevice,
62
+ smart_account_id,
63
+ unit_id,
64
+ smart_account_id_from_backend,
65
+ username,
66
+ brand,
67
+ ]
68
+ );
166
69
 
167
70
  return (
168
- <SafeAreaView style={styles.container}>
169
- <Text semibold style={styles.title}>
170
- {title}
171
- </Text>
172
- <Text style={styles.subtitle}>{subTitle}</Text>
173
- <View style={styles.contentContainer}>
174
- <ScrollView
175
- style={styles.scrollContainer}
176
- showsVerticalScrollIndicator={false}
177
- scrollIndicatorInsets={{ right: 1 }}
178
- >
179
- <Section type={'border'}>
180
- {subUnits.map((item, index) => (
181
- <TouchableOpacity
182
- key={index}
183
- style={styles.rowContainer}
184
- onPress={() => handleSelectIndex(index)}
185
- >
186
- <RadioCircle
187
- active={selectedIndex === index}
188
- testID={TESTID.SELECT_SUBUNIT_RADIO_BUTTON}
189
- />
190
- <TouchableOpacity
191
- style={styles.row}
192
- onPress={() => handleSelectIndex(index)}
193
- testID={TESTID.SELECT_SUBUNIT_SELECT}
194
- >
195
- <Text style={styles.text} testID={TESTID.SELECT_SUBUNIT_NAME}>
196
- {item.name}
197
- </Text>
198
- </TouchableOpacity>
199
- </TouchableOpacity>
200
- ))}
201
- </Section>
202
- <View style={styles.buttonAdd}>
203
- <Button
204
- type="primaryBorder"
205
- title={`${t('add_new_sub_unit')} +`}
206
- onPress={addSubUnit}
207
- width="auto"
208
- height={32}
209
- textType="setupBorder"
210
- textSemiBold={false}
211
- />
212
- </View>
213
- </ScrollView>
214
- <ViewButtonBottom
215
- leftTitle={t('cancel')}
216
- onLeftClick={() => navigation.goBack()}
217
- rightTitle={t('next')}
218
- rightDisabled={selectedIndex === -1}
219
- onRightClick={onPressNext}
220
- testIDPrefix={TESTID.PREFIX.SELECT_UNIT}
221
- />
222
- </View>
223
- </SafeAreaView>
71
+ <SelectSubUnit
72
+ subTitle={subTitle}
73
+ title={title}
74
+ unitId={unit_id}
75
+ onPressNext={onPressNext}
76
+ />
224
77
  );
225
78
  };
226
79
 
@@ -1,29 +1,13 @@
1
1
  import { useNavigation } from '@react-navigation/native';
2
2
  import { useTranslations } from '../../hooks/Common/useTranslations';
3
3
  import React, { useCallback, useEffect, useState } from 'react';
4
- import {
5
- SafeAreaView,
6
- ScrollView,
7
- StyleSheet,
8
- TouchableOpacity,
9
- View,
10
- StatusBar,
11
- Platform,
12
- } from 'react-native';
13
-
14
- import { API, Colors } from '../../configs';
15
- import { Section, RadioCircle, ViewButtonBottom } from '../../commons';
16
- import { axiosGet } from '../../utils/Apis/axios';
17
- import Text from '../../commons/Text';
18
4
  import Routes from '../../utils/Route';
19
- import { TESTID } from '../../configs/Constants';
5
+ import SelectUnit from '../../commons/SelectUnit';
20
6
 
21
7
  const AddCommonSelectUnit = ({ route }) => {
22
8
  const t = useTranslations();
23
9
  const navigation = useNavigation();
24
- const { addType, scan_sensor_data } = route.params;
25
- const [selectedIndex, setSelectedIndex] = useState(-1);
26
- const [units, setUnits] = useState([]);
10
+ const { addType } = route?.params || {};
27
11
  const [title, setTitle] = useState('');
28
12
  const [subTitle, setSubTitle] = useState('');
29
13
 
@@ -48,13 +32,6 @@ const AddCommonSelectUnit = ({ route }) => {
48
32
  case 'AddHassioDevice':
49
33
  setTitle(t('text_select_a_unit'));
50
34
  break;
51
- case 'AddVconnexDevice':
52
- setTitle(t('text_select_a_unit'));
53
- break;
54
- case 'AddDeviceNewFlow':
55
- setTitle(t('text_select_a_unit'));
56
- setSubTitle(t('text_select_a_unit_have_device'));
57
- break;
58
35
  default:
59
36
  setTitle(t('add_new_sub_unit'));
60
37
  setSubTitle(t('add_new_subunit_select_unit'));
@@ -62,189 +39,59 @@ const AddCommonSelectUnit = ({ route }) => {
62
39
  }
63
40
  }, [title, subTitle, addType, t]);
64
41
 
65
- useEffect(() => {
66
- (async () => {
67
- const { data, success } = await axiosGet(API.SHARE.UNITS());
68
- if (success) {
69
- const normalizeData = data.map((unit) => ({
70
- name: unit.name,
71
- id: unit.id,
72
- }));
73
- setUnits(normalizeData);
42
+ const onPressNext = useCallback(
43
+ (unit) => {
44
+ switch (addType) {
45
+ case 'AddSubUnit':
46
+ navigation.navigate(Routes.AddSubUnit, {
47
+ unit,
48
+ });
49
+ break;
50
+ case 'AddDevice':
51
+ navigation.navigate(Routes.AddNewDevice, {
52
+ unit_id: unit?.id,
53
+ });
54
+ break;
55
+ case 'AddMember':
56
+ navigation.navigate(Routes.SharingSelectPermission, {
57
+ unit,
58
+ });
59
+ break;
60
+ case 'AddLGDevice':
61
+ navigation.navigate(Routes.AddLGDevice, {
62
+ code: route.params.code,
63
+ backend_url: route.params.backend_url
64
+ .replace(/%2F/g, '/')
65
+ .replace(/%3A/g, ':'),
66
+ unit_id: unit?.id,
67
+ });
68
+ break;
69
+ case 'AddHassioDevice':
70
+ navigation.navigate(Routes.SmartAccountConnecting, {
71
+ username: route.params.username,
72
+ password: route.params.password,
73
+ brand: route.params.brand,
74
+ unit_id: unit?.id,
75
+ });
76
+ break;
77
+ default:
78
+ break;
74
79
  }
75
- })();
76
- }, []);
77
-
78
- const onPressNext = useCallback(() => {
79
- switch (addType) {
80
- case 'AddSubUnit':
81
- navigation.navigate(Routes.AddSubUnit, {
82
- unit: units[selectedIndex],
83
- });
84
- break;
85
- case 'AddDevice':
86
- navigation.navigate(Routes.AddNewDevice, {
87
- unit_id: units[selectedIndex].id,
88
- });
89
- break;
90
- case 'AddMember':
91
- navigation.navigate(Routes.SharingSelectPermission, {
92
- unit: units[selectedIndex],
93
- });
94
- break;
95
- case 'AddLGDevice':
96
- navigation.navigate(Routes.AddLGDevice, {
97
- code: route.params.code,
98
- backend_url: route.params.backend_url
99
- .replace(/%2F/g, '/')
100
- .replace(/%3A/g, ':'),
101
- unit_id: units[selectedIndex].id,
102
- });
103
- break;
104
- case 'AddHassioDevice':
105
- navigation.navigate(Routes.SmartAccountConnecting, {
106
- username: route.params.username,
107
- password: route.params.password,
108
- brand: route.params.brand,
109
- unit_id: units[selectedIndex].id,
110
- });
111
- break;
112
- case 'AddVconnexDevice':
113
- navigation.navigate(Routes.AddDeviceStack, {
114
- screen: Routes.AddCommonSelectSubUnit,
115
- params: {
116
- unit_id: units[selectedIndex].id,
117
- addType: 'AddVconnexDevice',
118
- },
119
- });
120
- break;
121
- case 'AddDeviceNewFlow':
122
- navigation.navigate(Routes.AddGatewaySelectGateway, {
123
- unit_id: units[selectedIndex].id,
124
- addType: 'AddDeviceNewFlow',
125
- scan_sensor_data,
126
- });
127
- break;
128
- default:
129
- break;
130
- }
131
- }, [
132
- addType,
133
- navigation,
134
- units,
135
- selectedIndex,
136
- route.params.code,
137
- route.params.backend_url,
138
- route.params.username,
139
- route.params.password,
140
- route.params.brand,
141
- scan_sensor_data,
142
- ]);
143
-
144
- const handleSelectIndex = (index) => {
145
- if (index !== selectedIndex) {
146
- setSelectedIndex(index);
147
- } else {
148
- setSelectedIndex(-1);
149
- }
150
- };
80
+ },
81
+ [
82
+ addType,
83
+ navigation,
84
+ route.params.code,
85
+ route.params.backend_url,
86
+ route.params.username,
87
+ route.params.password,
88
+ route.params.brand,
89
+ ]
90
+ );
151
91
 
152
92
  return (
153
- <SafeAreaView style={styles.container}>
154
- <Text semibold style={styles.title}>
155
- {title}
156
- </Text>
157
- <Text style={styles.subtitle}>{subTitle}</Text>
158
- <View style={styles.contentContainer}>
159
- <ScrollView
160
- style={styles.scrollContainer}
161
- showsVerticalScrollIndicator={false}
162
- scrollIndicatorInsets={{ right: 1 }}
163
- >
164
- <Section type={'border'}>
165
- {units.map((item, index) => (
166
- <TouchableOpacity
167
- key={index}
168
- style={styles.rowContainer}
169
- onPress={() => handleSelectIndex(index)}
170
- >
171
- <RadioCircle
172
- active={selectedIndex === index}
173
- testID={TESTID.SELECT_UNIT_RADIO_BUTTON}
174
- />
175
- <TouchableOpacity
176
- style={styles.row}
177
- onPress={() => handleSelectIndex(index)}
178
- testID={TESTID.SELECT_UNIT_SELECT}
179
- >
180
- <Text style={styles.text} testID={TESTID.SELECT_UNIT_NAME}>
181
- {item.name}
182
- </Text>
183
- </TouchableOpacity>
184
- </TouchableOpacity>
185
- ))}
186
- </Section>
187
- </ScrollView>
188
- <ViewButtonBottom
189
- leftTitle={t('cancel')}
190
- onLeftClick={() => navigation.goBack()}
191
- rightTitle={t('next')}
192
- rightDisabled={selectedIndex === -1}
193
- onRightClick={onPressNext}
194
- testIDPrefix={TESTID.PREFIX.SELECT_UNIT}
195
- />
196
- </View>
197
- </SafeAreaView>
93
+ <SelectUnit title={title} subTitle={subTitle} onPressNext={onPressNext} />
198
94
  );
199
95
  };
200
96
 
201
- const styles = StyleSheet.create({
202
- container: {
203
- flex: 1,
204
- backgroundColor: Colors.Gray2,
205
- paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0,
206
- },
207
- contentContainer: {
208
- flex: 1,
209
- justifyContent: 'space-between',
210
- },
211
- scrollContainer: {
212
- width: '100%',
213
- flex: 1,
214
- },
215
- title: {
216
- color: Colors.Gray9,
217
- fontSize: 20,
218
- lineHeight: 28,
219
- marginTop: 8,
220
- marginBottom: 4,
221
- marginLeft: 16,
222
- },
223
- subtitle: {
224
- color: Colors.Gray8,
225
- fontSize: 14,
226
- lineHeight: 22,
227
- marginLeft: 16,
228
- marginBottom: 16,
229
- },
230
- row: {
231
- flex: 1,
232
- paddingVertical: 16,
233
- borderBottomColor: Colors.Gray4,
234
- borderBottomWidth: 1,
235
- marginRight: 24,
236
- marginLeft: 16,
237
- },
238
- rowContainer: {
239
- flexDirection: 'row',
240
- alignItems: 'center',
241
- paddingLeft: 16,
242
- },
243
- text: {
244
- fontSize: 16,
245
- lineHeight: 24,
246
- color: Colors.Gray9,
247
- },
248
- });
249
-
250
97
  export default AddCommonSelectUnit;
@@ -8,7 +8,7 @@ import { ViewButtonBottom } from '../../../commons';
8
8
  import { SCProvider } from '../../../context';
9
9
  import { mockSCStore } from '../../../context/mockStore';
10
10
  import Text from '../../../commons/Text';
11
- import { TESTID } from '../../../configs/Constants';
11
+ import { AccessibilityLabel } from '../../../configs/Constants';
12
12
  import api from '../../../utils/Apis/axios';
13
13
  import { API } from '../../../configs';
14
14
 
@@ -39,21 +39,9 @@ describe('Test SelectSubUnit', () => {
39
39
  mockedGoBack.mockClear();
40
40
  });
41
41
  let tree;
42
- test('test ViewButtonBottom leftClick', async () => {
43
- const route = { params: { addType: 'AddNewGateway' } };
44
- await act(async () => {
45
- tree = renderer.create(wrapComponent(route));
46
- });
47
- const instance = tree.root;
48
- const viewButtonBottom = instance.findByType(ViewButtonBottom);
49
- act(() => {
50
- viewButtonBottom.props.onLeftClick();
51
- });
52
- expect(mockedGoBack).toHaveBeenCalled();
53
- });
54
42
 
55
43
  test('test ViewButtonBottom onRightClick', async () => {
56
- const route = { params: { addType: 'AddNewGateway' } };
44
+ const route = { params: { addType: 'AddHassiDevice' } };
57
45
  await act(async () => {
58
46
  tree = renderer.create(wrapComponent(route));
59
47
  });
@@ -65,23 +53,18 @@ describe('Test SelectSubUnit', () => {
65
53
  expect(mockedNavigate).toHaveBeenCalled();
66
54
  });
67
55
  });
56
+
68
57
  describe('Test SelectSubUnit container', () => {
69
58
  beforeEach(() => {
70
59
  mockedNavigate.mockClear();
71
60
  mockedGoBack.mockClear();
72
61
  });
73
62
  let tree;
74
- const list_type = [
75
- 'AddNewGateway',
76
- 'AddHassiDevice',
77
- 'AddVconnexDevice',
78
- 'AddDeviceNewFlow',
79
- ];
63
+ const list_type = ['AddHassiDevice'];
80
64
  const result = [
81
- 'Select a sub-unit that you want to add this gateway',
82
65
  '',
83
66
  '',
84
- 'Then, select a sub-unit that you want to add this device in',
67
+ 'Select a sub-unit that you want to add this device in',
85
68
  ];
86
69
 
87
70
  list_type.forEach(function (type, i) {
@@ -115,8 +98,8 @@ describe('Test SelectSubUnit container', () => {
115
98
 
116
99
  const next = instance.find(
117
100
  (item) =>
118
- item.props.testID ===
119
- `${TESTID.PREFIX.SELECT_UNIT}${TESTID.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
101
+ item.props.accessibilityLabel ===
102
+ `${AccessibilityLabel.PREFIX.SELECT_UNIT}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
120
103
  );
121
104
 
122
105
  await act(async () => {
@@ -124,21 +107,12 @@ describe('Test SelectSubUnit container', () => {
124
107
  });
125
108
 
126
109
  switch (type) {
127
- case 'AddNewGateway':
128
- expect(mockedNavigate).toBeCalledWith('ScanChipQR', {
129
- addType: 'AddNewGateway',
130
- station: undefined,
131
- isNewFlow: false,
132
- unit_name: undefined,
133
- });
134
- break;
135
110
  case 'AddHassiDevice':
136
111
  expect(mockedNavigate).toBeCalledWith('SmartAccountConnecting', {
137
112
  unit_id: undefined,
138
113
  brand: undefined,
139
114
  listSelectDevice: undefined,
140
115
  listSensorIds: undefined,
141
- nameSubUnit: '',
142
116
  sensor_data: undefined,
143
117
  smart_account_id: undefined,
144
118
  smart_account_id_from_backend: undefined,
@@ -146,23 +120,6 @@ describe('Test SelectSubUnit container', () => {
146
120
  username: undefined,
147
121
  });
148
122
  break;
149
- case 'AddVconnexDevice':
150
- expect(mockedNavigate).toBeCalledWith('Browser', {
151
- // eslint-disable-next-line max-len
152
- link: 'https://partner-api.vconnex.vn/oauth/authorize?client_id=&redirect_uri=&response_type=code&scope=SYNCH&scope=CONTROL&scope=QUERY&state=undefined@undefined@undefined',
153
- });
154
- break;
155
- case 'AddDeviceNewFlow':
156
- expect(mockedNavigate).toBeCalledWith('ConnectingProcess', {
157
- devicePrefixName: undefined,
158
- gateway: undefined,
159
- scan_sensor_data: undefined,
160
- station: undefined,
161
- unit: [],
162
- wifi_pass: undefined,
163
- wifi_ssid: undefined,
164
- });
165
- break;
166
123
  default:
167
124
  break;
168
125
  }