@eohjsc/react-native-smart-city 0.6.2-rc9 → 0.7.0

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 (304) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +10 -19
  3. package/package.json +53 -70
  4. package/src/commons/Action/__test__/ItemQuickAction.test.js +2 -2
  5. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
  6. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +3 -3
  7. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +2 -2
  8. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +3 -3
  9. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
  10. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
  11. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +0 -15
  12. package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
  13. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
  14. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +2 -2
  15. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +5 -5
  16. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +5 -5
  17. package/src/commons/ActionGroup/TerminalBoxTemplate.js +2 -2
  18. package/src/commons/ActionGroup/TextBoxTemplate.js +2 -2
  19. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonTemplate.test.js +4 -4
  20. package/src/commons/ActionGroup/TimerActionTemplate.js +4 -5
  21. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
  22. package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +4 -9
  23. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +2 -9
  24. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +4 -11
  25. package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +2 -9
  26. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +4 -18
  27. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +2 -2
  28. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +1 -8
  29. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +0 -7
  30. package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +4 -15
  31. package/src/commons/ActionGroup/__test__/TerminalBoxTemplate.test.js +0 -7
  32. package/src/commons/ActionGroup/__test__/TextBoxTemplate.test.js +1 -8
  33. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +8 -15
  34. package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +2 -10
  35. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +3 -20
  36. package/src/commons/ActionGroup/__test__/index.test.js +15 -23
  37. package/src/commons/ActionTemplate/__test__/index.test.js +2 -0
  38. package/src/commons/ActionTemplate/__test__/utils.js +21 -0
  39. package/src/commons/ActionTemplate/index.js +1 -2
  40. package/src/commons/BackDefault/index.js +2 -2
  41. package/src/commons/ButtonPopup/index.js +2 -2
  42. package/src/commons/Calendar/__test__/Calendar.test.js +0 -7
  43. package/src/commons/CircleButton/__test__/CircleButton.test.js +2 -2
  44. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +11 -25
  45. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +27 -20
  46. package/src/commons/Dashboard/MyUnit/index.js +0 -1
  47. package/src/commons/DateTimeRangeChange/DateTimeButton.js +2 -2
  48. package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -4
  49. package/src/commons/DateTimeRangeChange/index.js +2 -2
  50. package/src/commons/Device/ConnectedViewHeader.js +2 -2
  51. package/src/commons/Device/DisconnectedView.js +2 -2
  52. package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
  53. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +2 -2
  54. package/src/commons/Device/FlatListItems.js +3 -3
  55. package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
  56. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -11
  57. package/src/commons/Device/ItemAddNew/index.js +2 -2
  58. package/src/commons/Device/ItemDevice.js +2 -2
  59. package/src/commons/Device/SonosSpeaker/index.js +3 -3
  60. package/src/commons/Device/WaterPurifierStatus/AlertStatusMachine.js +2 -2
  61. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +2 -6
  62. package/src/commons/DisplayChecking/index.js +2 -2
  63. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
  64. package/src/commons/EmergencyButton/AlertSent.js +6 -2
  65. package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
  66. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +5 -5
  67. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +9 -9
  68. package/src/commons/Form/CurrencyInput.js +1 -15
  69. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +1 -22
  70. package/src/commons/Header/HeaderCustom.js +8 -3
  71. package/src/commons/HeaderAni/index.js +2 -2
  72. package/src/commons/IconComponent/index.js +3 -3
  73. package/src/commons/MediaPlayerDetail/MediaPlayerFull.js +1 -1
  74. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerFull.test.js +12 -48
  75. package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +1 -1
  76. package/src/commons/MenuActionList/__test__/MenuActionList.test.js +1 -0
  77. package/src/commons/NavBar/index.js +2 -2
  78. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
  79. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +1 -13
  80. package/src/commons/Processing/__test__/Connecting.test.js +3 -14
  81. package/src/commons/SearchLocation/index.js +3 -3
  82. package/src/commons/SelectActionCard/index.js +2 -2
  83. package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -18
  84. package/src/commons/SelectSubUnit/index.js +2 -2
  85. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +1 -13
  86. package/src/commons/Sharing/BtnRemoveMember.js +2 -2
  87. package/src/commons/Sharing/StationDevicePermissions.js +2 -2
  88. package/src/commons/Sharing/WrapHeaderScrollable.js +1 -1
  89. package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +2 -2
  90. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -1
  91. package/src/commons/SubUnit/DeviceTemplate/ConfigAndEvaluation/ConfigAndEvaluation.js +2 -2
  92. package/src/commons/SubUnit/DeviceTemplate/ConfigValue/ConfigValue.js +2 -2
  93. package/src/commons/SubUnit/DeviceTemplate/EvaluationOverConfig/EvaluationOverConfig.js +2 -2
  94. package/src/commons/SubUnit/Item/index.js +3 -3
  95. package/src/commons/SubUnit/OneTap/ItemOneTap.js +2 -2
  96. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +11 -8
  97. package/src/commons/SubUnit/__test__/Favorites.test.js +1 -13
  98. package/src/commons/SubUnit/__test__/ShortDetail.test.js +5 -16
  99. package/src/commons/SummaryItem/index.js +22 -23
  100. package/src/commons/Tabbar/__test__/index.test.js +0 -11
  101. package/src/commons/Unit/HeaderUnit/index.js +84 -84
  102. package/src/commons/Unit/SharedUnit.js +7 -7
  103. package/src/commons/Unit/__test__/HeaderUnit.test.js +29 -52
  104. package/src/commons/Unit/__test__/SharedUnit.test.js +94 -105
  105. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +11 -30
  106. package/src/commons/WrapParallaxScrollView/index.js +21 -50
  107. package/src/configs/API.js +1 -2
  108. package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +4 -15
  109. package/src/hooks/Common/useIsOwnerOfUnit.js +1 -1
  110. package/src/hooks/IoT/__test__/useRemoteControl.test.js +1 -1
  111. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +6 -21
  112. package/src/iot/RemoteControl/HomeAssistant.js +1 -1
  113. package/src/iot/RemoteControl/__test__/Bluetooth.test.js +234 -232
  114. package/src/navigations/AutomateStack.js +2 -2
  115. package/src/navigations/EmergencyContactsStack.js +2 -2
  116. package/src/navigations/SharedStack.js +6 -4
  117. package/src/navigations/UnitStack.js +2 -10
  118. package/src/screens/ActivityLog/hooks/index.js +7 -4
  119. package/src/screens/ActivityLog/index.js +2 -2
  120. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +4 -21
  121. package/src/screens/AddCommon/__test__/SelectUnit.test.js +7 -19
  122. package/src/screens/AddLocationMaps/__test__/index.test.js +3 -13
  123. package/src/screens/AddLocationMaps/index.js +11 -6
  124. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +3 -20
  125. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +11 -18
  126. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +4 -21
  127. package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
  128. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +3 -3
  129. package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +0 -17
  130. package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +4 -19
  131. package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +3 -15
  132. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +31 -51
  133. package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +9 -22
  134. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +12 -19
  135. package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +6 -16
  136. package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +4 -15
  137. package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +3 -3
  138. package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +18 -10
  139. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +1 -1
  140. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +12 -9
  141. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +12 -9
  142. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +7 -21
  143. package/src/screens/AllGateway/DetailConfigActionInternal/__test__/index.test.js +0 -20
  144. package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +7 -24
  145. package/src/screens/AllGateway/DeviceGatewayInfo/__test__/index.test.js +0 -17
  146. package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +84 -100
  147. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +64 -82
  148. package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +36 -55
  149. package/src/screens/AllGateway/GatewayConnectionMethods/__test__/index.test.js +9 -18
  150. package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +10 -37
  151. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +7 -32
  152. package/src/screens/AllGateway/__test__/index.test.js +1 -14
  153. package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +0 -12
  154. package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +1 -13
  155. package/src/screens/AllGateway/components/TabPaneCT/index.js +1 -1
  156. package/src/screens/AllGateway/hooks/__test__/index.test.js +1 -8
  157. package/src/screens/AllGateway/test-utils.js +1 -1
  158. package/src/screens/Automate/AddNewAction/NewActionWrapper.js +2 -2
  159. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +27 -28
  160. package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +3 -3
  161. package/src/screens/Automate/AddNewAction/__test__/ChooseConfig.test.js +8 -5
  162. package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +2 -2
  163. package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +1 -18
  164. package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +17 -15
  165. package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +4 -4
  166. package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +38 -55
  167. package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +0 -18
  168. package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +1 -19
  169. package/src/screens/Automate/EditActionsList/__tests__/index.test.js +14 -11
  170. package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +3 -3
  171. package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +2 -2
  172. package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +2 -2
  173. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +33 -25
  174. package/src/screens/Automate/ScriptDetail/index.js +6 -6
  175. package/src/screens/Automate/SetSchedule/__test__/index.test.js +4 -4
  176. package/src/screens/Automate/SetSchedule/components/RowItem.js +3 -3
  177. package/src/screens/Automate/__test__/MultiUnits.test.js +7 -7
  178. package/src/screens/Automate/__test__/index.test.js +6 -6
  179. package/src/screens/Automate/index.js +2 -2
  180. package/src/screens/ChangePosition/__test__/index.test.js +1 -14
  181. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +1 -23
  182. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +1 -11
  183. package/src/screens/Device/EditDevice/index.js +2 -2
  184. package/src/screens/Device/__test__/detail.test.js +11 -11
  185. package/src/screens/Device/__test__/sensorDisplayItem.test.js +0 -12
  186. package/src/screens/Device/detail.js +14 -12
  187. package/src/screens/Drawer/Drawer.test.js +3 -11
  188. package/src/screens/Drawer/index.js +3 -4
  189. package/src/screens/EmergencyContacts/EmergencyContactsList.js +4 -8
  190. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
  191. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +4 -17
  192. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +3 -14
  193. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +0 -10
  194. package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
  195. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +4 -17
  196. package/src/screens/GuestInfo/__test__/index.test.js +0 -11
  197. package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
  198. package/src/screens/GuestInfo/index.js +2 -2
  199. package/src/screens/HanetCamera/Detail.js +6 -2
  200. package/src/screens/HanetCamera/ManageAccess.js +3 -4
  201. package/src/screens/HanetCamera/MemberInfo.js +4 -4
  202. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +2 -16
  203. package/src/screens/HanetCamera/__test__/Detail.test.js +1 -12
  204. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +5 -16
  205. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +5 -18
  206. package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
  207. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +3 -19
  208. package/src/screens/ManageAccess/index.js +3 -3
  209. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +7 -7
  210. package/src/screens/Notification/__test__/Notification.test.js +5 -15
  211. package/src/screens/Notification/__test__/NotificationItem.test.js +9 -19
  212. package/src/screens/Notification/index.js +5 -5
  213. package/src/screens/PlayBackCamera/__test__/index.test.js +13 -22
  214. package/src/screens/PlayBackCamera/index.js +2 -2
  215. package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +0 -11
  216. package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
  217. package/src/screens/SelectUnit/__test__/index.test.js +9 -29
  218. package/src/screens/SelectUnit/index.js +2 -2
  219. package/src/screens/SharedUnit/TabHeader.js +2 -2
  220. package/src/screens/Sharing/Components/EndDevice.js +3 -3
  221. package/src/screens/Sharing/SelectUser.js +5 -4
  222. package/src/screens/Sharing/UnitMemberList.js +7 -6
  223. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +9 -4
  224. package/src/screens/Sharing/__test__/SelectShareDevice.test.js +2 -15
  225. package/src/screens/Sharing/__test__/SelectUser.test.js +2 -22
  226. package/src/screens/Sharing/__test__/UnitMemberList.test.js +2 -2
  227. package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +4 -17
  228. package/src/screens/Sharing/hooks/__test__/index.test.js +2 -13
  229. package/src/screens/SmartAccount/Connecting/index.js +0 -2
  230. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +3 -18
  231. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +11 -21
  232. package/src/screens/SmartAccount/SuccessfullyConnected/index.js +3 -4
  233. package/src/screens/SmartAccount/__test__/Connecting.test.js +30 -36
  234. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +12 -21
  235. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +8 -17
  236. package/src/screens/SmartIr/__test__/SelectBrand.test.js +1 -11
  237. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +1 -12
  238. package/src/screens/SmartIr/__test__/SmartIr.test.js +3 -11
  239. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +6 -5
  240. package/src/screens/SmartIr/components/SelectBrand.js +2 -2
  241. package/src/screens/SubUnit/AddSubUnit.js +1 -0
  242. package/src/screens/SubUnit/EditSubUnit.js +3 -2
  243. package/src/screens/SubUnit/ManageSubUnit.js +5 -5
  244. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -31
  245. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +12 -30
  246. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -2
  247. package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +0 -12
  248. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -20
  249. package/src/screens/Template/__test__/EditTemplate.test.js +4 -15
  250. package/src/screens/Template/__test__/GatewayList.test.js +0 -9
  251. package/src/screens/Template/__test__/detail.test.js +8 -8
  252. package/src/screens/Template/__test__/index.test.js +3 -14
  253. package/src/screens/Template/detail.js +2 -2
  254. package/src/screens/Unit/Detail.js +12 -53
  255. package/src/screens/Unit/SelectAddToFavorites.js +2 -2
  256. package/src/screens/Unit/SelectAddress.js +9 -4
  257. package/src/screens/Unit/SmartAccountItem.js +2 -2
  258. package/src/screens/Unit/Station/__test__/index.test.js +2 -2
  259. package/src/screens/Unit/Summaries.js +24 -29
  260. package/src/screens/Unit/__test__/AddMenu.test.js +5 -2
  261. package/src/screens/Unit/__test__/CheckSendEmail.test.js +0 -12
  262. package/src/screens/Unit/__test__/ChooseLocation.test.js +1 -4
  263. package/src/screens/Unit/__test__/Detail.test.js +14 -12
  264. package/src/screens/Unit/__test__/ManageUnit.test.js +2 -17
  265. package/src/screens/Unit/__test__/MoreMenu.test.js +1 -11
  266. package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +3 -14
  267. package/src/screens/Unit/__test__/SelectAddress.test.js +4 -17
  268. package/src/screens/Unit/__test__/SmartAccount.test.js +14 -11
  269. package/src/screens/Unit/__test__/SmartAccountItem.test.js +0 -11
  270. package/src/screens/Unit/__test__/Summaries.test.js +2 -14
  271. package/src/screens/Unit/components/AutomateScript/index.js +2 -2
  272. package/src/screens/Unit/components/ButtonWrapper/index.js +3 -4
  273. package/src/screens/Unit/components/Header/index.js +5 -4
  274. package/src/screens/Unit/components/SharedUnit/index.js +5 -5
  275. package/src/screens/Unit/components/__test__/Header.test.js +1 -14
  276. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +1 -11
  277. package/src/screens/Unit/components/__test__/SharedUnit.test.js +1 -11
  278. package/src/screens/UnitSummary/__test__/index.test.js +51 -17
  279. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +8 -25
  280. package/src/screens/UnitSummary/components/AirQuality/__test__/index.test.js +1 -7
  281. package/src/screens/UnitSummary/components/AirQuality/index.js +8 -3
  282. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +0 -11
  283. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +1 -16
  284. package/src/screens/UnitSummary/components/Temperature/index.js +5 -1
  285. package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +0 -8
  286. package/src/screens/UnitSummary/components/UvIndex/index.js +6 -2
  287. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +2 -2
  288. package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +14 -18
  289. package/src/screens/UnitSummary/components/__test__/UnitSummary.test.js +8 -8
  290. package/src/screens/UnitSummary/index.js +4 -8
  291. package/src/utils/Converter/__test__/timer.test.js +8 -0
  292. package/src/utils/Functions/preloadImages.js +13 -14
  293. package/src/utils/Monitor.js +2 -3
  294. package/src/utils/Route/index.js +0 -1
  295. package/src/utils/Storage.js +1 -1
  296. package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +0 -48
  297. package/src/commons/Device/WindSpeed/LinearChart/index.js +0 -155
  298. package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +0 -27
  299. package/src/screens/AddNewGateway/hooks/index.js +0 -31
  300. package/src/screens/SubUnit/Detail.js +0 -150
  301. package/src/screens/SubUnit/__test__/Detail.test.js +0 -125
  302. package/src/screens/UnitSummary/components/Temperature/ChartAverage/index.js +0 -62
  303. package/src/screens/UnitSummary/components/Temperature/__test__/ChartAverage.test.js +0 -17
  304. package/src/utils/dateHelper/getTickValues.js +0 -22
