@eohjsc/react-native-smart-city 0.3.90 → 0.3.92

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 (312) hide show
  1. package/package.json +1 -1
  2. package/src/Images/Common/reorder.svg +3 -0
  3. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/AutoLockStyles.js +1 -1
  4. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +3 -1
  5. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +3 -3
  6. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +3 -10
  7. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +1 -0
  8. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/SetupGeneratePasscodeStyles.js +1 -1
  9. package/src/commons/ActionGroup/OnOffTemplate/SwitchButtonTemplate.js +13 -5
  10. package/src/commons/ActionGroup/SliderRangeTemplate.js +100 -69
  11. package/src/commons/ActionGroup/SliderRangeTemplateStyles.js +27 -27
  12. package/src/commons/ActionGroup/StatesGridActionTemplate.js +4 -1
  13. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +1 -1
  14. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +4 -1
  15. package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +56 -0
  16. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +2 -2
  17. package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +45 -8
  18. package/src/commons/ActionGroup/__test__/index.test.js +0 -19
  19. package/src/commons/ActionGroup/index.js +0 -3
  20. package/src/commons/ActionTemplate/CurtainAction.js +5 -5
  21. package/src/commons/ActionTemplate/CurtainActionStyles.js +1 -1
  22. package/src/commons/ActionTemplate/OnOffButtonAction.js +4 -4
  23. package/src/commons/ActionTemplate/OnOffButtonActionStyles.js +1 -1
  24. package/src/commons/ActionTemplate/OnOffSimpleAction.js +4 -4
  25. package/src/commons/ActionTemplate/OnOffSimpleActionStyles.js +1 -1
  26. package/src/commons/ActionTemplate/OnOffSmartLockAction.js +4 -4
  27. package/src/commons/ActionTemplate/OnOffSmartLockActionStyles.js +1 -1
  28. package/src/commons/ActionTemplate/OneButtonAction.js +3 -3
  29. package/src/commons/ActionTemplate/OneButtonActionStyles.js +1 -1
  30. package/src/commons/ActionTemplate/ThreeButtonAction.js +5 -5
  31. package/src/commons/ActionTemplate/ThreeButtonActionStyles.js +1 -1
  32. package/src/commons/ActionTemplate/__test__/CurtainAction.test.js +1 -1
  33. package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +1 -1
  34. package/src/commons/ActionTemplate/__test__/OnOffSimpleAction.test.js +1 -1
  35. package/src/commons/ActionTemplate/__test__/OnOffSmartLockAction.test.js +1 -1
  36. package/src/commons/ActionTemplate/__test__/OneButtonAction.test.js +1 -1
  37. package/src/commons/ActionTemplate/__test__/ThreeButtonAction.test.js +1 -1
  38. package/src/commons/ActionTemplate/__test__/index.test.js +21 -70
  39. package/src/commons/ActionTemplate/index.js +19 -55
  40. package/src/commons/Alert/__test__/Alert.test.js +1 -1
  41. package/src/commons/Auth/AccountList.js +1 -1
  42. package/src/commons/Auth/__test__/OtpInputList.test.js +17 -19
  43. package/src/commons/Automate/ItemAutomate.js +10 -4
  44. package/src/commons/Automate/__test__/ItemAutomate.test.js +11 -11
  45. package/src/commons/BackDefault/__test__/BackDefault.test.js +1 -1
  46. package/src/commons/Button/__test__/Button.test.js +1 -1
  47. package/src/commons/ButtonPopup/__test__/ButtonPopup.test.js +1 -1
  48. package/src/commons/Calendar/__test__/Calendar.test.js +1 -1
  49. package/src/commons/ChartLoading/__test__/ChartLoading.test.js +1 -1
  50. package/src/commons/CircleButton/__test__/CircleButton.test.js +1 -1
  51. package/src/commons/CircleView/__test__/CircleView.test.js +1 -1
  52. package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -2
  53. package/src/commons/DateTimeRangeChange/index.js +31 -48
  54. package/src/commons/Device/DeviceAlertStatus.js +2 -1
  55. package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +2 -2
  56. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +1 -1
  57. package/src/commons/Device/FlatListItems.js +1 -1
  58. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +2 -2
  59. package/src/commons/Device/HistoryChart.js +6 -49
  60. package/src/commons/Device/LinearChart/LinearChart.test.js +1 -1
  61. package/src/commons/Device/ProgressBar/__test__/ProgressBar.test.js +1 -1
  62. package/src/commons/Device/ProgressBar/index.js +5 -11
  63. package/src/commons/Device/ProgressBar/styles.js +11 -3
  64. package/src/commons/Device/RainningSensor/__test__/CurrentRainSensor.test.js +5 -5
  65. package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +3 -3
  66. package/src/commons/Device/WindDirection/Compass/Compass.test.js +2 -2
  67. package/src/commons/Device/WindSpeed/Anemometer/index.js +2 -0
  68. package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +14 -1
  69. package/src/commons/Device/WindSpeed/LinearChart/index.js +5 -3
  70. package/src/commons/Device/__test__/DeviceAlertStatus.test.js +3 -3
  71. package/src/commons/Device/__test__/DisconnectedView.test.js +2 -2
  72. package/src/commons/Device/__test__/FlatListItems.test.js +1 -1
  73. package/src/commons/Device/__test__/SensorConnectedStatus.test.js +1 -1
  74. package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +1 -1
  75. package/src/commons/FlatListDnD/__test__/index.test.js +49 -0
  76. package/src/commons/FlatListDnD/index.js +37 -0
  77. package/src/commons/FlatListDnD/styles.js +12 -0
  78. package/src/commons/Form/__test__/CurrencyInput.test.js +2 -2
  79. package/src/commons/Form/__test__/TextInput.test.js +3 -3
  80. package/src/commons/Form/__test__/TextInputPassword.test.js +2 -2
  81. package/src/commons/FullLoading/__test__/index.test.js +2 -2
  82. package/src/commons/Header/HeaderCustom.js +2 -1
  83. package/src/commons/HorizontalPicker/index.js +65 -38
  84. package/src/commons/IconComponent/index.js +3 -2
  85. package/src/commons/ImageButton/__test__/ImageButton.test.js +1 -1
  86. package/src/commons/MediaPlayer/__test__/index.test.js +8 -3
  87. package/src/commons/MediaPlayer/index.js +11 -7
  88. package/src/commons/MenuActionMore/index.js +6 -4
  89. package/src/commons/Modal/ModalBottom.js +2 -3
  90. package/src/commons/Modal/ModalCustom.js +2 -3
  91. package/src/commons/NavBar/index.js +48 -50
  92. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
  93. package/src/commons/OneTapTemplate/NumberUpDownActionTemplateStyles.js +1 -1
  94. package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +5 -5
  95. package/src/commons/OneTapTemplate/OptionsDropdownActionTemplateStyles.js +1 -1
  96. package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +5 -5
  97. package/src/commons/OneTapTemplate/StatesGridActionTemplateStyles.js +1 -1
  98. package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +2 -2
  99. package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +1 -1
  100. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +2 -2
  101. package/src/commons/PreventAccess/index.js +1 -1
  102. package/src/commons/RowItem/__test__/RowItem.test.js +1 -1
  103. package/src/commons/RowUser/__test__/RowUser.test.js +1 -1
  104. package/src/commons/Section/Section.test.js +2 -2
  105. package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -1
  106. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +3 -3
  107. package/src/commons/Sharing/StationDevicePermissions.js +4 -4
  108. package/src/commons/Sharing/WrapHeaderScrollable.js +5 -5
  109. package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +1 -1
  110. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +3 -3
  111. package/src/commons/Sharing/__test__/MemberList.test.js +6 -4
  112. package/src/commons/Sharing/__test__/RowMember.test.js +2 -2
  113. package/src/commons/Sharing/__test__/WrapHeaderScrollable.test.js +4 -2
  114. package/src/commons/SubUnit/OneTap/ItemOneTap.js +7 -11
  115. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +13 -16
  116. package/src/commons/SubUnit/OneTap/index.js +22 -7
  117. package/src/commons/TextButton/__test__/TextButton.test.js +2 -2
  118. package/src/commons/Today/__test__/Today.test.js +1 -1
  119. package/src/commons/TouchableScale/__test__/TouchableScale.test.js +1 -1
  120. package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +4 -0
  121. package/src/commons/UnitSummary/AirQuality/index.js +2 -2
  122. package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +1 -1
  123. package/src/commons/UnitSummary/ConfigHistoryChart/index.js +0 -6
  124. package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +1 -1
  125. package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +1 -1
  126. package/src/commons/ViewButtonBottom/__test__/ViewButtonBottom.test.js +1 -1
  127. package/src/configs/API.js +14 -31
  128. package/src/configs/AccessibilityLabel.js +1 -0
  129. package/src/configs/Colors.js +1 -1
  130. package/src/configs/Constants.js +14 -48
  131. package/src/context/reducer.ts +3 -1
  132. package/src/hoc/__test__/withRemoteControl.test.js +1 -1
  133. package/src/hooks/Common/__test__/useStatusbar.test.js +5 -5
  134. package/src/hooks/Common/index.js +0 -2
  135. package/src/hooks/Common/useKeyboardShow.js +4 -4
  136. package/src/hooks/Common/useStatusBar.js +2 -2
  137. package/src/hooks/Common/useTitleHeader.js +5 -7
  138. package/src/hooks/IoT/__test__/useRemoteControl.test.js +11 -0
  139. package/src/hooks/IoT/useBluetoothConnection.js +6 -3
  140. package/src/hooks/index.js +1 -2
  141. package/src/navigations/UnitStack.js +51 -17
  142. package/src/screens/ActivityLog/FilterPopup.js +4 -4
  143. package/src/screens/ActivityLog/__test__/FilterPopup.test.js +2 -2
  144. package/src/screens/ActivityLog/__test__/index.test.js +2 -2
  145. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +3 -3
  146. package/src/screens/AddCommon/__test__/SelectUnit.test.js +5 -5
  147. package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +9 -33
  148. package/src/screens/AddNewAutoSmart/index.js +33 -89
  149. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectRouterGuide.test.js +1 -1
  150. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +1 -1
  151. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +1 -1
  152. package/src/screens/AddNewGateway/SelectDeviceSubUnit.js +1 -2
  153. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +5 -17
  154. package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +1 -1
  155. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +2 -2
  156. package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +3 -3
  157. package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +2 -2
  158. package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +8 -16
  159. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +10 -12
  160. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -14
  161. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -14
  162. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +1 -1
  163. package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +3 -2
  164. package/src/screens/AddNewGateway/index.js +1 -1
  165. package/src/screens/AllCamera/__test__/index.test.js +18 -57
  166. package/src/screens/AllCamera/index.js +100 -33
  167. package/src/screens/AllGateway/DetailConfigActionZigbee/__test__/index.test.js +0 -18
  168. package/src/screens/AllGateway/DetailConfigActionZigbee/index.js +1 -1
  169. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +5 -2
  170. package/src/screens/AllGateway/hooks/__test__/index.test.js +1 -1
  171. package/src/screens/Automate/AddNewAction/ChooseAction.js +139 -0
  172. package/src/screens/Automate/AddNewAction/ChooseConfig.js +179 -0
  173. package/src/screens/{AddNewAction → Automate/AddNewAction}/Components/LoadingSelectAction.js +1 -1
  174. package/src/screens/Automate/AddNewAction/Components/SelectDevices.js +75 -0
  175. package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/DeviceStyles.js +5 -1
  176. package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/__test__/index.test.js +4 -4
  177. package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/index.js +5 -4
  178. package/src/screens/Automate/AddNewAction/NewActionWrapper.js +56 -0
  179. package/src/screens/Automate/AddNewAction/SelectControlDevices.js +69 -0
  180. package/src/screens/Automate/AddNewAction/SelectMonitorDevices.js +110 -0
  181. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +196 -0
  182. package/src/screens/{AddNewAction → Automate/AddNewAction}/Styles/SelectActionStyles.js +1 -1
  183. package/src/screens/{AddNewAction → Automate/AddNewAction}/Styles/SelectSensorDevicesStyles.js +1 -1
  184. package/src/screens/{AddNewAction → Automate/AddNewAction}/Styles/SetupSensorStyles.js +5 -3
  185. package/src/screens/{AddNewAction/__test__/SelectAction.test.js → Automate/AddNewAction/__test__/ChooseAction.test.js} +101 -122
  186. package/src/screens/Automate/AddNewAction/__test__/ChooseConfig.test.js +210 -0
  187. package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +130 -0
  188. package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +92 -0
  189. package/src/screens/Automate/AddNewAction/__test__/SetupSensor.test.js +131 -0
  190. package/src/screens/Automate/Components/InputName.js +64 -0
  191. package/src/screens/{AddNewOneTap/AddNewOneTapStyles.js → Automate/Components/InputNameStyles.js} +2 -2
  192. package/src/screens/{EditActionsList → Automate/EditActionsList}/Styles/indexStyles.js +5 -1
  193. package/src/screens/{EditActionsList → Automate/EditActionsList}/__tests__/index.test.js +20 -12
  194. package/src/screens/{EditActionsList → Automate/EditActionsList}/index.js +18 -19
  195. package/src/screens/Automate/MultiUnits.js +70 -68
  196. package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +134 -0
  197. package/src/screens/Automate/OneTap/index.js +16 -0
  198. package/src/screens/Automate/Scenario/ScenarioName.js +15 -0
  199. package/src/screens/{AddNewOneTap → Automate/Scenario}/__test__/AddNewOneTap.test.js +27 -45
  200. package/src/screens/Automate/ScriptDetail/Components/DeleteScript.js +45 -0
  201. package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +58 -0
  202. package/src/screens/{ScriptDetail → Automate/ScriptDetail}/Styles/indexStyles.js +1 -1
  203. package/src/screens/{ScriptDetail → Automate/ScriptDetail}/__test__/index.test.js +67 -76
  204. package/src/screens/{ScriptDetail → Automate/ScriptDetail}/__test__/useStarredScript.test.js +7 -6
  205. package/src/screens/{ScriptDetail → Automate/ScriptDetail}/hooks/useStarredScript.js +4 -4
  206. package/src/screens/Automate/ScriptDetail/index.js +346 -0
  207. package/src/screens/Automate/ScriptDetail/utils.js +113 -0
  208. package/src/screens/{SetSchedule → Automate/SetSchedule}/__test__/SelectWeekday.test.js +2 -2
  209. package/src/screens/{SetSchedule → Automate/SetSchedule}/__test__/index.test.js +21 -46
  210. package/src/screens/{SetSchedule → Automate/SetSchedule}/components/RepeatOptionsPopup.js +4 -4
  211. package/src/screens/{SetSchedule → Automate/SetSchedule}/components/RowItem.js +2 -2
  212. package/src/screens/{SetSchedule → Automate/SetSchedule}/components/SelectWeekday.js +3 -3
  213. package/src/screens/Automate/SetSchedule/index.js +140 -0
  214. package/src/screens/{SetSchedule → Automate/SetSchedule}/styles/RepeatOptionsPopupStyles.js +1 -1
  215. package/src/screens/{SetSchedule → Automate/SetSchedule}/styles/RowItemStyles.js +1 -1
  216. package/src/screens/{SetSchedule → Automate/SetSchedule}/styles/SelectWeekdayStyles.js +1 -1
  217. package/src/screens/{SetSchedule → Automate/SetSchedule}/styles/indexStyles.js +1 -1
  218. package/src/screens/Automate/ValueChange/ValueChangeName.js +16 -0
  219. package/src/screens/Automate/__test__/MultiUnits.test.js +78 -122
  220. package/src/screens/Automate/__test__/index.test.js +21 -47
  221. package/src/screens/Automate/constants.js +0 -0
  222. package/src/screens/Automate/index.js +18 -24
  223. package/src/screens/ChangePosition/__test__/index.test.js +75 -0
  224. package/src/screens/ChangePosition/index.js +112 -0
  225. package/src/screens/ChangePosition/styles.js +87 -0
  226. package/src/screens/Device/__test__/DetailHistoryChart.test.js +2 -2
  227. package/src/screens/Device/__test__/EmergencyCountdown.test.js +4 -2
  228. package/src/screens/Device/__test__/detail.test.js +202 -257
  229. package/src/screens/Device/__test__/sensorDisplayItem.test.js +14 -10
  230. package/src/screens/Device/components/ChartWrapper.js +3 -3
  231. package/src/screens/Device/components/SensorDisplayItem.js +2 -1
  232. package/src/screens/Device/components/VisualChart.js +56 -9
  233. package/src/screens/Device/components/__test__/VisualChart.test.js +1 -1
  234. package/src/screens/Device/detail.js +14 -0
  235. package/src/screens/Device/hooks/__test__/useEmergencyButton.test.js +35 -13
  236. package/src/screens/Device/hooks/useEvaluateValue.js +28 -2
  237. package/src/screens/Device/styles.js +7 -0
  238. package/src/screens/DeviceInfo/__test__/index.test.js +16 -18
  239. package/src/screens/DeviceInfo/index.js +6 -5
  240. package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +52 -0
  241. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +18 -13
  242. package/src/screens/Notification/__test__/Notification.test.js +64 -73
  243. package/src/screens/Notification/index.js +14 -14
  244. package/src/screens/PlayBackCamera/index.js +2 -3
  245. package/src/screens/SelectUnit/__test__/index.test.js +0 -5
  246. package/src/screens/SelectUnit/index.js +1 -2
  247. package/src/screens/SharedUnit/index.js +5 -4
  248. package/src/screens/Sharing/Components/TitleCheckBox.js +2 -2
  249. package/src/screens/Sharing/SelectUser.js +2 -2
  250. package/src/screens/Sharing/__test__/MemberList.test.js +9 -15
  251. package/src/screens/Sharing/__test__/MemberList2.test.js +10 -16
  252. package/src/screens/Sharing/__test__/SelectUser.test.js +8 -4
  253. package/src/screens/SideMenuDetail/SideMenuDetailStyles.js +1 -1
  254. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +3 -3
  255. package/src/screens/SmartAccount/__test__/Connecting.test.js +1 -1
  256. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +3 -3
  257. package/src/screens/SmartAccount/index.js +1 -0
  258. package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +1 -1
  259. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +5 -5
  260. package/src/screens/SmartIr/__test__/SelectBrand.test.js +2 -2
  261. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +2 -2
  262. package/src/screens/SmartIr/__test__/SmartIr.test.js +2 -2
  263. package/src/screens/SubUnit/ManageSubUnit.js +4 -4
  264. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +9 -28
  265. package/src/screens/TDSGuide/index.js +1 -1
  266. package/src/screens/Template/GatewayList.js +4 -1
  267. package/src/screens/Template/__test__/detail.test.js +24 -22
  268. package/src/screens/Template/detail.js +1 -0
  269. package/src/screens/UVIndexGuide/index.js +2 -2
  270. package/src/screens/Unit/Detail.js +6 -5
  271. package/src/screens/Unit/SelectAddToFavorites.js +1 -1
  272. package/src/screens/Unit/__test__/ChooseLocation.test.js +8 -13
  273. package/src/screens/Unit/__test__/Detail.test.js +10 -14
  274. package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +1 -1
  275. package/src/screens/Unit/__test__/SmartAccount.test.js +8 -14
  276. package/src/screens/Unit/components/__test__/Header.test.js +4 -4
  277. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +1 -1
  278. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +14 -6
  279. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +1 -1
  280. package/src/screens/UnitSummary/components/Temperature/index.js +2 -2
  281. package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +4 -0
  282. package/src/screens/UnitSummary/components/UvIndex/index.js +2 -2
  283. package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +6 -11
  284. package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -2
  285. package/src/screens/UnitSummary/components/__test__/TotalPowerBox.test.js +1 -1
  286. package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +1 -1
  287. package/src/screens/UnitSummary/components/__test__/index.test.js +2 -2
  288. package/src/screens/WaterQualityGuide/index.js +10 -5
  289. package/src/utils/Apis/axios.js +3 -0
  290. package/src/utils/I18n/translations/en.json +24 -18
  291. package/src/utils/I18n/translations/vi.json +22 -18
  292. package/src/utils/Route/index.js +9 -3
  293. package/src/utils/Utils.js +29 -0
  294. package/src/utils/__test__/Utils.test.js +6 -0
  295. package/src/commons/ActionGroup/CurtainButtonTemplate.js +0 -130
  296. package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +0 -109
  297. package/src/commons/Auth/SocialButton.js +0 -54
  298. package/src/commons/Auth/__test__/SocialButton.test.js +0 -44
  299. package/src/commons/Sharing/__test__/StationDevicePermission.test.js +0 -85
  300. package/src/hooks/__test__/useInitDeepLink.test.js +0 -28
  301. package/src/hooks/useInitDeepLink.js +0 -25
  302. package/src/screens/AddNewAction/SelectAction.js +0 -570
  303. package/src/screens/AddNewAction/SelectSensorDevices.js +0 -236
  304. package/src/screens/AddNewAction/SetupSensor.js +0 -263
  305. package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +0 -181
  306. package/src/screens/AddNewAction/__test__/SetupSensor.test.js +0 -114
  307. package/src/screens/AddNewOneTap/index.js +0 -147
  308. package/src/screens/ScriptDetail/hooks/index.js +0 -136
  309. package/src/screens/ScriptDetail/index.js +0 -525
  310. package/src/screens/SetSchedule/index.js +0 -200
  311. /package/src/screens/{AddNewAction → Automate/AddNewAction}/Components/index.js +0 -0
  312. /package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/LoadingSelectAction.test.js +0 -0
