@eohjsc/react-native-smart-city 0.3.8 → 0.3.11

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 (297) hide show
  1. package/README.md +36 -15
  2. package/package.json +10 -6
  3. package/react-native-smart-city.podspec +1 -0
  4. package/src/commons/Action/ItemQuickAction.js +16 -4
  5. package/src/commons/Action/__test__/ItemQuickAction.test.js +11 -6
  6. package/src/commons/ActionGroup/ColorPickerTemplate.js +37 -24
  7. package/src/commons/ActionGroup/CurtainButtonTemplate.js +10 -5
  8. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +4 -0
  9. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +1 -1
  10. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +24 -0
  11. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +14 -0
  12. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +1 -0
  13. package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +8 -2
  14. package/src/commons/ActionGroup/SliderRangeTemplate.js +6 -2
  15. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +7 -3
  16. package/src/commons/ActionGroup/StatesGridActionTemplate.js +22 -8
  17. package/src/commons/ActionGroup/TimerActionTemplate.js +11 -3
  18. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +1 -5
  19. package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +53 -4
  20. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +14 -14
  21. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +53 -78
  22. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +36 -20
  23. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +77 -0
  24. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +58 -6
  25. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +49 -1
  26. package/src/commons/ActionGroup/__test__/index.test.js +135 -0
  27. package/src/commons/Auth/AccountList.js +1 -1
  28. package/src/commons/Automate/ItemAutomate.js +1 -3
  29. package/src/commons/Calendar/__test__/Calendar.test.js +33 -0
  30. package/src/commons/Connecting/__test__/Connecting.test.js +19 -2
  31. package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +7 -3
  32. package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +8 -11
  33. package/src/commons/ConnectingProcess/__test__/Connecting.test.js +136 -3
  34. package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +3 -2
  35. package/src/commons/ConnectingProcess/index.js +76 -26
  36. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +16 -13
  37. package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +1 -1
  38. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +0 -5
  39. package/src/commons/Device/ConnectedViewHeader.js +1 -1
  40. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +58 -0
  41. package/src/commons/Device/HistoryChart.js +7 -3
  42. package/src/commons/Device/ItemDevice.js +34 -13
  43. package/src/commons/Device/LinearChart.js +15 -0
  44. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +16 -12
  45. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +3 -0
  46. package/src/commons/Device/SonosSpeaker/index.js +1 -1
  47. package/src/commons/Device/WaterQualitySensor/ListQualityIndicator.js +1 -0
  48. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +7 -2
  49. package/src/commons/Explore/__test__/CityItem.test.js +33 -54
  50. package/src/commons/FieldTemplate/ChooseUserField/ChooseFieldStyles.js +25 -0
  51. package/src/commons/FieldTemplate/ChooseUserField/ChoosePopup.js +96 -0
  52. package/src/commons/FieldTemplate/ChooseUserField/ChoosePopupStyles.js +39 -0
  53. package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +118 -0
  54. package/src/commons/FieldTemplate/ChooseUserField/index.js +62 -0
  55. package/src/commons/FieldTemplate/PasscodeField/PasscodeFieldStyles.js +30 -0
  56. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +90 -0
  57. package/src/commons/FieldTemplate/PasscodeField/index.js +43 -0
  58. package/src/commons/FieldTemplate/ScheduleField/ScheduleFieldStyles.js +13 -0
  59. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +179 -0
  60. package/src/commons/FieldTemplate/ScheduleField/index.js +176 -0
  61. package/src/commons/Form/CurrencyInput.js +15 -1
  62. package/src/commons/Form/TextInputPassword.js +1 -1
  63. package/src/commons/FullLoading/index.js +2 -1
  64. package/src/commons/Header/HeaderCustom.js +2 -1
  65. package/src/commons/HeaderAni/index.js +6 -1
  66. package/src/commons/HorizontalPicker/index.js +2 -2
  67. package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +0 -6
  68. package/src/commons/MediaPlayerDetail/index.js +29 -47
  69. package/src/commons/MenuActionAddnew/index.js +1 -0
  70. package/src/commons/MenuActionList/index.js +1 -0
  71. package/src/commons/MenuActionMore/index.js +1 -1
  72. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +62 -0
  73. package/src/commons/PreventAccess/index.js +9 -1
  74. package/src/commons/Sharing/MemberList.js +10 -2
  75. package/src/commons/Sharing/WrapHeaderScrollable.js +2 -0
  76. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +0 -1
  77. package/src/commons/SubUnit/Favorites/index.js +6 -3
  78. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +8 -35
  79. package/src/commons/SubUnit/OneTap/index.js +1 -2
  80. package/src/commons/SubUnit/ShortDetail.js +25 -9
  81. package/src/commons/SubUnit/__test__/Item.test.js +0 -1
  82. package/src/commons/SubUnit/__test__/ShortDetail.test.js +9 -2
  83. package/src/commons/Unit/SharedUnit.js +1 -0
  84. package/src/commons/Unit/__test__/SharedUnit.test.js +38 -183
  85. package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +28 -1
  86. package/src/commons/UnitSummary/ConfigHistoryChart/index.js +2 -13
  87. package/src/commons/UnitSummary/ConfigHistoryChart.js +55 -13
  88. package/src/commons/WheelDateTimePicker/index.js +4 -3
  89. package/src/configs/API.js +91 -143
  90. package/src/configs/Constants.js +80 -1
  91. package/src/configs/SCConfig.js +4 -0
  92. package/src/context/actionType.ts +14 -2
  93. package/src/context/mockStore.ts +26 -0
  94. package/src/context/reducer.ts +84 -5
  95. package/src/hooks/Common/index.js +2 -0
  96. package/src/hooks/Common/useGGHomeDeviceConnected.js +16 -0
  97. package/src/hooks/Common/useGetIdUser.js +1 -5
  98. package/src/hooks/Common/useSensorsStatus.js +4 -4
  99. package/src/hooks/IoT/__test__/useGGHomeConnection.test.js +199 -0
  100. package/src/hooks/IoT/__test__/useRemoteControl.test.js +198 -0
  101. package/src/hooks/IoT/__test__/useValueEvaluation.test.js +58 -0
  102. package/src/hooks/IoT/index.js +5 -0
  103. package/src/hooks/IoT/useGGHomeConnection.js +93 -0
  104. package/src/hooks/IoT/useRemoteControl.js +79 -0
  105. package/src/hooks/IoT/useValueEvaluation.js +45 -0
  106. package/src/hooks/index.js +4 -0
  107. package/src/hooks/useReceiveNotifications.js +12 -7
  108. package/src/iot/Monitor.js +3 -2
  109. package/src/iot/RemoteControl/Bluetooth.js +1 -1
  110. package/src/iot/RemoteControl/GoogleHome.js +75 -49
  111. package/src/iot/RemoteControl/Internet.js +1 -1
  112. package/src/iot/RemoteControl/__test__/GoogleHome.test.js +95 -48
  113. package/src/iot/RemoteControl/__test__/Internet.test.js +18 -7
  114. package/src/iot/RemoteControl/__test__/LgThinq.test.js +36 -177
  115. package/src/iot/RemoteControl/index.js +52 -52
  116. package/src/navigations/UnitStack.js +19 -20
  117. package/src/navigations/UnitStackStyles.js +21 -0
  118. package/src/screens/AQIGuide/index.js +1 -1
  119. package/src/screens/ActivityLog/FilterPopup.js +2 -0
  120. package/src/screens/ActivityLog/__test__/index.test.js +38 -23
  121. package/src/screens/ActivityLog/hooks/__test__/index.test.js +51 -90
  122. package/src/screens/ActivityLog/hooks/index.js +1 -1
  123. package/src/screens/ActivityLog/index.js +2 -2
  124. package/src/screens/AddCommon/SelectSubUnit.js +1 -0
  125. package/src/screens/AddCommon/SelectUnit.js +1 -0
  126. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +13 -24
  127. package/src/screens/AddCommon/__test__/SelectUnit.test.js +9 -33
  128. package/src/screens/AddLocationMaps/__test__/index.test.js +265 -0
  129. package/src/screens/AddLocationMaps/index.js +48 -21
  130. package/src/screens/AddNewAction/SelectAction.js +33 -13
  131. package/src/screens/AddNewAction/SelectSensorDevices.js +8 -2
  132. package/src/screens/AddNewAction/SetupSensor.js +68 -32
  133. package/src/screens/AddNewAction/__test__/SelectAction.test.js +10 -91
  134. package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +40 -26
  135. package/src/screens/AddNewAction/__test__/SetupSensor.test.js +2 -0
  136. package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +3 -1
  137. package/src/screens/AddNewAutoSmart/index.js +5 -2
  138. package/src/screens/AddNewDevice/ConnectingDevices.js +3 -3
  139. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +42 -34
  140. package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +0 -4
  141. package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +22 -22
  142. package/src/screens/AddNewDevice/hooks/ConnectDevices.js +1 -1
  143. package/src/screens/AddNewDevice/index.js +1 -0
  144. package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +23 -17
  145. package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +46 -40
  146. package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +64 -10
  147. package/src/screens/AddNewGateway/SelectGateway.js +1 -0
  148. package/src/screens/AddNewGateway/SetupGatewayWifi.js +2 -0
  149. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +4 -6
  150. package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +0 -4
  151. package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +5 -29
  152. package/src/screens/AddNewGateway/__test__/SelectGateway.test.js +0 -4
  153. package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +0 -4
  154. package/src/screens/AddNewGateway/index.js +1 -0
  155. package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +10 -24
  156. package/src/screens/AddNewOneTap/index.js +3 -2
  157. package/src/screens/AllCamera/index.js +4 -4
  158. package/src/screens/Automate/MultiUnits.js +8 -8
  159. package/src/screens/Automate/__test__/MultiUnits.test.js +6 -9
  160. package/src/screens/Automate/__test__/index.test.js +7 -12
  161. package/src/screens/Automate/index.js +5 -3
  162. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +36 -8
  163. package/src/screens/ConfirmUnitDeletion/index.js +7 -1
  164. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +71 -22
  165. package/src/screens/Device/EditDevice/index.js +17 -15
  166. package/src/screens/Device/__test__/detail.test.js +33 -86
  167. package/src/screens/Device/components/DetailHistoryChart.js +1 -1
  168. package/src/screens/Device/components/SensorConnectStatusViewHeader.js +44 -24
  169. package/src/screens/Device/components/SensorDisplayItem.js +5 -2
  170. package/src/screens/Device/detail.js +101 -51
  171. package/src/screens/Device/hooks/useDisconnectedDevice.js +4 -4
  172. package/src/screens/Device/hooks/useEvaluateValue.js +97 -0
  173. package/src/screens/Device/hooks/useFavoriteDevice.js +7 -11
  174. package/src/screens/DeviceInfo/__test__/index.test.js +0 -2
  175. package/src/screens/EditActionsList/index.js +1 -1
  176. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +6 -3
  177. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +7 -19
  178. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +20 -2
  179. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +40 -23
  180. package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
  181. package/src/screens/EmergencySetting/index.js +4 -1
  182. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +41 -25
  183. package/src/screens/Explore/index.js +2 -0
  184. package/src/screens/GuestInfo/__test__/index.test.js +14 -41
  185. package/src/screens/GuestInfo/components/RecurringDetail.js +1 -0
  186. package/src/screens/GuestInfo/components/TemporaryDetail.js +2 -2
  187. package/src/screens/HanetCamera/Detail.js +1 -1
  188. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +8 -12
  189. package/src/screens/HanetCamera/__test__/Detail.test.js +27 -42
  190. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +8 -5
  191. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -32
  192. package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +3 -2
  193. package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +43 -35
  194. package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +10 -21
  195. package/src/screens/HanetCamera/hooks/useHanetCheckinData.js +11 -11
  196. package/src/screens/HanetCamera/hooks/useHanetPlaceMembers.js +11 -11
  197. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +33 -22
  198. package/src/screens/ManageAccess/hooks/__test__/useManageAccess.test.js +44 -45
  199. package/src/screens/ManageAccess/hooks/index.js +7 -4
  200. package/src/screens/ManageAccess/index.js +2 -1
  201. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +35 -12
  202. package/src/screens/MoveToAnotherSubUnit/index.js +6 -6
  203. package/src/screens/Notification/__test__/Notification.test.js +31 -25
  204. package/src/screens/Notification/__test__/NotificationItem.test.js +8 -7
  205. package/src/screens/Notification/components/NotificationItem.js +17 -20
  206. package/src/screens/Notification/index.js +13 -2
  207. package/src/screens/PlayBackCamera/Timer.js +2 -2
  208. package/src/screens/PlayBackCamera/__test__/index.test.js +87 -2
  209. package/src/screens/PlayBackCamera/index.js +54 -35
  210. package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +7 -20
  211. package/src/screens/ScanChipQR/components/QRScan/index.js +1 -0
  212. package/src/screens/ScanChipQR/hooks/index.js +15 -16
  213. package/src/screens/ScanSensorQR/__test__/ScanSensorQR.test.js +8 -24
  214. package/src/screens/ScriptDetail/__test__/index.test.js +17 -86
  215. package/src/screens/ScriptDetail/index.js +30 -15
  216. package/src/screens/SelectUnit/__test__/index.test.js +12 -55
  217. package/src/screens/SelectUnit/index.js +9 -4
  218. package/src/screens/SetSchedule/index.js +15 -11
  219. package/src/screens/SharedUnit/__test__/TabHeader.test.js +0 -2
  220. package/src/screens/SharedUnit/index.js +2 -0
  221. package/src/screens/Sharing/Components/SensorItem.js +10 -12
  222. package/src/screens/Sharing/InfoMemberUnit.js +1 -1
  223. package/src/screens/Sharing/MemberList.js +12 -11
  224. package/src/screens/Sharing/SelectPermission.js +136 -83
  225. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +47 -29
  226. package/src/screens/Sharing/__test__/MemberList.test.js +13 -127
  227. package/src/screens/Sharing/__test__/MemberList2.test.js +80 -0
  228. package/src/screens/Sharing/__test__/SelectPermission.test.js +28 -38
  229. package/src/screens/Sharing/__test__/SelectUser.test.js +17 -38
  230. package/src/screens/Sharing/hooks/index.js +3 -0
  231. package/src/screens/SideMenuDetail/SideMenuDetailStyles.js +28 -0
  232. package/src/screens/SideMenuDetail/__test__/index.test.js +154 -0
  233. package/src/screens/SideMenuDetail/index.js +148 -0
  234. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +3 -2
  235. package/src/screens/SmartIr/components/SelectBrand.js +1 -1
  236. package/src/screens/SubUnit/AddSubUnit.js +23 -17
  237. package/src/screens/SubUnit/Detail.js +1 -2
  238. package/src/screens/SubUnit/EditSubUnit.js +15 -13
  239. package/src/screens/SubUnit/ManageSubUnit.js +13 -7
  240. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +29 -89
  241. package/src/screens/SubUnit/__test__/Detail.test.js +31 -8
  242. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +21 -89
  243. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +27 -1
  244. package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +48 -45
  245. package/src/screens/SubUnit/hooks/useManageSubUnit.js +7 -7
  246. package/src/screens/SyncLGDevice/AddLGDevice.js +1 -0
  247. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +22 -91
  248. package/src/screens/TDSGuide/index.js +4 -1
  249. package/src/screens/UVIndexGuide/index.js +1 -1
  250. package/src/screens/Unit/ChooseLocation.js +7 -14
  251. package/src/screens/Unit/Detail.js +37 -75
  252. package/src/screens/Unit/ManageUnit.js +1 -0
  253. package/src/screens/Unit/SelectAddress.js +46 -26
  254. package/src/screens/Unit/SelectDevices.js +158 -0
  255. package/src/screens/Unit/SelectDevicesStyles.js +40 -0
  256. package/src/screens/Unit/SmartAccount.js +4 -4
  257. package/src/screens/Unit/Station/index.js +4 -0
  258. package/src/screens/Unit/Summaries.js +18 -2
  259. package/src/screens/Unit/__test__/CheckSendEmail.test.js +24 -29
  260. package/src/screens/Unit/__test__/ChooseLocation.test.js +27 -14
  261. package/src/screens/Unit/__test__/Detail.test.js +98 -199
  262. package/src/screens/Unit/__test__/ManageUnit.test.js +18 -42
  263. package/src/screens/Unit/__test__/SelectAddress.test.js +249 -50
  264. package/src/screens/Unit/__test__/SelectDevices.test.js +110 -0
  265. package/src/screens/Unit/__test__/SmartAccount.test.js +17 -9
  266. package/src/screens/Unit/__test__/SmartAccountItem.test.js +0 -1
  267. package/src/screens/Unit/__test__/Summaries.test.js +100 -0
  268. package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +36 -0
  269. package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +54 -0
  270. package/src/screens/Unit/components/MyUnitDevice/index.js +4 -4
  271. package/src/screens/Unit/components/SharedUnit/index.js +1 -0
  272. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
  273. package/src/screens/Unit/components/__test__/SharedUnit.test.js +31 -34
  274. package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +50 -0
  275. package/src/screens/Unit/styles.js +8 -0
  276. package/src/screens/UnitSummary/__test__/index.test.js +91 -30
  277. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +31 -2
  278. package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/__test__/index.test.js +7 -4
  279. package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/index.js +2 -13
  280. package/src/screens/UnitSummary/components/PowerConsumption/__test__/ItemPower.test.js +0 -1
  281. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +14 -16
  282. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +11 -2
  283. package/src/screens/UnitSummary/components/RunningDevices/index.js +7 -10
  284. package/src/screens/UnitSummary/components/Temperature/index.js +4 -4
  285. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +10 -2
  286. package/src/screens/UnitSummary/index.js +15 -1
  287. package/src/screens/WaterQualityGuide/index.js +1 -1
  288. package/src/utils/Apis/axios.js +61 -32
  289. package/src/utils/Converter/time.js +0 -18
  290. package/src/utils/I18n/translations/en.json +13 -1
  291. package/src/utils/I18n/translations/vi.json +14 -1
  292. package/src/utils/Permission/common.js +67 -0
  293. package/src/utils/Route/index.js +2 -0
  294. package/src/utils/Setting/Location.js +30 -0
  295. package/src/utils/Utils.js +12 -7
  296. package/src/utils/Validation.js +3 -0
  297. package/src/utils/__test__/Utils.test.js +12 -0
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
1
  import React, { memo, useCallback, useRef, useState } from 'react';