@@ -19,7 +19,6 @@ const Routes = {
19
19
  EditSubUnit: 'EditSubUnit',
20
20
  Language: 'Language',
21
21
  SubUnit: 'SubUnit',
22
- SubUnitDetail: 'SubUnitDetail',
23
22
  DeviceDetail: 'DeviceDetail',
24
23
  HanetCameraStack: 'HanetCameraStack',
25
24
  HanetCameraDetail: 'HanetCameraDetail',
@@ -1,4 +1,4 @@
1
- import AsyncStorage from '@react-native-community/async-storage';
1
+ import AsyncStorage from '@react-native-async-storage/async-storage';
2
2
 
3
3
  export const STORAGE_KEY = {
4
4
  FIREBASE_APP_CONFIG: 'app_config',
@@ -1,48 +0,0 @@
1
- import React from 'react';
2
- import Svg from 'react-native-svg';
3
- import LinearChart from '../';
4
- import renderer, { act } from 'react-test-renderer';
5
- import { SCProvider } from '../../../../../context';
6
- import { mockSCStore } from '../../../../../context/mockStore';
7
-
8
- Date.now = jest.fn(() => 1487076708000);
9
-
10
- const wrapComponent = (chartOptions, datasShow) => (
11
- <SCProvider initState={mockSCStore({})}>
12
- <LinearChart chartOptions={chartOptions} datasShow={datasShow} />
13
- </SCProvider>
14
- );
15
-
16
- describe('Test LinearChart', () => {
17
- let wrapper;
18
-
19
- it('LinearChart render', async () => {
20
- const chartOptions = {
21
- showAll: true,
22
- };
23
- const datasShow = [
24
- {
25
- data: [
26
- {
27
- x: 0,
28
- y: 1,
29
- },
30
- {
31
- x: 1,
32
- y: 2,
33
- },
34
- {
35
- x: 2,
36
- y: 3,
37
- },
38
- ],
39
- },
40
- ];
41
- await act(async () => {
42
- wrapper = renderer.create(wrapComponent(chartOptions, datasShow));
43
- });
44
- const instance = wrapper.root;
45
- const Svgs = instance.findAllByType(Svg);
46
- expect(Svgs).toHaveLength(1);
47
- });
48
- });
@@ -1,155 +0,0 @@
1
- import React, { memo } from 'react';
2
- import Svg, { G } from 'react-native-svg';
3
- import {
4
- VictoryLine,
5
- VictoryAxis,
6
- VictoryScatter,
7
- VictoryTooltip,
8
- } from 'victory-native';
9
- import { useTranslations } from '../../../../hooks/Common/useTranslations';
10
-
11
- import { Colors } from '../../../../configs';
12
- import ChartLoading from '../../../ChartLoading';
13
- import ValueBalloon from '../../../Device/WindSpeed/LinearChart/ValueBalloon';
14
- import { getMaxValueIndex } from '../../../../utils/chartHelper/getMaxValueIndex';
15
- import getTickValues from '../../../../utils/dateHelper/getTickValues';
16
-
17
- const LinearChart = memo(
18
- ({
19
- startTime,
20
- endTime,
21
- datasShow,
22
- configuration,
23
- datasColor,
24
- chartOptions,
25
- }) => {
26
- const t = useTranslations();
27
- const datas = chartOptions.showAll
28
- ? datasShow
29
- : datasShow.filter((item, index) => index === chartOptions.index);
30
- if (!datasShow[0].data) {
31
- return <ChartLoading />;
32
- }
33
- if (!datasShow[0].data.length) {
34
- return <ChartLoading message={t('no_data')} />;
35
- }
36
- const chartTick = getTickValues(datas[0], configuration).stringArr;
37
- const maxValue = getMaxValueIndex(datas[0].data);
38
-
39
- return (
40
- <Svg width={'100%'} height={300} style>
41
- <G x={-12} y={-12}>
42
- <VictoryAxis
43
- dependentAxis
44
- domain={[0, maxValue.max.y * 1.2]}
45
- offsetX={50}
46
- orientation="left"
47
- standalone={false}
48
- style={styleVerticalAxis}
49
- />
50
- <VictoryAxis
51
- crossAxis
52
- scale="time"
53
- standalone={false}
54
- style={styleHorizontalAxis}
55
- tickValues={chartTick}
56
- />
57
- {datas.map((item, index) => {
58
- const tickValues = getTickValues(item).arr;
59
- const maxValueLine = getMaxValueIndex(item.data);
60
- return (
61
- <G key={index.toString()}>
62
- <VictoryLine
63
- data={item.data}
64
- domain={{
65
- x: [tickValues[0], tickValues[tickValues.length - 1]],
66
- y: [0, maxValueLine.max.y * 1.2],
67
- }}
68
- style={{
69
- data: { stroke: item.color },
70
- }}
71
- interpolation="monotoneX"
72
- scale={{ x: 'time', y: 'linear' }}
73
- standalone={false}
74
- />
75
- </G>
76
- );
77
- })}
78
- {datas.map((item, index) => {
79
- const scatterValues = getTickValues(item).stringDataArr;
80
- const maxValueLine = getMaxValueIndex(item.data);
81
- return (
82
- <G key={index}>
83
- <VictoryScatter
84
- standalone={false}
85
- data={scatterValues}
86
- labels={(datum) => {
87
- if (item.measure === 'pH') {
88
- return `${item.measure} ${datum.y.toString()}`;
89
- }
90
- return `${datum.y.toString()} ${item.measure}`;
91
- }}
92
- labelComponent={
93
- <VictoryTooltip
94
- flyoutComponent={<ValueBalloon />}
95
- renderInPortal={false}
96
- />
97
- }
98
- domain={{ y: [0, maxValueLine.max.y * 1.2] }}
99
- samples={25}
100
- size={5}
101
- style={{ ...styleScatter, data: { fill: item.color } }}
102
- />
103
- </G>
104
- );
105
- })}
106
- </G>
107
- </Svg>
108
- );
109
- }
110
- );
111
-
112
- export default LinearChart;
113
-
114
- const styleVerticalAxis = {
115
- axis: { stroke: Colors.Gray4, strokeWidth: 1 },
116
- ticks: {
117
- size: 5,
118
- stroke: 'black',
119
- strokeWidth: 0,
120
- },
121
- tickLabels: {
122
- fill: Colors.Gray8,
123
- fontFamily: 'SFProDisplay-Regular',
124
- fontSize: 10,
125
- },
126
- grid: {
127
- fill: 'none',
128
- stroke: Colors.Gray4,
129
- strokeDasharray: '5,5',
130
- pointerEvents: 'painted',
131
- },
132
- };
133
-
134
- const styleHorizontalAxis = {
135
- axis: { stroke: 'black', strokeWidth: 0 },
136
- ticks: {
137
- size: 10,
138
- stroke: 'black',
139
- strokeWidth: 0,
140
- },
141
- tickLabels: {
142
- fill: Colors.Gray8,
143
- fontFamily: 'SFProDisplay-Regular',
144
- fontSize: 10,
145
- },
146
- };
147
-
148
- const styleScatter = {
149
- labels: {
150
- fill: Colors.White,
151
- padding: 14,
152
- fontFamily: 'SFProDisplay-Regular',
153
- fontSize: 12,
154
- },
155
- };
@@ -1,27 +0,0 @@
1
- import { act, renderHook } from '@testing-library/react-hooks';
2
- import MockAdapter from 'axios-mock-adapter';
3
- import api from '../../../../utils/Apis/axios';
4
- import { useConnectGateway } from '..';
5
-
6
- import { API } from '../../../../configs';
7
-
8
- const mock = new MockAdapter(api.axiosInstance);
9
- jest.mock('@react-navigation/native', () => {
10
- return {
11
- ...jest.requireActual('@react-navigation/native'),
12
- useNavigation: () => ({
13
- dangerouslyGetParent: () => ({
14
- dangerouslyGetState: jest.fn(),
15
- }),
16
- }),
17
- };
18
- });
19
- describe('Test useHomeAssistantConnection', () => {
20
- it('test connectGoogleHome all connected', async () => {
21
- const { result } = renderHook(() => useConnectGateway(1));
22
- await act(async () => {
23
- await result.current.onPressDone();
24
- });
25
- mock.onGet(API.UNIT.UNIT_DETAIL(1)).reply(200, {});
26
- });
27
- });
@@ -1,31 +0,0 @@
1
- import { useCallback } from 'react';
2
- import { useNavigation } from '@react-navigation/native';
3
- import { axiosGet } from '../../../utils/Apis/axios';
4
- import { API } from '../../../configs';
5
-
6
- const useConnectGateway = (unit_id) => {
7
- const navigation = useNavigation();
8
-
9
- const fetchDetails = useCallback(async () => {
10
- const { success: fetchSuccess, data: unit } = await axiosGet(
11
- API.UNIT.UNIT_DETAIL(unit_id),
12
- {},
13
- true
14
- );
15
- return { fetchSuccess, unit };
16
- }, [unit_id]);
17
-
18
- const onPressDone = useCallback(async () => {
19
- const { fetchSuccess } = await fetchDetails();
20
- if (!fetchSuccess) {
21
- return;
22
- }
23
- navigation.dangerouslyGetParent().pop();
24
- }, [fetchDetails, navigation]);
25
-
26
- return {
27
- onPressDone,
28
- };
29
- };
30
-
31
- export { useConnectGateway };
@@ -1,150 +0,0 @@
1
- import React, { useCallback, useMemo } from 'react';
2
- import { View } from 'react-native';
3
- import { useNavigation } from '@react-navigation/native';
4
- import { get } from 'lodash';
5
- import { useTranslations } from '../../hooks/Common/useTranslations';
6
-
7
- import Routes from '../../utils/Route';
8
- import { usePopover } from '../../hooks/Common';
9
- import Text from '../../commons/Text';
10
- import ItemDevice from '../../commons/Device/ItemDevice';
11
- import WrapParallaxScrollView from '../../commons/WrapParallaxScrollView';
12
- import MediaPlayer from '../../commons/MediaPlayer';
13
- import { MenuActionMore } from '../../commons';
14
- import { useSCContextSelector } from '../../context';
15
- import styles from './DetailStyles';
16
-
17
- const SubUnitDetail = ({ route }) => {
18
- const t = useTranslations();
19
- const { unit, station } = route?.params || {};
20
- const language = useSCContextSelector((state) => state.language);
21
- const navigation = useNavigation();
22
- const { childRef, showingPopover, showPopoverWithRef, hidePopover } =
23
- usePopover();
24
-
25
- const currentUserId = useSCContextSelector((state) =>
26
- get(state, 'auth.account.user.id', 0)
27
- );
28
-
29
- const canManageSubUnit = useCallback(() => {
30
- return currentUserId === unit.user_id;
31
- }, [currentUserId, unit]);
32
- const stationState = station;
33
-
34
- const devices = stationState.sensors;
35
-
36
- const listMenuItem = useMemo(
37
- () => [
38
- {
39
- route: Routes.ManageSubUnit,
40
- data: { station: stationState },
41
- text: t('manage_sub_unit'),
42
- },
43
- ],
44
- // eslint-disable-next-line react-hooks/exhaustive-deps
45
- [stationState, language]
46
- );
47
-
48
- const onItemClick = useCallback(
49
- (routeName, data) => {
50
- hidePopover();
51
- routeName && navigation.navigate(routeName, data);
52
- },
53
- [navigation, hidePopover]
54
- );
55
-
56
- const onBack = useCallback(() => {
57
- const { routes } = navigation.dangerouslyGetParent().dangerouslyGetState();
58
- const calledByRoute = routes[routes.length - 1].name;
59
- if (calledByRoute === Routes.AddSubUnitStack) {
60
- // go from dashboard
61
- navigation.dangerouslyGetParent().pop(2);
62
- } else {
63
- navigation.pop(2);
64
- }
65
- }, [navigation]);
66
-
67
- const onItemClickAddMore = useCallback(
68
- (item) => {
69
- onItemClick(item.route, item.data);
70
- item.onPress && item.onPress();
71
- },
72
- [onItemClick]
73
- );
74
-
75
- const onAdd = useCallback(() => {
76
- navigation.navigate(Routes.AddGatewayStack, {
77
- screen: Routes.SelectDeviceType,
78
- params: {
79
- stationName: station.name,
80
- stationId: station.id,
81
- unit,
82
- },
83
- });
84
- }, [navigation, station, unit]);
85
-
86
- return (
87
- <WrapParallaxScrollView
88
- uriImg={stationState.background}
89
- title={stationState.name}
90
- onBack={onBack}
91
- onAdd={onAdd}
92
- onMore={showPopoverWithRef}
93
- childRef={childRef}
94
- hideRight={!canManageSubUnit()}
95
- >
96
- <View style={styles.wrap}>
97
- {stationState.camera && (
98
- <>
99
- <Text style={styles.subUnitTitle}>{t('camera')}</Text>
100
- <View style={styles.boxCamera}>
101
- <MediaPlayer
102
- uri={stationState.camera.uri}
103
- key={`camera-${stationState.camera.id}`}
104
- />
105
- </View>
106
- </>
107
- )}
108
- {devices?.length !== 0 ? (
109
- <View>
110
- <Text style={styles.subUnitTitle}>
111
- {t('text_all_devices')} ({devices?.length})
112
- </Text>
113
- <View style={styles.boxDevices}>
114
- {devices?.map((item, index) => {
115
- return (
116
- <ItemDevice
117
- key={`sensor-${item.id}`}
118
- id={item.id}
119
- statusIcon={item.action && item.action.icon}
120
- statusColor={item.action && item.action.color}
121
- title={item.name}
122
- description={item.value}
123
- index={index}
124
- sensor={item}
125
- unit={unit}
126
- station={station}
127
- />
128
- );
129
- })}
130
- </View>
131
- </View>
132
- ) : (
133
- <View style={styles.boxEmptyDevices}>
134
- <Text style={styles.emptyDevice}>{t('empty_device')}</Text>
135
- </View>
136
- )}
137
- </View>
138
-
139
- <MenuActionMore
140
- isVisible={showingPopover}
141
- hideMore={hidePopover}
142
- listMenuItem={listMenuItem}
143
- childRef={childRef}
144
- onItemClick={onItemClickAddMore}
145
- />
146
- </WrapParallaxScrollView>
147
- );
148
- };
149
-
150
- export default SubUnitDetail;
@@ -1,125 +0,0 @@
1
- import React from 'react';
2
- import { act, create } from 'react-test-renderer';
3
- import Toast from 'react-native-toast-message';
4
- import SubUnitDetail from '../Detail';
5
- import ItemDevice from '../../../commons/Device/ItemDevice';
6
- import Routes from '../../../utils/Route';
7
- import WrapParallaxScrollView from '../../../commons/WrapParallaxScrollView';
8
- import { SCProvider } from '../../../context';
9
- import { mockSCStore } from '../../../context/mockStore';
10
- import { AccessibilityLabel } from '../../../configs/Constants';
11
- import { TouchableOpacity } from 'react-native';
12
-
13
- const mockedNavigate = jest.fn();
14
- const mockedDispatch = jest.fn();
15
- const mockedDangerouslyGetState = jest.fn();
16
- const mockedDangerouslyGetStatePop = jest.fn();
17
- const mockedPop = jest.fn();
18
-
19
- jest.mock('@react-navigation/native', () => {
20
- return {
21
- ...jest.requireActual('@react-navigation/native'),
22
- useNavigation: () => ({
23
- navigate: mockedNavigate,
24
- dangerouslyGetParent: () => ({
25
- dangerouslyGetState: mockedDangerouslyGetState,
26
- pop: mockedDangerouslyGetStatePop,
27
- }),
28
- pop: mockedPop,
29
- }),
30
- useIsFocused: jest.fn(),
31
- };
32
- });
33
-
34
- const wrapComponent = (route) => (
35
- <SCProvider initState={mockSCStore({})}>
36
- <SubUnitDetail route={route} />
37
- </SCProvider>
38
- );
39
-
40
- describe('Test SubUnitDetail', () => {
41
- let route;
42
-
43
- beforeEach(() => {
44
- route = {
45
- params: {
46
- unit: {
47
- id: 1,
48
- user_id: 1,
49
- name: 'Unit name',
50
- },
51
- station: {
52
- id: 2,
53
- name: 'Station name',
54
- background: '',
55
- },
56
- },
57
- };
58
- });
59
-
60
- afterEach(() => {
61
- mockedDispatch.mockClear();
62
- Toast.show.mockClear();
63
- });
64
- let tree;
65
-
66
- it('ItemDevice', async () => {
67
- await act(async () => {
68
- tree = await create(wrapComponent(route));
69
- });
70
- const instance = tree.root;
71
- const itemDevices = instance.findAllByType(ItemDevice);
72
- expect(itemDevices).toHaveLength(0);
73
- });
74
-
75
- it('onBack', async () => {
76
- mockedDangerouslyGetState.mockImplementation(() => ({
77
- routes: [
78
- { name: 'route 1' },
79
- { name: 'route 2' },
80
- { name: Routes.AddSubUnitStack },
81
- ],
82
- }));
83
-
84
- await act(async () => {
85
- tree = await create(wrapComponent(route));
86
- });
87
- const instance = tree.root;
88
- const wrapScrollView = instance.findByType(WrapParallaxScrollView);
89
- await act(async () => {
90
- await wrapScrollView.props.onBack();
91
- });
92
- expect(mockedDangerouslyGetStatePop).toHaveBeenCalledWith(2);
93
- });
94
-
95
- it('click Menu ActionMore', async () => {
96
- mockedDangerouslyGetState.mockImplementation(() => ({
97
- routes: [
98
- { name: 'route 1' },
99
- { name: 'route 2' },
100
- { name: Routes.AddSubUnitStack },
101
- ],
102
- }));
103
-
104
- await act(async () => {
105
- tree = await create(wrapComponent(route));
106
- });
107
- const instance = tree.root;
108
- const button = instance.find(
109
- (el) =>
110
- el.props.accessibilityLabel ===
111
- AccessibilityLabel.HEADER_UNIT_BUTTON_BACK &&
112
- el.type === TouchableOpacity
113
- );
114
- await act(async () => {
115
- button.props.onPress();
116
- });
117
- const buttonOnActionPress = instance.findAll(
118
- (el) =>
119
- el.props.accessibilityLabel ===
120
- AccessibilityLabel.HEADER_UNIT_BUTTON_MORE &&
121
- el.type === TouchableOpacity
122
- );
123
- expect(buttonOnActionPress).toHaveLength(1);
124
- });
125
- });
@@ -1,62 +0,0 @@
1
- import React, { memo } from 'react';
2
- import { View } from 'react-native';
3
- import {
4
- VictoryChart,
5
- VictoryLine,
6
- VictoryTheme,
7
- VictoryScatter,
8
- VictoryGroup,
9
- VictoryAxis,
10
- VictoryArea,
11
- } from 'victory-native';
12
- import { Colors } from '../../../../../configs';
13
-
14
- const ChartAverage = memo(({ labels, tempData, humiData }) => {
15
- const dataChartTemp = tempData;
16
- const dataChartHumidity = humiData;
17
- return (
18
- <View style={{}}>
19
- <VictoryChart
20
- theme={VictoryTheme.material}
21
- padding={{ top: 10, bottom: 30, left: 36, right: 36 }}
22
- height={135}
23
- >
24
- <VictoryAxis
25
- style={axisX}
26
- tickFormat={(t, index) => {
27
- if (index % 4 === 0) {
28
- return t;
29
- }
30
- return null;
31
- }}
32
- />
33
- <VictoryAxis dependentAxis style={axisY} />
34
- <VictoryGroup color={'rgba(255,34,45,1)'} data={dataChartTemp}>
35
- <VictoryLine />
36
- <VictoryArea style={{ data: { fill: 'rgba(255,34,45,0.3)' } }} />
37
- <VictoryScatter size={5} />
38
- </VictoryGroup>
39
- <VictoryGroup color={'rgba(24,144,255,1)'} data={dataChartHumidity}>
40
- <VictoryLine />
41
- <VictoryArea style={{ data: { fill: 'rgba(24,144,255,0.3)' } }} />
42
- <VictoryScatter size={5} />
43
- </VictoryGroup>
44
- </VictoryChart>
45
- </View>
46
- );
47
- });
48
-
49
- const axisX = {
50
- axis: { fill: Colors.Gray4, stroke: Colors.Gray4, strokeWidth: 2 },
51
- grid: { fill: 'none', stroke: 'none' },
52
- ticks: { size: 0 },
53
- tickLabels: { fontSize: 12, fill: Colors.Gray8, padding: 13 },
54
- };
55
- const axisY = {
56
- axis: { stroke: Colors.Gray4 },
57
- axisLabel: { fontSize: 20, padding: 30 },
58
- grid: { fill: 'none', stroke: 'none' },
59
- ticks: { size: 0 },
60
- tickLabels: { fontSize: 0 },
61
- };
62
- export default ChartAverage;
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
- import { act, create } from 'react-test-renderer';
4
-
5
- import ChartAverage from '../ChartAverage';
6
-
7
- describe('Test ChartAverage', () => {
8
- let tree;
9
- it('render ChartAverage', async () => {
10
- await act(async () => {
11
- tree = await create(<ChartAverage />);
12
- });
13
- const instance = tree.root;
14
- const Views = instance.findAllByType(View);
15
- expect(Views).toHaveLength(3);
16
- });
17
- });
@@ -1,22 +0,0 @@
1
- import moment from 'moment';
2
-
3
- const getTickValues = (chart, configuration) => {
4
- const dateFormat = configuration ? configuration.date_format : null;
5
- let arr = [];
6
- let stringArr = [];
7
- let stringDataArr = [];
8
- for (let i = 0; i < chart.data.length; i++) {
9
- let checkHad = arr.findIndex((item) => item === chart.data[i].x);
10
- if (checkHad < 0) {
11
- arr.push(chart.data[i].x);
12
- stringArr.push(moment(chart.data[i].x).format(dateFormat));
13
- stringDataArr.push({
14
- x: moment(chart.data[i].x).format(dateFormat),
15
- y: chart.data[i].y,
16
- });
17
- }
18
- }
19
- return { arr, stringArr, stringDataArr };
20
- };
21
-
22
- export default getTickValues;