@@ -5,9 +5,13 @@ import { Section } from '../..';
5
5
  import ItemAddNew from '../../Device/ItemAddNew';
6
6
  import ItemOneTap from './ItemOneTap';
7
7
  import { useTranslations } from '../../../hooks/Common/useTranslations';
8
- import { useNavigation } from '@react-navigation/native';
8
+ import { useNavigation, useRoute } from '@react-navigation/native';
9
9
  import Routes from '../../../utils/Route/index.js';
10
- import { AUTOMATE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
10
+ import {
11
+ AUTOMATE_TYPE,
12
+ AccessibilityLabel,
13
+ AUTOMATE_TABS,
14
+ } from '../../../configs/Constants';
11
15
  import Text from '../../Text/index.js';
12
16
 
13
17
  import styles from './OneTapStyles.js';
@@ -17,15 +21,25 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
17
21
  const { navigate } = useNavigation();
18
22
  const [automates, setAutomates] = useState(listAutomate[0]);
19
23
  const [indexAutomate, setIndexAutomate] = useState(0);
24
+ const { name: currentScreen } = useRoute();
20
25
  const handleOnAddNew = () => {
21
26
  switch (automates.type) {
22
- case AUTOMATE_TYPE.ONE_TAP:
23
- navigate(Routes.AddNewOneTap, { type: AUTOMATE_TYPE.ONE_TAP, unit });
27
+ case AUTOMATE_TABS.SCENARIO:
28
+ navigate(Routes.AddNewOneTap, {
29
+ automate: {
30
+ type: AUTOMATE_TYPE.ONE_TAP,
31
+ unit: unit?.id,
32
+ },
33
+ closeScreen: currentScreen,
34
+ });
24
35
  break;
25
- case AUTOMATE_TYPE.AUTOMATION:
36
+ case AUTOMATE_TABS.AUTOMATION:
26
37
  navigate(Routes.AddNewAutoSmart, {
27
- type: AUTOMATE_TYPE.VALUE_CHANGE,
28
- unit,
38
+ automate: {
39
+ type: AUTOMATE_TYPE.VALUE_CHANGE,
40
+ unit: unit?.id,
41
+ },
42
+ closeScreen: currentScreen,
29
43
  });
30
44
  break;
31
45
  }
@@ -37,6 +51,7 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
37
51
  setAutomates(item);
38
52
  setIndexAutomate(index);
39
53
  }, []);