3
2
  import { View } from 'react-native';
4
3
  import MapView, { PROVIDER_GOOGLE } from 'react-native-maps';
@@ -8,24 +7,17 @@ import BottomButtonView from '../../commons/BottomButtonView';
8
7
  import { FullLoading } from '../../commons';
9
8
  import { useTranslations } from '../../hooks/Common/useTranslations';
10
9
 
11
- navigator.geolocation = require('@react-native-community/geolocation');
12
-
13
10
  import styles from './ChooseLocationStyles';
14
11
  import { API } from '../../configs';
15
12
  import { axiosGet } from '../../utils/Apis/axios';
16
13
  import { SCConfig } from '../../configs';
14
+ import { MAP_INITIAL_REGION, EOH_LOCATION } from '../../configs/Constants';
17
15
 
18
- const initialRegion = {
19
- latitudeDelta: 0.0922,
20
- longitudeDelta: 0.0421,
21
- };
22
-
23
- const DEFAULT_LATITUDE = 10.7974046; // EoH center
24
- const DEFAULT_LONGITUDE = 106.7035663;
16
+ navigator.geolocation = require('@react-native-community/geolocation');
25
17
 
26
18
  const ChooseLocation = memo(({ route }) => {
27
19
  const t = useTranslations();
28
- const { location, setAddress, setLocation } = route.params;
20
+ const { location, setAddress, setLocation } = route.params || {};
29
21
  const { goBack } = useNavigation();
30
22
  const [currentLocation, setCurrentLocation] = useState(location);
31
23
  const [loading, setLoading] = useState(false);
@@ -76,9 +68,10 @@ const ChooseLocation = memo(({ route }) => {
76
68
  provider={PROVIDER_GOOGLE}
77
69
  style={styles.mapView}
78
70
  initialRegion={{
79
- ...initialRegion,
80
- latitude: location?.latitude || DEFAULT_LATITUDE,
81
- longitude: location?.longitude || DEFAULT_LONGITUDE,
71
+ latitude: location?.latitude || EOH_LOCATION.LAT,
72
+ longitude: location?.longitude || EOH_LOCATION.LNG,
73
+ latitudeDelta: MAP_INITIAL_REGION.LAT,
74
+ longitudeDelta: MAP_INITIAL_REGION.LNG,
82
75
  }}
83
76
  followUserLocation={true}
84
77
  onRegionChangeComplete={onRegionChange}
@@ -1,14 +1,15 @@
1
1
  import React, {
2
2
  useCallback,
3
- useContext,
4
3
  useEffect,
5
4
  useState,
6
5
  useRef,
6
+ useContext,
7
+ useMemo,
7
8
  } from 'react';
8
- import { AppState, RefreshControl, View } from 'react-native';
9
+ import { AppState, RefreshControl, View, Platform } from 'react-native';
9
10
  import { useIsFocused } from '@react-navigation/native';
10
- import { useTranslations } from '../../hooks/Common/useTranslations';
11
11
 
12
+ import { useTranslations } from '../../hooks/Common/useTranslations';
12
13
  import styles from './styles';
13
14
  import AddMenu from './AddMenu';
14
15
  import MoreMenu from './MoreMenu';
@@ -23,10 +24,9 @@ import {
23
24
  usePopover,
24
25
  } from '../../hooks/Common';
25
26
  import { useFavorites } from './hook/useFavorites';
26
- import { scanBluetoothDevices } from '../../iot/RemoteControl/Bluetooth';
27
- import { googleHomeConnect } from '../../iot/RemoteControl/GoogleHome';
28
- import { axiosPost, fetchWithCache, axiosGet } from '../../utils/Apis/axios';
29
- import { lgThinqConnect } from '../../iot/RemoteControl/LG';
27
+ import { useUnitConnectRemoteDevices } from './hook/useUnitConnectRemoteDevices';
28
+ import { useValueEvaluations } from '../../hooks/IoT';
29
+ import { fetchWithCache, axiosGet } from '../../utils/Apis/axios';
30
30
  import ShortDetailSubUnit from '../../commons/SubUnit/ShortDetail';
31
31
  import NavBar from '../../commons/NavBar';
32
32
  import WrapParallaxScrollView from '../../commons/WrapParallaxScrollView';
@@ -40,6 +40,7 @@ import SubUnitAutomate from '../../commons/SubUnit/OneTap';
40
40
  import SubUnitFavorites from '../../commons/SubUnit/Favorites';
41
41
  import {
42
42
  AUTOMATE_TYPE,
43
+ Constants,
43
44
  NOTIFICATION_TYPES,
44
45
  TESTID,
45
46
  } from '../../configs/Constants';
@@ -48,9 +49,12 @@ import {
48
49
  unwatchNotificationData,
49
50
  } from '../../utils/Monitor';
50
51
  import PreventAccess from '../../commons/PreventAccess';
52
+ import MediaPlayerDetail from '../../commons/MediaPlayerDetail';
51
53
 
52
54
  const UnitDetail = ({ route }) => {
53
55
  const t = useTranslations();
56
+ const { setAction } = useContext(SCContext);
57
+ const isIOS = useMemo(() => Platform.OS === 'ios', []);
54
58
 
55
59
  const {
56
60
  unitId,
@@ -63,7 +67,6 @@ const UnitDetail = ({ route }) => {
63
67
  } = route.params;
64
68
 
65
69
  const isFocused = useIsFocused();
66
- const { stateData, setAction } = useContext(SCContext);
67
70
  const { navigate, goBack } = useNavigation();
68
71
  const RouterHardware = useCallback(
69
72
  (routeHardware) => () => {
@@ -76,15 +79,14 @@ const UnitDetail = ({ route }) => {
76
79
  isSuccessfullyConnected ? RouterHardware(Routes.Dashboard) : goBack
77
80
  );
78
81
  const user = useSCContextSelector((state) => state?.auth?.account?.user);
79
- const isLavidaSource = useSCContextSelector(
80
- (state) => state.app.isLavidaSource
82
+ const { isLavidaSource, isFirstOpenCamera } = useSCContextSelector(
83
+ (state) => state.app
81
84
  );
82
85
 
83
86
  const [unit, setUnit] = useState(unitData || { id: unitId });
84
87
  const [listMenuItem, setListMenuItem] = useState([]);
85
88
  const [listStation, setListStation] = useState([]);
86
89
  const [listAutomate, setListAutomate] = useState([]);
87
- const [isGGHomeConnected, setIsGGHomeConnected] = useState(false);
88
90
  const [station, setStation] = useState({});
89
91
  const [indexStation, setIndexStation] = useState(0);
90
92
  const [showAdd, setShowAdd, setHideAdd] = useBoolean();
@@ -191,61 +193,9 @@ const UnitDetail = ({ route }) => {
191
193
  };
192
194
  }, [fetchDetails]);
193
195
 
194
- const handleGoogleHomeConnect = useCallback(
195
- async (options) => {
196
- let isConnected = await googleHomeConnect(options); // this may wrong if have multiple connection
197
- setIsGGHomeConnected(isConnected);
198
- let chipId = options[0].chip_id;
199
- if (!isConnected) {
200
- setAction(Action.LIST_DEVICE_TYPES, {
201
- chipId: chipId,
202
- sentEmail: true,
203
- });
204
- await axiosPost(API.GOOGLE_HOME.CHECK_SEND_EMAIL(), {
205
- chip_id: chipId,
206
- is_connected: false,
207
- });
208
- } else if (isConnected && stateData?.listDevice[chipId]?.sentEmail) {
209
- setAction(Action.LIST_DEVICE_TYPES, {
210
- chipId: chipId,
211
- sentEmail: false,
212
- });
213
- await axiosPost(API.GOOGLE_HOME.CHECK_SEND_EMAIL(), {
214
- chip_id: chipId,
215
- is_connected: true,
216
- });
217
- }
218
- },
219
- // eslint-disable-next-line react-hooks/exhaustive-deps
220
- []
221
- );
196
+ useValueEvaluations(unitId);
222
197
 
223
- let isCalled = false;
224
-
225
- const handleLgThinqConnect = useCallback(async (options) => {
226
- if (isCalled) {
227
- return;
228
- }
229
- // eslint-disable-next-line react-hooks/exhaustive-deps
230
- isCalled = true;
231
- await lgThinqConnect(options);
232
- }, []);
233
-
234
- useEffect(() => {
235
- if (unit.remote_control_options) {
236
- if (unit.remote_control_options.bluetooth) {
237
- scanBluetoothDevices(unit.remote_control_options.bluetooth);
238
- }
239
- if (unit.remote_control_options.googlehome?.length) {
240
- handleGoogleHomeConnect(unit.remote_control_options.googlehome);
241
- }
242
- if (unit.remote_control_options.lg_thinq) {
243
- (async () => {
244
- await handleLgThinqConnect(unit.remote_control_options.lg_thinq);
245
- })();
246
- }
247
- }
248
- }, [handleGoogleHomeConnect, handleLgThinqConnect, unit]);
198
+ useUnitConnectRemoteDevices(unit);
249
199
 
250
200
  useEffect(() => {
251
201
  if (isFocused) {
@@ -264,7 +214,7 @@ const UnitDetail = ({ route }) => {
264
214
  setListMenuItem(listMenu);
265
215
  setListStation(listMenu.concat([{ text: '' }]));
266
216
  }
267
- }, [unit, indexStation, isGGHomeConnected]);
217
+ }, [unit, indexStation]);
268
218
 
269
219
  useEffect(() => {
270
220
  isOneTap && setIndexStation(1);
@@ -308,7 +258,6 @@ const UnitDetail = ({ route }) => {
308
258
  favoriteDevices={favoriteDevices}
309
259
  favoriteAutomates={favoriteAutomates}
310
260
  wrapItemStyle={styles.wrapItemStyle}
311
- isGGHomeConnected={isGGHomeConnected}
312
261
  />
313
262
  );
314
263
  }
@@ -330,13 +279,7 @@ const UnitDetail = ({ route }) => {
330
279
  />
331
280
  );
332
281
  } else if (station) {
333
- return (
334
- <ShortDetailSubUnit
335
- unit={unit}
336
- station={station}
337
- isGGHomeConnected={isGGHomeConnected}
338
- />
339
- );
282
+ return <ShortDetailSubUnit unit={unit} station={station} />;
340
283
  }
341
284
  };
342
285
 
@@ -353,6 +296,15 @@ const UnitDetail = ({ route }) => {
353
296
  return () => unwatchNotificationData(user);
354
297
  }, [user, onRefresh]);
355
298
 
299
+ useEffect(() => {
300
+ if (isFirstOpenCamera && isIOS) {
301
+ const to = setTimeout(() => {
302
+ setAction(Action.IS_FIRST_OPEN_CAMERA, false);
303
+ clearTimeout(to);
304
+ }, 3000);
305
+ }
306
+ }, [isFirstOpenCamera, isIOS, setAction]);
307
+
356
308
  return (
357
309
  <WrapParallaxScrollView
358
310
  uriImg={unit.background}
@@ -367,6 +319,17 @@ const UnitDetail = ({ route }) => {
367
319
  hideRightPlus={!isOwner}
368
320
  onBack={(isSuccessfullyConnected && Dashboard) || (routeName && onBack)}
369
321
  >
322
+ {/* NOTE: This is a trick to fix camera not full screen on first open app */}
323
+ {isFirstOpenCamera && isIOS && (
324
+ <MediaPlayerDetail
325
+ uri={Constants.URL_STREAM_CAMERA_DEMO}
326
+ isPaused={false}
327
+ width={1}
328
+ height={1}
329
+ style={styles.fakeCamera}
330
+ />
331
+ )}
332
+
370
333
  <View style={styles.container}>
371
334
  <Summaries unit={unit} />
372
335
  <NavBar
@@ -383,7 +346,6 @@ const UnitDetail = ({ route }) => {
383
346
  </View>
384
347
  )}
385
348
  </View>
386
-
387
349
  <AddMenu
388
350
  unit={unit}
389
351
  afterItemClick={hidePopover}
@@ -105,6 +105,7 @@ const ManageUnit = ({ route }) => {
105
105
  formData,
106
106
  headers
107
107
  );
108
+
108
109
  if (success) {
109
110
  setUnitData({ ...data });
110
111
  ToastBottomHelper.success(t('unit_updated_successfully'));
@@ -1,9 +1,10 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
1
  import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
3
2
  import { TouchableOpacity, View, ScrollView } from 'react-native';
4
3
  import MapView, { Marker, Circle, PROVIDER_GOOGLE } from 'react-native-maps';
5
4
  import { useNavigation } from '@react-navigation/native';
6
5
  import { IconOutline, IconFill } from '@ant-design/icons-react-native';
6
+ import { check, RESULTS } from 'react-native-permissions';
7
+ import { openPromptEnableLocation } from '../../utils/Setting/Location';
7
8
 
8
9
  import BottomButtonView from '../../commons/BottomButtonView';
9
10
  import SearchBarLocation from '../../commons/SearchLocation';
@@ -11,22 +12,23 @@ import RowLocation from '../../commons/SearchLocation/RowLocation';
11
12
  import Text from '../../commons/Text';
12
13
  import { FullLoading } from '../../commons';
13
14
  import { useTranslations } from '../../hooks/Common/useTranslations';
14
-
15
- navigator.geolocation = require('@react-native-community/geolocation');
15
+ import {
16
+ GEOLOCATION_ERROR,
17
+ keyPermission,
18
+ OpenSetting,
19
+ } from '../../utils/Permission/common';
16
20
 
17
21
  import styles from './SelectAddressStyles';
18
22
  import { API, Colors, SCConfig } from '../../configs';
19
23
  import { axiosGet } from '../../utils/Apis/axios';
20
24
  import Routes from '../../utils/Route';
21
- import { TESTID } from '../../configs/Constants';
25
+ import {
26
+ TESTID,
27
+ MAP_INITIAL_REGION,
28
+ EOH_LOCATION,
29
+ } from '../../configs/Constants';
22
30
 
23
- const initialRegion = {
24
- latitudeDelta: 0.0922,
25
- longitudeDelta: 0.0421,
26
- };
27
-
28
- const DEFAULT_LATITUDE = 10.7974046; // EoH center
29
- const DEFAULT_LONGITUDE = 106.7035663;
31
+ navigator.geolocation = require('@react-native-community/geolocation');
30
32
 
31
33
  const SelectAddress = memo(({ route }) => {
32
34
  const t = useTranslations();
@@ -46,9 +48,9 @@ const SelectAddress = memo(({ route }) => {
46
48
  goBack();
47
49
  }, [goBack, updateLocation, searchedLocation]);
48
50
 
49
- const onTextInput = useCallback(async (input) => {
50
- setInput(input);
51
- if (input === '') {
51
+ const onTextInput = useCallback(async (value) => {
52
+ setInput(value);
53
+ if (value === '') {
52
54
  setSearchData([]);
53
55
  setSearchedLocation(null);
54
56
  return;
@@ -56,7 +58,7 @@ const SelectAddress = memo(({ route }) => {
56
58
  try {
57
59
  const config = {
58
60
  params: {
59
- input: input,
61
+ input: value,
60
62
  key: SCConfig.GOOGLE_MAP_API_KEY,
61
63
  sessiontoken: 123456324,
62
64
  strictBounds: false,
@@ -68,9 +70,8 @@ const SelectAddress = memo(({ route }) => {
68
70
  API.EXTERNAL.GOOGLE_MAP.AUTO_COMPLETE,
69
71
  config
70
72
  );
71
- if (success) {
72
- setSearchData(data.predictions);
73
- }
73
+ success && setSearchData(data.predictions);
74
+ // eslint-disable-next-line no-empty
74
75
  } catch (error) {}
75
76
  }, []);
76
77
 
@@ -83,7 +84,8 @@ const SelectAddress = memo(({ route }) => {
83
84
  {
84
85
  latitude: lat,
85
86
  longitude: lng,
86
- ...initialRegion,
87
+ latitudeDelta: MAP_INITIAL_REGION.LAT,
88
+ longitudeDelta: MAP_INITIAL_REGION.LNG,
87
89
  },
88
90
  600
89
91
  );
@@ -140,10 +142,24 @@ const SelectAddress = memo(({ route }) => {
140
142
  setLoading(false);
141
143
  },
142
144
  // eslint-disable-next-line promise/prefer-await-to-callbacks
143
- (error) => {}
144
- // { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 } enable on emulator
145
+ async (error) => {
146
+ if (error.code === GEOLOCATION_ERROR.PERMISSION_DENIED) {
147
+ const permissionResult = await check(keyPermission.LOCATION);
148
+ permissionResult === RESULTS.BLOCKED &&
149
+ OpenSetting(
150
+ t('location_rationale_title'),
151
+ t('location_require_message')
152
+ );
153
+ } else if (error.code === GEOLOCATION_ERROR.POSITION_UNAVAILABLE) {
154
+ const locationEnabaled = await openPromptEnableLocation();
155
+ process.env.NODE_ENV !== 'test' &&
156
+ locationEnabaled &&
157
+ getCurrentPosition();
158
+ }
159
+ }
160
+ // { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 } // enable on emulator
145
161
  );
146
- }, []);
162
+ }, [t]);
147
163
 
148
164
  const chooseOnMap = useCallback(() => {
149
165
  navigate(Routes.ChooseLocation, {
@@ -163,7 +179,10 @@ const SelectAddress = memo(({ route }) => {
163
179
  <View style={styles.wrap}>
164
180
  <View style={styles.searchLocation}>
165
181
  <SearchBarLocation input={input} onTextInput={onTextInput} />
166
- <ScrollView style={styles.searchData}>
182
+ <ScrollView
183
+ style={styles.searchData}
184
+ scrollIndicatorInsets={{ right: 1 }}
185
+ >
167
186
  {searchData.map((item, index) => (
168
187
  <RowLocation key={index} item={item} onPress={onPressRowLocation} />
169
188
  ))}
@@ -199,9 +218,10 @@ const SelectAddress = memo(({ route }) => {
199
218
  provider={PROVIDER_GOOGLE}
200
219
  style={styles.mapView}
201
220
  initialRegion={{
202
- ...initialRegion,
203
- latitude: DEFAULT_LATITUDE,
204
- longitude: DEFAULT_LONGITUDE,
221
+ latitude: EOH_LOCATION.LAT,
222
+ longitude: EOH_LOCATION.LNG,
223
+ latitudeDelta: MAP_INITIAL_REGION.LAT,
224
+ longitudeDelta: MAP_INITIAL_REGION.LNG,
205
225
  }}
206
226
  followUserLocation={true}
207
227
  >
@@ -0,0 +1,158 @@
1
+ import React, {
2
+ memo,
3
+ useState,
4
+ useEffect,
5
+ useCallback,
6
+ useMemo,
7
+ useContext,
8
+ } from 'react';
9
+ import { View, ScrollView, TouchableOpacity } from 'react-native';
10
+ import { useNavigation } from '@react-navigation/native';
11
+ import { Icon } from '@ant-design/react-native';
12
+ import { HeaderCustom } from '../../commons/Header';
13
+ import Text from '../../commons/Text';
14
+ import NavBar from '../../commons/NavBar';
15
+ import BottomButtonView from '../../commons/BottomButtonView';
16
+ import { FullLoading } from '../../commons';
17
+ import Device from '../AddNewAction/Device';
18
+ import { useTranslations } from '../../hooks/Common/useTranslations';
19
+ import { SCContext } from '../../context';
20
+ import { Action } from '../../context/actionType';
21
+ import { axiosGet, axiosPost } from '../../utils/Apis/axios';
22
+ import { API, Colors } from '../../configs';
23
+ import styles from './SelectDevicesStyles';
24
+
25
+ const SelectDevices = memo(({ route }) => {
26
+ const t = useTranslations();
27
+ const { goBack } = useNavigation();
28
+ const { unitId } = route.params;
29
+ const { setAction } = useContext(SCContext);
30
+ const [listStation, setListStation] = useState([]);
31
+ const [listMenuItem, setListMenuItem] = useState([]);
32
+ const [indexStation, setIndexStation] = useState(0);
33
+ const [stations, setStations] = useState([]);
34
+ const [selectedIds, setSelectedIds] = useState([]);
35
+ const [loading, setLoading] = useState(false);
36
+
37
+ const fetchData = useCallback(async () => {
38
+ setLoading(true);
39
+ const { success, data } = await axiosGet(API.UNIT.DEVICES(unitId));
40
+ if (success) {
41
+ const newData = data.filter((item) => item.devices.length > 0);
42
+ const listMenu = newData.map((item, index) => ({
43
+ text: item.name,
44
+ station: item,
45
+ index: index,
46
+ }));
47
+ setStations(newData);
48
+ setListMenuItem(listMenu);
49
+ setListStation(listMenu);
50
+ }
51
+ setLoading(false);
52
+ }, [unitId]);
53
+
54
+ const addDevicesToFavorites = useCallback(async () => {
55
+ if (selectedIds.length === 0) {
56
+ return;
57
+ }
58
+ setLoading(true);
59
+ const { success } = await axiosPost(
60
+ API.UNIT.ADD_DEVICES_TO_FAVORITES(unitId),
61
+ {
62
+ devices: selectedIds,
63
+ }
64
+ );
65
+ if (success) {
66
+ setAction(Action.ADD_DEVICES_TO_FAVORITES, selectedIds);
67
+ goBack();
68
+ }
69
+ setLoading(false);
70
+ }, [unitId, selectedIds, setAction, goBack]);
71
+
72
+ useEffect(() => {
73
+ fetchData();
74
+ }, [fetchData]);
75
+
76
+ const onSnapToItem = useCallback(
77
+ (item, index) => {
78
+ setIndexStation(index);
79
+ },
80
+ // eslint-disable-next-line react-hooks/exhaustive-deps
81
+ [unitId, indexStation]
82
+ );
83
+
84
+ const onSelectDevice = useCallback(
85
+ (device) => {
86
+ setSelectedIds((ids) => {
87
+ const index = ids.indexOf(device.id);
88
+ if (index !== -1) {
89
+ return ids.filter((id) => id !== device.id);
90
+ }
91
+ return [...ids, device.id];
92
+ });
93
+ },
94
+ [setSelectedIds]
95
+ );
96
+
97
+ const rightComponent = useMemo(
98
+ () => (
99
+ <TouchableOpacity style={styles.buttonClose} onPress={goBack}>
100
+ <Icon name={'close'} size={24} color={Colors.Black} />
101
+ </TouchableOpacity>
102
+ ),
103
+ // eslint-disable-next-line react-hooks/exhaustive-deps
104
+ []
105
+ );
106
+
107
+ return (
108
+ <View style={styles.wrap}>
109
+ <HeaderCustom rightComponent={rightComponent} />
110
+ <ScrollView
111
+ style={styles.wrap}
112
+ contentContainerStyle={styles.contentContainerStyle}
113
+ scrollIndicatorInsets={{ right: 1 }}
114
+ >
115
+ <Text bold type="H2" style={styles.title}>
116
+ {t('select_device')}
117
+ </Text>
118
+
119
+ {listStation.length ? (
120
+ <NavBar
121
+ listStation={listStation}
122
+ listMenuItem={listMenuItem}
123
+ onSnapToItem={onSnapToItem}
124
+ indexStation={indexStation}
125
+ style={styles.navbar}
126
+ />
127
+ ) : (
128
+ <View style={styles.noneData}>
129
+ <Text center>{t('text_unit_add_to_favorites_no_devices')}</Text>
130
+ </View>
131
+ )}
132
+
133
+ <View style={styles.boxDevices}>
134
+ {stations[indexStation]?.devices &&
135
+ stations[indexStation].devices.map((device) => (
136
+ <Device
137
+ svgMain={device.icon || 'sensor'}
138
+ title={device.name}
139
+ sensor={device}
140
+ isSelectDevice={selectedIds.includes(device.id)}
141
+ onPress={onSelectDevice}
142
+ />
143
+ ))}
144
+ </View>
145
+ </ScrollView>
146
+
147
+ <BottomButtonView
148
+ style={styles.bottomButtonView}
149
+ mainTitle={t('done')}
150
+ onPressMain={addDevicesToFavorites}
151
+ typeMain={selectedIds.length === 0 ? 'disabled' : 'primary'}
152
+ />
153
+ {loading && <FullLoading />}
154
+ </View>
155
+ );
156
+ });
157
+
158
+ export default SelectDevices;
@@ -0,0 +1,40 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { getBottomSpace } from 'react-native-iphone-x-helper';
3
+ import { Colors, Constants } from '../../configs';
4
+
5
+ export default StyleSheet.create({
6
+ wrap: {
7
+ flex: 1,
8
+ backgroundColor: Colors.White,
9
+ },
10
+ contentContainerStyle: {
11
+ paddingBottom: getBottomSpace() + 100,
12
+ },
13
+ navbar: {
14
+ paddingTop: 16,
15
+ },
16
+ title: {
17
+ marginHorizontal: 16,
18
+ },
19
+ boxDevices: {
20
+ flexWrap: 'wrap',
21
+ flexDirection: 'row',
22
+ marginTop: 22,
23
+ justifyContent: 'space-between',
24
+ paddingLeft: 16,
25
+ paddingRight: 16,
26
+ },
27
+
28
+ bottomButtonView: {
29
+ paddingTop: 24,
30
+ paddingBottom: 32,
31
+
32
+ backgroundColor: Colors.White,
33
+ borderColor: Colors.ShadownTransparent,
34
+ borderTopWidth: 1,
35
+ },
36
+ noneData: {
37
+ paddingHorizontal: 16,
38
+ marginTop: Constants.height * 0.3,
39
+ },
40
+ });
@@ -29,13 +29,13 @@ const ListSmartAccount = ({ route }) => {
29
29
  const [loadingRemoveItem, setLoadingRemoveItem] = useState(false);
30
30
 
31
31
  const getAllSmartAccounts = useCallback(async () => {
32
- const { success, data } = await axiosGet(
33
- API.SMART_ACCOUNT.LIST_SMART_ACCOUNT()
32
+ const { success, data: accountData } = await axiosGet(
33
+ API.SMART_ACCOUNT.LIST_SMART_ACCOUNT(unitId)
34
34
  );
35
35
  if (success) {
36
- setData(data);
36
+ setData(accountData);
37
37
  }
38
- }, []);
38
+ }, [unitId]);
39
39
 
40
40
  const { childRef, showingPopover, showPopoverWithRef, hidePopover } =
41
41
  usePopover();
@@ -1,5 +1,6 @@
1
1
  import React, { memo, useEffect, useRef, useState } from 'react';
2
2
  import { View, Text, TouchableOpacity, FlatList } from 'react-native';
3
+ import { TESTID } from '../../../configs/Constants';
3
4
  import styles from './StationStyles';
4
5
 
5
6
  const Station = ({ listStation = [], onSnapToItem, indexStation }) => {
@@ -23,6 +24,7 @@ const Station = ({ listStation = [], onSnapToItem, indexStation }) => {
23
24
  key={index}
24
25
  style={styles.wrapTitle}
25
26
  onPress={handleOnSnapToItem(item, index)}
27
+ testID={`${TESTID.SUB_UNIT_NAME}-${item?.station?.id}`}
26
28
  >
27
29
  <Text
28
30
  style={[styles.title, index === indexStation && styles.titleActive]}
@@ -70,6 +72,8 @@ const Station = ({ listStation = [], onSnapToItem, indexStation }) => {
70
72
  extraData={data}
71
73
  renderItem={renderItem}
72
74
  showsHorizontalScrollIndicator={false}
75
+ scrollIndicatorInsets={{ right: 1 }}
76
+ testID={TESTID.NAV_LIST}
73
77
  />
74
78
  </View>
75
79
  );