54
+
40
55
  useEffect(() => {
41
56
  setAutomates(listAutomate[indexAutomate]);
42
57
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -8,7 +8,7 @@ describe('create TextButton component', () => {
8
8
  it('create button auth', async () => {
9
9
  const mockFunc = jest.fn();
10
10
  await act(async () => {
11
- tree = renderer.create(
11
+ tree = await renderer.create(
12
12
  <TextButton
13
13
  key={'item_1'}
14
14
  primary={'primary'}
@@ -28,7 +28,7 @@ describe('create TextButton component', () => {
28
28
  it('create button ActivityIndicator', async () => {
29
29
  const mockFunc = jest.fn();
30
30
  await act(async () => {
31
- tree = renderer.create(
31
+ tree = await renderer.create(
32
32
  <TextButton
33
33
  loading={true}
34
34
  showIndicator={true}
@@ -16,7 +16,7 @@ describe('Test Today', () => {
16
16
  it('create Today', async () => {
17
17
  Date.now = jest.fn(() => new Date('2021-01-24T12:00:00.000Z'));
18
18
  await act(async () => {
19
- tree = renderer.create(wrapComponent());
19
+ tree = await renderer.create(wrapComponent());
20
20
  });
21
21
  const instance = tree.root;
22
22
  const texts = instance.findAllByType(Text);
@@ -8,7 +8,7 @@ describe('Test TouchableScale', () => {
8
8
  const mockFunc = jest.fn();
9
9
  it('create TouchableScale onPress', async () => {
10
10
  await act(async () => {
11
- tree = renderer.create(<TouchableScale onPress={mockFunc} />);
11
+ tree = await renderer.create(<TouchableScale onPress={mockFunc} />);
12
12
  });
13
13
  const instance = tree.root;
14
14
  const textInputs = instance.findAllByType(TouchableOpacity);
@@ -7,6 +7,10 @@ import Text from '../../../Text';
7
7
  import { AccessibilityLabel } from '../../../../configs/Constants';
8
8
  import { SCProvider } from '../../../../context';
9
9
  import { mockSCStore } from '../../../../context/mockStore';
10
+ import MockAdapter from 'axios-mock-adapter';
11
+ import api from '../../../../utils/Apis/axios';
12
+
13
+ new MockAdapter(api.axiosInstance);
10
14
 
11
15
  const wrapComponent = (data) => (
12
16
  <SCProvider initState={mockSCStore({})}>
@@ -6,7 +6,7 @@ import { useTranslations } from '../../../hooks/Common/useTranslations';
6
6
  import { Colors } from '../../../configs';
7
7
  import { Section } from '../../../commons/index';
8
8
  import Text from '../../../commons/Text';
9
- import ConfigHistoryChart from '../ConfigHistoryChart';
9
+ import VisualChart from '../../../screens/Device/components/VisualChart';
10
10
 
11
11
  import SegmentedRoundDisplay from './SegmentedRoundDisplay';
12
12
  import { AccessibilityLabel } from '../../../configs/Constants';
@@ -166,7 +166,7 @@ const AirQuality = memo(({ summaryDetail }) => {
166
166
  )}
167
167
  {showBoxHistory && (
168
168
  <Section type={'border'}>
169
- <ConfigHistoryChart configs={configs} />
169
+ <VisualChart item={{ configuration: { configs } }} />
170
170
  </Section>
171
171
  )}
172
172
  </View>
@@ -37,7 +37,7 @@ describe('Test HistoryChart', () => {
37
37
  };
38
38
 
39
39
  it('Test render null', async () => {
40
- await act(() => {
40
+ await act(async () => {
41
41
  tree = create(wrapComponent());
42
42
  });
43
43
  const instance = tree.root;
@@ -6,12 +6,6 @@ import HistoryChart from '../../../commons/Device/HistoryChart';
6
6
  import { axiosGet } from '../../../utils/Apis/axios';
7
7
  import { getPusher } from '../../../utils/Pusher';
8
8
 
9
- export const dateTimeType = {
10
- date: 'date',
11
- time: 'time',
12
- dateTime: 'datetime',
13
- };
14
-
15
9
  const fetchDataS3 = async (url) => {
16
10
  const { data } = await axiosGet(url, {
17
11
  // todo Bang try not to use axiosGet
@@ -8,7 +8,7 @@ describe('Test Total Power Box', () => {
8
8
 
9
9
  it('render Total Power Box', async () => {
10
10
  await act(async () => {
11
- tree = renderer.create(<TotalPowerBox title={'titleTest'} />);
11
+ tree = await renderer.create(<TotalPowerBox title={'titleTest'} />);
12
12
  });
13
13
  const instance = tree.root;
14
14
  const item = instance.find(
@@ -20,7 +20,7 @@ describe('Test Total Power Consumption', () => {
20
20
 
21
21
  it('render Total Power Consumption', async () => {
22
22
  await act(async () => {
23
- tree = renderer.create(wrapComponent());
23
+ tree = await renderer.create(wrapComponent());
24
24
  });
25
25
  const instance = tree.root;
26
26
  const item = instance.find(
@@ -8,7 +8,7 @@ describe('Test TouchableScale', () => {
8
8
  const mockFunc = jest.fn();
9
9
  it('create TouchableScale onPress', async () => {
10
10
  await act(async () => {
11
- tree = renderer.create(
11
+ tree = await renderer.create(
12
12
  <ViewButtonBottom
13
13
  leftTitle={'leftTitle'}
14
14
  onLeftClick={mockFunc}
@@ -6,7 +6,6 @@ const API = {
6
6
  SHARED_UNITS: () => '/property_manager/shared_units/',
7
7
  CREATE_UNIT: () => '/property_manager/iot_dashboard/dev_mode/units/',
8
8
  UNIT_DETAIL: (id) => `/property_manager/units/${id}/`,
9
- UNITS_PUBLIC: () => '/property_manager/units/public/',
10
9
  UNIT_SUMMARY: (id) => `/property_manager/units/${id}/summary/`,
11
10
  UNIT_SUMMARY_DETAIL: (id, id2) =>
12
11
  `/property_manager/units/${id}/summary_detail/${id2}/`,
@@ -52,35 +51,28 @@ const API = {
52
51
  },
53
52
  },
54
53
  DEVICE: {
55
- SENSOR_DETAIL: (id) => `/property_manager/sensors/${id}/`,
54
+ SENSOR_DETAIL: (id) => `/property_manager/devices/${id}/`,
56
55
  DISPLAY: (id) => `/property_manager/devices/${id}/display/`,
57
56
  SIDE_MENU_DETAIL: (id, side_menu_id) =>
58
57
  `/property_manager/devices/${id}/display/side_menu/${side_menu_id}/`,
59
58
  DISPLAY_VALUES_V2: (id) =>
60
- `/property_manager/sensors/${id}/display_values_v2/`,
61
- DISPLAY_HISTORY: (id, hId) =>
62
- `/property_manager/sensors/${id}/display_history/`,
59
+ `/property_manager/devices/${id}/display_values_v2/`,
60
+ DISPLAY_HISTORY: (id) => `/property_manager/devices/${id}/display_history/`,
63
61
  REMOTE_CONTROL_OPTIONS: (id) =>
64
- `/property_manager/sensors/${id}/remote_control_options/`,
65
- TRIGGER_ACTION: (id) => `/property_manager/sensors/${id}/quick_action/`,
62
+ `/property_manager/devices/${id}/remote_control_options/`,
63
+ TRIGGER_ACTION: (id) => `/property_manager/devices/${id}/quick_action/`,
66
64
  SETUP: (id) => `/property_manager/devices/${id}/setup/`,
67
- CHECK_CONNECTION: (id) =>
68
- `/property_manager/sensors/${id}/check_connection/`,
69
- UPDATE_SENSOR: (unit_id, station_id, id) =>
70
- `/property_manager/${unit_id}/sub_units/${station_id}/devices/${id}/`,
71
- ACTIVITY_LOG: () => SCConfig.apiRoot + '/chip_manager/action_log',
72
- DISPLAY_ACTIONS: (id) =>
73
- SCConfig.apiRoot + `/property_manager/sensors/${id}/display_actions/`,
74
- DISPLAY_EVENTS: (id) =>
75
- SCConfig.apiRoot + `/property_manager/sensors/${id}/display_events/`,
65
+ ACTIVITY_LOG: () => '/chip_manager/action_log',
66
+ DISPLAY_ACTIONS: (id) => `/property_manager/devices/${id}/display_actions/`,
76
67
  CHANGE_SUB_UNIT: (unit_id, station_id, id) =>
77
68
  `/property_manager/${unit_id}/sub_units/${station_id}/devices/${id}/change_sub_unit/`,
78
69
  ADD_TO_FAVOURITES: (id) =>
79
- SCConfig.apiRoot + `/property_manager/devices/${id}/add_to_favourites/`,
70
+ `/property_manager/devices/${id}/add_to_favourites/`,
80
71
  REMOVE_FROM_FAVOURITES: (id) =>
81
- SCConfig.apiRoot +
82
72
  `/property_manager/devices/${id}/remove_from_favourites/`,
83
73
  END_DEVICE_DETAIL: (id) => `/property_manager/devices/${id}/`,
74
+ ORDER_DISPLAY_ITEMS: (id) =>
75
+ `/property_manager/devices/${id}/display/order_display_items/`,
84
76
  },
85
77
  SHARED_SENSOR: {
86
78
  ACCESS: (id) => `/property_manager/shared_sensors/${id}/access/`,
@@ -97,6 +89,7 @@ const API = {
97
89
  `/property_manager/automate/${automateId}/script_action/${actionId}/`,
98
90
  ADD_SCRIPT_ACTION: (id) =>
99
91
  `/property_manager/automate/${id}/add_script_action/`,
92
+ FETCH_AUTOMATE: (automateId) => `/property_manager/automate/${automateId}/`,
100
93
  CREATE_AUTOMATE: () => '/property_manager/automate/',
101
94
  UPDATE_AUTOMATE: (automateId) =>
102
95
  `/property_manager/automate/${automateId}/`,
@@ -104,8 +97,7 @@ const API = {
104
97
  UNSTAR_SCRIPT: (id) => `/property_manager/automate/${id}/unstar_script/`,
105
98
  GET_SMART: () => '/property_manager/automate/smart/',
106
99
  GET_ALL_UNITS: () => '/property_manager/units/all_unit/',
107
- GET_SENSOR_CONFIG: (id) =>
108
- `/property_manager/sensors/${id}/display_configs/`,
100
+ DISPLAY_CONFIGS: (id) => `/property_manager/devices/${id}/display_configs/`,
109
101
  GET_MULTI_UNITS: () => '/property_manager/automate/multi_unit/',
110
102
  ACTIVITY_LOG: (id) => `/property_manager/automate/${id}/logs/`,
111
103
  STARRED_SCRIPTS: () => '/property_manager/automate/starred_scripts/',
@@ -185,6 +177,8 @@ const API = {
185
177
  SET_READ: (id) => `/notifications/eoh/${id}/set_read/`,
186
178
  },
187
179
  VALUE_EVALUATIONS: () => '/property_manager/config_value_evaluations/',
180
+ FETCH_VALUE_EVALUATION: (id) =>
181
+ `/property_manager/config_value_evaluations/${id}/`,
188
182
  EXTERNAL: {
189
183
  GOOGLE_MAP: {
190
184
  AUTO_COMPLETE:
@@ -229,19 +223,10 @@ const API = {
229
223
  `/iot/modules/arduino/gateways/${gatewayId}/devices/${deviceId}/`,
230
224
  CONFIG_PINS: (gatewayId, deviceId) =>
231
225
  `/iot/modules/arduino/gateways/${gatewayId}/devices/${deviceId}/pins/`,
232
- CONFIG_PIN_DETAIL: (gatewayId, deviceId, configPinId) =>
233
- `/iot/modules/arduino/gateways/${gatewayId}/devices/${deviceId}/pins/${configPinId}/`,
234
226
  ACTION: (gatewayId, deviceId) =>
235
227
  `/iot/modules/arduino/gateways/${gatewayId}/devices/${deviceId}/actions/`,
236
- ACTION_DETAIL: (gatewayId, deviceId, actionId) =>
237
- `/iot/modules/arduino/gateways/${gatewayId}/devices/${deviceId}/actions/${actionId}/`,
238
228
  },
239
229
  ZIGBEE: {
240
- DETAIL: (id) => `/iot/modules/zigbee/gateways/${id}/`,
241
- SEARCH_DEVICE: (id) => `/iot/modules/zigbee/chips/${id}/search_device/`,
242
- DEVICE_CONFIGURATION: (id, deviceId) =>
243
- `/iot/modules/zigbee/chips/${id}/sensors/${deviceId}/configuration/`,
244
- CONFIGURATION: (id) => `/iot/modules/zigbee/chips/${id}/configuration/`,
245
230
  DEVICE: (gatewayId) =>
246
231
  `/iot/modules/zigbee/gateways/${gatewayId}/devices/`,
247
232
  DEVICE_DETAIL: (gatewayId, deviceId) =>
@@ -261,8 +246,6 @@ const API = {
261
246
  `/iot/modules/modbus/gateways/${gatewayId}/devices/${deviceId}/registers/`,
262
247
  ACTION: (gatewayId, deviceId) =>
263
248
  `/iot/modules/modbus/gateways/${gatewayId}/devices/${deviceId}/actions/`,
264
- ACTION_DETAIL: (gatewayId, deviceId, actionId) =>
265
- `/iot/modules/modbus/gateways/${gatewayId}/devices/${deviceId}/actions/${actionId}/`,
266
249
  },
267
250
  },
268
251
  };
@@ -475,6 +475,7 @@ export default {
475
475
  SELECT_USER_ADD_USER_SUB_TITLE: 'SELECT_USER_ADD_USER_SUB_TITLE',
476
476
  INPUT_PHONE_NUMBER_OR_EMAIL: 'INPUT_PHONE_NUMBER_OR_EMAIL',
477
477
  INVITE_PHONE_NUMBER: 'INVITE_PHONE_NUMBER',
478
+ SELECT_USER_ADD_USER_INVITATION: 'SELECT_USER_ADD_USER_INVITATION',
478
479
  // Connected device
479
480
  CONNECTED_DEVICE_SUCCESS: 'CONNECTED_DEVICE_SUCCESS',
480
481
  CONNECTED_DEVICE_UNIT_NAME: 'CONNECTED_DEVICE_UNIT_NAME',
@@ -121,7 +121,7 @@ export const Colors = {
121
121
  Blue14: '#D9ECFF',
122
122
  Blue15: '#99CCFF',
123
123
  Blue16: '#0059B2',
124
-
124
+ Blue17: '#00A4B2',
125
125
  //Range Volcano:
126
126
  Volcano3: '#FFBB96',
127
127
  Summer: '#FFB24A',
@@ -120,13 +120,11 @@ export const AUTOMATE_TYPE = {
120
120
  VALUE_CHANGE: 'value_change',
121
121
  SCHEDULE: 'schedule',
122
122
  EVENT: 'event',
123
- EVENT_ACTION: 'event_action',
124
- EVENT_SENSOR: 'event_sensor',
125
- ONE_TAP_ONLY: 'one_tap_only',
126
- AUTOMATE: 'automate',
127
- AUTOMATION: 'automation',
128
- ALL: 'all',
123
+ };
124
+
125
+ export const AUTOMATE_TABS = {
129
126
  SCENARIO: 'scenario',
127
+ AUTOMATION: 'automation',
130
128
  };
131
129
 
132
130
  export const SMART_TIVI_BUTTON = {
@@ -149,36 +147,6 @@ export const SMART_TIVI_BUTTON = {
149
147
  CHANNEL_BUTTON: 'Channel',
150
148
  };
151
149
 
152
- export const AUTOMATE_SELECT = {
153
- SELECT_DEVICE: 'select_device',
154
- SELECT_SENSOR: 'select_sensor',
155
- };
156
-
157
- export const CONDITION_TYPES = {
158
- IS: 'IS',
159
- IS_BELOW: 'IS_BELOW',
160
- IS_ABOVE: 'IS_ABOVE',
161
- };
162
-
163
- export const STATE_VALUE_SENSOR_TYPES = [
164
- {
165
- type: 'smoke',
166
- stateValue: ['not_detected', 'detected'],
167
- },
168
- {
169
- type: 'fire',
170
- stateValue: ['not_detected', 'detected'],
171
- },
172
- {
173
- type: 'sos',
174
- stateValue: ['not_activated', 'activated'],
175
- },
176
- {
177
- type: 'door',
178
- stateValue: ['close', 'open'],
179
- },
180
- ];
181
-
182
150
  export const AUTOMATES = {
183
151
  one_tap: {
184
152
  value: AUTOMATE_TYPE.ONE_TAP,
@@ -204,18 +172,6 @@ export const AUTOMATES = {
204
172
  explanation: 'setup_the_conditions',
205
173
  icon: Event,
206
174
  },
207
- event_sensor: {
208
- value: AUTOMATE_TYPE.EVENT_SENSOR,
209
- title: 'event',
210
- explanation: 'setup_the_conditions',
211
- icon: Event,
212
- },
213
- event_action: {
214
- value: AUTOMATE_TYPE.EVENT_ACTION,
215
- title: 'event',
216
- explanation: 'setup_the_conditions',
217
- icon: Event,
218
- },
219
175
  };
220
176
 
221
177
  export const UNIT_TYPES = {
@@ -301,4 +257,14 @@ export const PROBLEM_CODE = {
301
257
 
302
258
  export const DATE_TIME_FORMAT = {
303
259
  YMD: 'YYYY-MM-DD',
260
+ DMY: 'DD-MM-YYYY',
261
+ DMY_HM: 'DD-MM-YYYY HH:mm',
262
+ };
263
+
264
+ export const CHART_GROUP_TYPE = {
265
+ HOUR: 'hour',
266
+ DAY: 'day',
267
+ WEEK: 'week',
268
+ MONTH: 'month',
269
+ YEAR: 'year',
304
270
  };
@@ -411,7 +411,9 @@ export const reducer = (currentState: ContextData, action: Action) => {
411
411
  valueEvaluations: _.reduce(
412
412
  data,
413
413
  (dict, item) => {
414
- dict[item.config] = item;
414
+ item.configs.map((configId) => {
415
+ dict[configId] = item;
416
+ });
415
417
  return dict;
416
418
  },
417
419
  currentState.valueEvaluations
@@ -11,7 +11,7 @@ describe('Test withRemoteControl', () => {
11
11
  const Component = () => <></>;
12
12
  const WrappedComponent = withRemoteControl(Component);
13
13
  await act(async () => {
14
- tree = renderer.create(
14
+ tree = await renderer.create(
15
15
  <SCProvider initState={mockSCStore({})}>
16
16
  <WrappedComponent />
17
17
  </SCProvider>
@@ -1,4 +1,4 @@
1
- import { useStatusBarPreview, useHiddenStatusBar } from '../useStatusBar';
1
+ import { setStatusBarPreview, setHiddenStatusBar } from '../useStatusBar';
2
2
 
3
3
  describe('test useStatusBarPreview', () => {
4
4
  let Platform;
@@ -8,21 +8,21 @@ describe('test useStatusBarPreview', () => {
8
8
 
9
9
  it('test useStatusBarPreview on android', async () => {
10
10
  Platform.OS = 'ios';
11
- useStatusBarPreview();
11
+ setStatusBarPreview();
12
12
  });
13
13
 
14
14
  it('test useStatusBarPreview on iOS', async () => {
15
15
  Platform.OS = 'android';
16
- useStatusBarPreview();
16
+ setStatusBarPreview();
17
17
  });
18
18
 
19
19
  it('test useHiddenStatusBar on android', async () => {
20
20
  Platform.OS = 'ios';
21
- useHiddenStatusBar(false);
21
+ setHiddenStatusBar(false);
22
22
  });
23
23
 
24
24
  it('test useHiddenStatusBar on iOS', async () => {
25
25
  Platform.OS = 'android';
26
- useHiddenStatusBar(true);
26
+ setHiddenStatusBar(true);
27
27
  });
28
28
  });
@@ -3,7 +3,6 @@ import useBoolean from './useBoolean';
3
3
  import useForceUpdate from './useForceUpdate';
4
4
  import useKeyboardShow from './useKeyboardShow';
5
5
  import usePopover from './usePopover';
6
- import useTitleHeader from './useTitleHeader';
7
6
  import useDevicesStatus from './useDevicesStatus';
8
7
  import { useBlockBackAndroid } from './useBlockBackAndroid';
9
8
  import { useIsOwnerOfUnit } from './useIsOwnerOfUnit';
@@ -16,7 +15,6 @@ export {
16
15
  useForceUpdate,
17
16
  useKeyboardShow,
18
17
  usePopover,
19
- useTitleHeader,
20
18
  useBlockBackAndroid,
21
19
  useIsOwnerOfUnit,
22
20
  useStatusBar,
@@ -42,12 +42,12 @@ const useKeyboardShow = (config = {}) => {
42
42
  }, [keyboardBottomPaddingAni]);
43
43
 
44
44
  useEffect(() => {
45
- Keyboard.addListener(showEvent, onKeyboardShow);
46
- Keyboard.addListener(hideEvent, onKeyboardHide);
45
+ const showSubscriber = Keyboard.addListener(showEvent, onKeyboardShow);
46
+ const hideSubscriber = Keyboard.addListener(hideEvent, onKeyboardHide);
47
47
 
48
48
  return () => {
49
- Keyboard.removeListener(showEvent, onKeyboardShow);
50
- Keyboard.removeListener(hideEvent, onKeyboardHide);
49
+ showSubscriber.remove();
50
+ hideSubscriber.remove();
51
51
  };
52
52
  }, [
53
53
  useWillShow,
@@ -10,8 +10,8 @@ export const useStatusBar = () => {
10
10
  };
11
11
  };
12
12
 
13
- export const useStatusBarPreview = (color = Colors.TextTransparent) =>
13
+ export const setStatusBarPreview = (color = Colors.TextTransparent) =>
14
14
  Platform.OS === 'android' && StatusBar.setBackgroundColor(color);
15
15
 
16
- export const useHiddenStatusBar = (hidden) =>
16
+ export const setHiddenStatusBar = (hidden) =>
17
17
  Platform.OS === 'android' && StatusBar.setHidden(hidden, true);
@@ -1,14 +1,12 @@
1
1
  import { useNavigation } from '@react-navigation/native';
2
- import { useLayoutEffect } from 'react';
2
+ import { useEffect } from 'react';
3
3
 
4
- import { useSCContextSelector } from '../../context';
5
- const useTitleHeader = (keyTitle) => {
4
+ const useTitleHeader = (title) => {
6
5
  const { setOptions } = useNavigation();
7
- const language = useSCContextSelector((state) => state.language);
8
- useLayoutEffect(() => {
6
+ useEffect(() => {
9
7
  setOptions({
10
- title: keyTitle,
8
+ title,
11
9
  });
12
- }, [keyTitle, language, setOptions]);
10
+ }, [setOptions, title]);
13
11
  };
14
12
  export default useTitleHeader;
@@ -11,6 +11,7 @@ import { sendCommandOverInternet } from '../../../iot/RemoteControl/Internet';
11
11
  import { SCProvider } from '../../../context';
12
12
  import { mockSCStore } from '../../../context/mockStore';
13
13
  import { ToastBottomHelper } from '../../../utils/Utils';
14
+ import { flushPromises } from '../../../screens/AllGateway/test-utils';
14
15
 
15
16
  jest.mock('../../../iot/RemoteControl/Bluetooth');
16
17
  jest.mock('../../../iot/RemoteControl/HomeAssistant');
@@ -60,6 +61,7 @@ describe('Test useRemoteControl', () => {
60
61
  await act(async () => {
61
62
  await sendRemoteCommand.current(sensor, action, data, userId);
62
63
  });
64
+ await flushPromises();
63
65
  expect(sendCommandOverInternet).not.toBeCalled();
64
66
  expect(sendCommandOverHomeAssistant).not.toBeCalled();
65
67
  expect(sendCommandOverBluetooth).not.toBeCalled();
@@ -74,6 +76,7 @@ describe('Test useRemoteControl', () => {
74
76
  await act(async () => {
75
77
  await sendRemoteCommand.current(sensor, action, data, userId);
76
78
  });
79
+ await flushPromises();
77
80
  expect(sendCommandOverBluetooth).toBeCalledWith(
78
81
  sensor,
79
82
  action,
@@ -98,6 +101,7 @@ describe('Test useRemoteControl', () => {
98
101
  await act(async () => {
99
102
  await sendRemoteCommand.current(sensor, action, data, userId);
100
103
  });
104
+ await flushPromises();
101
105
  expect(sendCommandOverBluetooth).toBeCalledWith(
102
106
  sensor,
103
107
  action,
@@ -134,6 +138,7 @@ describe('Test useRemoteControl', () => {
134
138
  await act(async () => {
135
139
  await sendRemoteCommand.current(sensor, action, data, userId);
136
140
  });
141
+ await flushPromises();
137
142
  expect(sendCommandOverBluetooth).toBeCalledWith(
138
143
  sensor,
139
144
  action,
@@ -171,6 +176,7 @@ describe('Test useRemoteControl', () => {
171
176
  expect(err).toBe('ANOTHER_ERROR');
172
177
  }
173
178
  });
179
+ await flushPromises();
174
180
  expect(sendCommandOverBluetooth).toBeCalledWith(
175
181
  sensor,
176
182
  action,
@@ -191,6 +197,7 @@ describe('Test useRemoteControl', () => {
191
197
  await act(async () => {
192
198
  await sendRemoteCommand.current(sensor, action, data, userId);
193
199
  });
200
+ await flushPromises();
194
201
  expect(sendCommandOverInternet).toBeCalledWith(
195
202
  sensor,
196
203
  action,
@@ -213,6 +220,7 @@ describe('Test useRemoteControl', () => {
213
220
  await act(async () => {
214
221
  await sendRemoteCommand.current(sensor, action, data, userId);
215
222
  });
223
+ await flushPromises();
216
224
  expect(sendCommandOverHomeAssistant).toBeCalledWith(
217
225
  {},
218
226
  sensor,
@@ -235,6 +243,7 @@ describe('Test useRemoteControl', () => {
235
243
  await act(async () => {
236
244
  await sendRemoteCommand.current(sensor, action, data, userId);
237
245
  });
246
+ await flushPromises();
238
247
  expect(sendCommandOverInternet).toBeCalledWith(
239
248
  sensor,
240
249
  action,
@@ -258,6 +267,7 @@ describe('Test useRemoteControl', () => {
258
267
  await act(async () => {
259
268
  await sendRemoteCommand.current(sensor, action, data, userId);
260
269
  });
270
+ await flushPromises();
261
271
  expect(sendCommandOverBluetooth).toBeCalledWith(
262
272
  sensor,
263
273
  action,
@@ -282,6 +292,7 @@ describe('Test useRemoteControl', () => {
282
292
  await act(async () => {
283
293
  await sendRemoteCommand.current(sensor, action, data, userId);
284
294
  });
295
+ await flushPromises();
285
296
  expect(sendCommandOverBluetooth).toBeCalledWith(
286
297
  sensor,
287
298
  action,
@@ -28,12 +28,15 @@ const useBluetoothConnection = (fnCallback) => {
28
28
  (state) => state.bluetooth.permissionsRequested
29
29
  );
30
30
 
31
+ const isBluetoothAllow = useSCContextSelector(
32
+ (state) => state.bluetooth.permissionsGranted
33
+ );
34
+
31
35
  const permissionsGranted = useMemo(() => {
32
36
  return Platform.OS === 'ios' || parseInt(getSystemVersion(), 10) < 12
33
37
  ? true
34
- : // eslint-disable-next-line react-hooks/rules-of-hooks
35
- useSCContextSelector((state) => state.bluetooth.permissionsGranted);
36
- }, []);
38
+ : isBluetoothAllow;
39
+ }, [isBluetoothAllow]);
37
40
 
38
41
  const onDeviceFound = useCallback(async (name, device) => {
39
42
  fnCallback && fnCallback({ name, device });
@@ -1,4 +1,3 @@
1
- import useInitDeepLink from './useInitDeepLink';
2
1
  import useReceiveNotifications from './useReceiveNotifications';
3
2
 
4
- export { useInitDeepLink, useReceiveNotifications };
3
+ export { useReceiveNotifications };