@eohjsc/react-native-smart-city 0.3.4 → 0.3.7

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 (293) hide show
  1. package/README.md +15 -36
  2. package/package.json +5 -9
  3. package/react-native-smart-city.podspec +0 -1
  4. package/src/commons/Action/ItemQuickAction.js +4 -16
  5. package/src/commons/Action/__test__/ItemQuickAction.test.js +6 -11
  6. package/src/commons/ActionGroup/ColorPickerTemplate.js +24 -37
  7. package/src/commons/ActionGroup/CurtainButtonTemplate.js +5 -10
  8. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +31 -12
  9. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +0 -4
  10. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +1 -1
  11. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +0 -14
  12. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +0 -1
  13. package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +2 -8
  14. package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +10 -10
  15. package/src/commons/ActionGroup/OnOffTemplate/index.js +2 -3
  16. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +9 -7
  17. package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -6
  18. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +3 -7
  19. package/src/commons/ActionGroup/StatesGridActionTemplate.js +8 -22
  20. package/src/commons/ActionGroup/TimerActionTemplate.js +3 -11
  21. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +5 -1
  22. package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +4 -53
  23. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +83 -3
  24. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +14 -14
  25. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +78 -53
  26. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +20 -36
  27. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +57 -1
  28. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +6 -58
  29. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +1 -49
  30. package/src/commons/ActionGroup/__test__/index.test.js +4 -142
  31. package/src/commons/Auth/AccountList.js +1 -1
  32. package/src/commons/Automate/ItemAutomate.js +3 -1
  33. package/src/commons/Connecting/__test__/Connecting.test.js +2 -19
  34. package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +3 -7
  35. package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +11 -8
  36. package/src/commons/ConnectingProcess/__test__/Connecting.test.js +3 -136
  37. package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +2 -3
  38. package/src/commons/ConnectingProcess/index.js +25 -75
  39. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +13 -16
  40. package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +1 -1
  41. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +5 -0
  42. package/src/commons/Device/ConnectedViewHeader.js +1 -1
  43. package/src/commons/Device/HistoryChart.js +3 -7
  44. package/src/commons/Device/ItemDevice.js +12 -19
  45. package/src/commons/Device/LinearChart.js +0 -15
  46. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +12 -16
  47. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +0 -3
  48. package/src/commons/Device/SonosSpeaker/index.js +1 -1
  49. package/src/commons/Device/WaterQualitySensor/ListQualityIndicator.js +0 -1
  50. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +2 -7
  51. package/src/commons/Explore/__test__/CityItem.test.js +54 -33
  52. package/src/commons/Form/CurrencyInput.js +1 -15
  53. package/src/commons/Form/TextInputPassword.js +1 -1
  54. package/src/commons/FullLoading/index.js +1 -2
  55. package/src/commons/Header/HeaderCustom.js +1 -2
  56. package/src/commons/HeaderAni/index.js +1 -6
  57. package/src/commons/HorizontalPicker/index.js +2 -2
  58. package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +6 -0
  59. package/src/commons/MediaPlayerDetail/index.js +47 -25
  60. package/src/commons/MenuActionAddnew/index.js +0 -1
  61. package/src/commons/MenuActionList/index.js +0 -1
  62. package/src/commons/MenuActionMore/index.js +1 -1
  63. package/src/commons/PreventAccess/index.js +1 -9
  64. package/src/commons/Sharing/MemberList.js +2 -10
  65. package/src/commons/Sharing/WrapHeaderScrollable.js +0 -2
  66. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -0
  67. package/src/commons/SubUnit/Favorites/index.js +3 -2
  68. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +35 -8
  69. package/src/commons/SubUnit/OneTap/index.js +2 -1
  70. package/src/commons/SubUnit/ShortDetail.js +9 -25
  71. package/src/commons/SubUnit/__test__/Item.test.js +1 -0
  72. package/src/commons/SubUnit/__test__/ShortDetail.test.js +2 -9
  73. package/src/commons/Unit/SharedUnit.js +0 -1
  74. package/src/commons/Unit/__test__/SharedUnit.test.js +183 -38
  75. package/src/commons/UnitSummary/ConfigHistoryChart/index.js +13 -2
  76. package/src/commons/UnitSummary/ConfigHistoryChart.js +13 -22
  77. package/src/commons/WheelDateTimePicker/index.js +3 -4
  78. package/src/configs/API.js +143 -87
  79. package/src/configs/Constants.js +2 -57
  80. package/src/configs/SCConfig.js +0 -4
  81. package/src/context/actionType.ts +0 -8
  82. package/src/context/mockStore.ts +0 -10
  83. package/src/context/reducer.ts +2 -38
  84. package/src/hooks/Common/index.js +0 -2
  85. package/src/hooks/Common/useGetIdUser.js +5 -1
  86. package/src/hooks/Common/useSensorsStatus.js +4 -4
  87. package/src/hooks/useReceiveNotifications.js +5 -9
  88. package/src/iot/Monitor.js +2 -3
  89. package/src/iot/RemoteControl/Bluetooth.js +1 -1
  90. package/src/iot/RemoteControl/GoogleHome.js +49 -75
  91. package/src/iot/RemoteControl/Internet.js +1 -1
  92. package/src/iot/RemoteControl/__test__/GoogleHome.test.js +48 -95
  93. package/src/iot/RemoteControl/__test__/Internet.test.js +7 -18
  94. package/src/iot/RemoteControl/__test__/LgThinq.test.js +177 -36
  95. package/src/iot/RemoteControl/index.js +52 -52
  96. package/src/navigations/UnitStack.js +20 -11
  97. package/src/screens/AQIGuide/index.js +1 -1
  98. package/src/screens/ActivityLog/FilterPopup.js +0 -2
  99. package/src/screens/ActivityLog/__test__/index.test.js +23 -38
  100. package/src/screens/ActivityLog/hooks/__test__/index.test.js +90 -51
  101. package/src/screens/ActivityLog/hooks/index.js +1 -1
  102. package/src/screens/ActivityLog/index.js +2 -2
  103. package/src/screens/AddCommon/SelectSubUnit.js +0 -1
  104. package/src/screens/AddCommon/SelectUnit.js +0 -1
  105. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +24 -13
  106. package/src/screens/AddCommon/__test__/SelectUnit.test.js +33 -9
  107. package/src/screens/AddLocationMaps/index.js +5 -9
  108. package/src/screens/AddNewAction/SelectAction.js +8 -8
  109. package/src/screens/AddNewAction/SelectSensorDevices.js +2 -8
  110. package/src/screens/AddNewAction/SetupSensor.js +7 -7
  111. package/src/screens/AddNewAction/__test__/SelectAction.test.js +91 -10
  112. package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +26 -40
  113. package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +1 -3
  114. package/src/screens/AddNewAutoSmart/index.js +2 -5
  115. package/src/screens/AddNewDevice/ConnectingDevices.js +3 -3
  116. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +34 -42
  117. package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +4 -0
  118. package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +22 -22
  119. package/src/screens/AddNewDevice/hooks/ConnectDevices.js +1 -1
  120. package/src/screens/AddNewDevice/index.js +0 -1
  121. package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +17 -23
  122. package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +4 -7
  123. package/src/screens/AddNewGateway/SelectGateway.js +0 -1
  124. package/src/screens/AddNewGateway/SetupGatewayWifi.js +0 -2
  125. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +6 -4
  126. package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +4 -0
  127. package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +29 -5
  128. package/src/screens/AddNewGateway/__test__/SelectGateway.test.js +4 -0
  129. package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +4 -0
  130. package/src/screens/AddNewGateway/index.js +0 -1
  131. package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +24 -10
  132. package/src/screens/AddNewOneTap/index.js +2 -3
  133. package/src/screens/AllCamera/index.js +4 -4
  134. package/src/screens/Automate/MultiUnits.js +8 -8
  135. package/src/screens/Automate/__test__/MultiUnits.test.js +9 -6
  136. package/src/screens/Automate/__test__/index.test.js +12 -7
  137. package/src/screens/Automate/index.js +3 -5
  138. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +8 -36
  139. package/src/screens/ConfirmUnitDeletion/index.js +1 -7
  140. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +22 -71
  141. package/src/screens/Device/EditDevice/index.js +15 -17
  142. package/src/screens/Device/__test__/detail.test.js +86 -33
  143. package/src/screens/Device/components/DetailHistoryChart.js +1 -1
  144. package/src/screens/Device/components/SensorConnectStatusViewHeader.js +0 -1
  145. package/src/screens/Device/components/SensorDisplayItem.js +2 -5
  146. package/src/screens/Device/detail.js +24 -80
  147. package/src/screens/Device/hooks/useDisconnectedDevice.js +4 -4
  148. package/src/screens/Device/hooks/useFavoriteDevice.js +9 -5
  149. package/src/screens/DeviceInfo/__test__/index.test.js +2 -0
  150. package/src/screens/EditActionsList/index.js +1 -1
  151. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -6
  152. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +19 -7
  153. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +2 -20
  154. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +23 -40
  155. package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
  156. package/src/screens/EmergencySetting/index.js +1 -4
  157. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +25 -41
  158. package/src/screens/Explore/index.js +0 -2
  159. package/src/screens/GuestInfo/__test__/index.test.js +41 -14
  160. package/src/screens/GuestInfo/components/RecurringDetail.js +0 -1
  161. package/src/screens/GuestInfo/components/TemporaryDetail.js +2 -2
  162. package/src/screens/HanetCamera/Detail.js +1 -1
  163. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +12 -8
  164. package/src/screens/HanetCamera/__test__/Detail.test.js +42 -27
  165. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +5 -8
  166. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +32 -10
  167. package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -3
  168. package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +35 -43
  169. package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +21 -10
  170. package/src/screens/HanetCamera/hooks/useHanetCheckinData.js +11 -11
  171. package/src/screens/HanetCamera/hooks/useHanetPlaceMembers.js +11 -11
  172. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +22 -33
  173. package/src/screens/ManageAccess/hooks/__test__/useManageAccess.test.js +45 -44
  174. package/src/screens/ManageAccess/hooks/index.js +4 -7
  175. package/src/screens/ManageAccess/index.js +1 -2
  176. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +12 -35
  177. package/src/screens/MoveToAnotherSubUnit/index.js +6 -6
  178. package/src/screens/Notification/__test__/Notification.test.js +25 -14
  179. package/src/screens/Notification/__test__/NotificationItem.test.js +7 -8
  180. package/src/screens/Notification/components/NotificationItem.js +20 -17
  181. package/src/screens/Notification/index.js +2 -9
  182. package/src/screens/PlayBackCamera/Timer.js +2 -2
  183. package/src/screens/PlayBackCamera/__test__/index.test.js +2 -87
  184. package/src/screens/PlayBackCamera/index.js +6 -22
  185. package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +20 -7
  186. package/src/screens/ScanChipQR/components/QRScan/index.js +0 -1
  187. package/src/screens/ScanChipQR/hooks/index.js +16 -15
  188. package/src/screens/ScanSensorQR/__test__/ScanSensorQR.test.js +24 -8
  189. package/src/screens/ScriptDetail/__test__/index.test.js +86 -17
  190. package/src/screens/ScriptDetail/index.js +14 -19
  191. package/src/screens/SelectUnit/__test__/index.test.js +55 -12
  192. package/src/screens/SelectUnit/index.js +4 -9
  193. package/src/screens/SetSchedule/index.js +11 -15
  194. package/src/screens/SharedUnit/__test__/TabHeader.test.js +2 -0
  195. package/src/screens/SharedUnit/index.js +0 -2
  196. package/src/screens/Sharing/Components/SensorItem.js +12 -10
  197. package/src/screens/Sharing/InfoMemberUnit.js +1 -1
  198. package/src/screens/Sharing/MemberList.js +11 -12
  199. package/src/screens/Sharing/SelectPermission.js +76 -121
  200. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +29 -47
  201. package/src/screens/Sharing/__test__/MemberList.test.js +127 -13
  202. package/src/screens/Sharing/__test__/SelectPermission.test.js +38 -28
  203. package/src/screens/Sharing/__test__/SelectUser.test.js +38 -17
  204. package/src/screens/Sharing/hooks/index.js +0 -3
  205. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +2 -3
  206. package/src/screens/SmartIr/components/SelectBrand.js +1 -1
  207. package/src/screens/SubUnit/AddSubUnit.js +17 -23
  208. package/src/screens/SubUnit/Detail.js +2 -1
  209. package/src/screens/SubUnit/EditSubUnit.js +13 -15
  210. package/src/screens/SubUnit/ManageSubUnit.js +7 -13
  211. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +89 -29
  212. package/src/screens/SubUnit/__test__/Detail.test.js +8 -31
  213. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +89 -21
  214. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +1 -27
  215. package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +45 -48
  216. package/src/screens/SubUnit/hooks/useManageSubUnit.js +7 -7
  217. package/src/screens/SyncLGDevice/AddLGDevice.js +0 -1
  218. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +91 -22
  219. package/src/screens/TDSGuide/index.js +1 -4
  220. package/src/screens/UVIndexGuide/index.js +1 -1
  221. package/src/screens/Unit/ChooseLocation.js +14 -7
  222. package/src/screens/Unit/Detail.js +75 -30
  223. package/src/screens/Unit/ManageUnit.js +0 -1
  224. package/src/screens/Unit/SelectAddress.js +23 -45
  225. package/src/screens/Unit/SmartAccount.js +4 -4
  226. package/src/screens/Unit/Station/index.js +0 -4
  227. package/src/screens/Unit/Summaries.js +2 -18
  228. package/src/screens/Unit/__test__/CheckSendEmail.test.js +29 -24
  229. package/src/screens/Unit/__test__/ChooseLocation.test.js +14 -27
  230. package/src/screens/Unit/__test__/Detail.test.js +200 -99
  231. package/src/screens/Unit/__test__/ManageUnit.test.js +42 -18
  232. package/src/screens/Unit/__test__/SelectAddress.test.js +49 -159
  233. package/src/screens/Unit/__test__/SmartAccount.test.js +9 -17
  234. package/src/screens/Unit/__test__/SmartAccountItem.test.js +1 -0
  235. package/src/screens/Unit/components/MyUnitDevice/index.js +4 -4
  236. package/src/screens/Unit/components/SharedUnit/index.js +0 -1
  237. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
  238. package/src/screens/Unit/components/__test__/SharedUnit.test.js +34 -31
  239. package/src/screens/Unit/styles.js +0 -4
  240. package/src/screens/UnitSummary/__test__/index.test.js +30 -91
  241. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +2 -31
  242. package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/__test__/index.test.js +4 -7
  243. package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/index.js +13 -2
  244. package/src/screens/UnitSummary/components/PowerConsumption/__test__/ItemPower.test.js +1 -0
  245. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +16 -14
  246. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +2 -11
  247. package/src/screens/UnitSummary/components/RunningDevices/index.js +10 -7
  248. package/src/screens/UnitSummary/components/Temperature/index.js +4 -4
  249. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +2 -10
  250. package/src/screens/UnitSummary/index.js +1 -15
  251. package/src/screens/WaterQualityGuide/index.js +1 -1
  252. package/src/utils/Apis/axios.js +31 -54
  253. package/src/utils/Converter/time.js +18 -0
  254. package/src/utils/I18n/translations/en.json +1 -7
  255. package/src/utils/I18n/translations/vi.json +1 -8
  256. package/src/utils/Route/index.js +0 -1
  257. package/src/utils/Utils.js +7 -11
  258. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +0 -24
  259. package/src/commons/ActionGroup/__test__/NumberUpDownTemplateWithNullConfigValue.test.js +0 -60
  260. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +0 -77
  261. package/src/commons/Calendar/__test__/Calendar.test.js +0 -33
  262. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +0 -58
  263. package/src/commons/FieldTemplate/ChooseUserField/ChooseFieldStyles.js +0 -25
  264. package/src/commons/FieldTemplate/ChooseUserField/ChoosePopup.js +0 -96
  265. package/src/commons/FieldTemplate/ChooseUserField/ChoosePopupStyles.js +0 -39
  266. package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +0 -118
  267. package/src/commons/FieldTemplate/ChooseUserField/index.js +0 -62
  268. package/src/commons/FieldTemplate/PasscodeField/PasscodeFieldStyles.js +0 -30
  269. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +0 -90
  270. package/src/commons/FieldTemplate/PasscodeField/index.js +0 -43
  271. package/src/commons/FieldTemplate/ScheduleField/ScheduleFieldStyles.js +0 -13
  272. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +0 -179
  273. package/src/commons/FieldTemplate/ScheduleField/index.js +0 -176
  274. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +0 -62
  275. package/src/hooks/Common/useGGHomeDeviceConnected.js +0 -16
  276. package/src/hooks/IoT/__test__/useGGHomeConnection.test.js +0 -198
  277. package/src/hooks/IoT/__test__/useRemoteControl.test.js +0 -198
  278. package/src/hooks/IoT/index.js +0 -4
  279. package/src/hooks/IoT/useGGHomeConnection.js +0 -91
  280. package/src/hooks/IoT/useRemoteControl.js +0 -79
  281. package/src/hooks/index.js +0 -4
  282. package/src/navigations/UnitStackStyles.js +0 -21
  283. package/src/screens/Sharing/__test__/MemberList2.test.js +0 -80
  284. package/src/screens/SideMenuDetail/SideMenuDetailStyles.js +0 -28
  285. package/src/screens/SideMenuDetail/__test__/index.test.js +0 -154
  286. package/src/screens/SideMenuDetail/index.js +0 -148
  287. package/src/screens/Unit/__test__/Summaries.test.js +0 -100
  288. package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +0 -36
  289. package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -54
  290. package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +0 -50
  291. package/src/utils/Permission/common.js +0 -67
  292. package/src/utils/Setting/Location.js +0 -30
  293. package/src/utils/__test__/Utils.test.js +0 -12
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { act, create } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
4
3
 
5
4
  import MyPinnedSharedUnit from '../index';
6
5
  import { Text } from 'react-native';
@@ -10,9 +9,9 @@ import { mockSCStore } from '../../../../context/mockStore';
10
9
  import { TESTID } from '../../../../configs/Constants';
11
10
  import { API } from '../../../../configs';
12
11
  import { TouchableOpacity } from 'react-native';
13
- import api from '../../../../utils/Apis/axios';
12
+ import axios from 'axios';
14
13
 
15
- const mock = new MockAdapter(api.axiosInstance);
14
+ jest.mock('axios');
16
15
 
17
16
  const mockedNavigate = jest.fn();
18
17
  jest.mock('@react-navigation/native', () => {
@@ -33,14 +32,21 @@ const wrapComponent = (route) => (
33
32
 
34
33
  describe('Test MyPinnedSharedUnit', () => {
35
34
  let tree;
35
+ afterEach(() => {
36
+ axios.get.mockClear();
37
+ });
36
38
 
37
39
  test('create', async () => {
38
- mock.onGet(API.UNIT.SHARED_UNITS()).reply(200, [{ id: 1 }]);
39
-
40
+ const response = {
41
+ status: 200,
42
+ data: [{ id: 1 }],
43
+ };
44
+ axios.get.mockImplementation(async () => {
45
+ return response;
46
+ });
40
47
  await act(async () => {
41
48
  tree = await create(wrapComponent());
42
49
  });
43
-
44
50
  const instance = tree.root;
45
51
  const texts = instance.findAllByType(Text);
46
52
  expect(texts).toHaveLength(4);
@@ -59,15 +65,6 @@ describe('Test MyPinnedSharedUnit', () => {
59
65
  goToAllSharedUnits.props.onPress();
60
66
  });
61
67
  expect(mockedNavigate).toHaveBeenCalled();
62
- });
63
-
64
- test('render without item', async () => {
65
- mock.onGet(API.UNIT.SHARED_UNITS()).reply(400, []);
66
- await act(async () => {
67
- tree = await create(wrapComponent());
68
- });
69
- const instance = tree.root;
70
- const texts = instance.findAllByType(Text);
71
- expect(texts).toHaveLength(4);
68
+ expect(axios.get).toHaveBeenCalledWith(API.UNIT.SHARED_UNITS(), {});
72
69
  });
73
70
  });
@@ -60,7 +60,7 @@ const MyPinnedSharedUnit = () => {
60
60
  {sharedUnits &&
61
61
  Boolean(sharedUnits.length) &&
62
62
  sharedUnits
63
- .filter((sharedUnit) => sharedUnit?.is_pin)
63
+ .filter((sharedUnit) => sharedUnit.is_pin)
64
64
  .map((item, index) => (
65
65
  <View key={item.id}>
66
66
  <SharedUnit
@@ -4,7 +4,9 @@ import MyUnit from '..';
4
4
  import { TESTID } from '../../../../configs/Constants';
5
5
  import { SCProvider } from '../../../../context';
6
6
  import { mockSCStore } from '../../../../context/mockStore';
7
+ import axios from 'axios';
7
8
 
9
+ jest.mock('axios');
8
10
  const mockedNavigate = jest.fn();
9
11
  const mockUseIsFocused = jest.fn();
10
12
  const mockedDispatch = jest.fn();
@@ -34,6 +36,9 @@ const wrapComponent = () => (
34
36
 
35
37
  describe('Test MyUnit', () => {
36
38
  let tree;
39
+ beforeEach(() => {
40
+ axios.get.mockClear();
41
+ });
37
42
  const getElement = (instance) => {
38
43
  const goToDetail = instance.findAll(
39
44
  (item) => item.props.testID === TESTID.MY_UNIT_GO_TO_DETAIL
@@ -29,7 +29,7 @@ const ConnectedViewHeader = memo(
29
29
  const t = useTranslations();
30
30
  const lastUpdatedStr = lastUpdated
31
31
  ? timeDifference(new Date(), lastUpdated)
32
- : `5 ${t('seconds_ago')}`;
32
+ : null;
33
33
  return (
34
34
  <View style={styles.statusContainer}>
35
35
  <View style={styles.connectStatus}>
@@ -151,12 +151,12 @@ const HistoryChart = memo(
151
151
  if (configuration.config !== 'power_consumption') {
152
152
  return null;
153
153
  }
154
- const { price: chartPrice } = chartConfig;
155
- if (chartPrice === '' || isNaN(chartPrice)) {
154
+ const { price } = chartConfig;
155
+ if (price === '' || isNaN(price)) {
156
156
  return null;
157
157
  }
158
158
  const sum = datas[0].data.reduce((a, b) => a + b.y, 0);
159
- const roundedSum = sum * chartPrice;
159
+ const roundedSum = sum * price;
160
160
  return roundedSum.toFixed();
161
161
  }, [configuration, datas, chartConfig]);
162
162
 
@@ -239,8 +239,6 @@ const HistoryChart = memo(
239
239
  onConfirm={onConfirmStart}
240
240
  onCancel={onCancel}
241
241
  display="spinner"
242
- cancelTextIOS={t('cancel')}
243
- confirmTextIOS={t('confirm')}
244
242
  />
245
243
  <DateTimePickerModal
246
244
  isVisible={eventPicker.showModalEnd}
@@ -249,8 +247,6 @@ const HistoryChart = memo(
249
247
  onConfirm={onConfirmEnd}
250
248
  onCancel={onCancel}
251
249
  display="spinner"
252
- cancelTextIOS={t('cancel')}
253
- confirmTextIOS={t('confirm')}
254
250
  />
255
251
  </View>
256
252
  );
@@ -11,9 +11,8 @@ import { useNavigation } from '@react-navigation/native';
11
11
  import { useTranslations } from '../../hooks/Common/useTranslations';
12
12
  import ItemQuickAction from '../../commons/Action/ItemQuickAction';
13
13
  import Text from '../../commons/Text';
14
- import { isDeviceConnected as isBluetoothDeviceConnected } from '../../iot/RemoteControl/Bluetooth';
14
+ import { isDeviceConnected } from '../../iot/RemoteControl/Bluetooth';
15
15
  import { useSCContextSelector } from '../../context';
16
- import { useGGHomeDeviceConnected } from '../../hooks/Common';
17
16
 
18
17
  import { Colors } from '../../configs';
19
18
  import { TESTID, DEVICE_TYPE, DEVICE_SIZE } from '../../configs/Constants';
@@ -27,6 +26,7 @@ const ItemDevice = memo(
27
26
  sensor,
28
27
  unit,
29
28
  station,
29
+ isGGHomeConnected,
30
30
  serverDown,
31
31
  status,
32
32
  wrapStyle,
@@ -39,7 +39,6 @@ const ItemDevice = memo(
39
39
  const isNetworkConnected = useSCContextSelector(
40
40
  (state) => state.app.isNetworkConnected
41
41
  );
42
- const { isConnected: isGGHomeConnected } = useGGHomeDeviceConnected(sensor);
43
42
 
44
43
  const goToSensorDisplay = useCallback(() => {
45
44
  navigation.navigate(Routes.DeviceDetail, {
@@ -47,35 +46,29 @@ const ItemDevice = memo(
47
46
  station,
48
47
  sensorData: sensor,
49
48
  title,
49
+ isGGHomeConnected,
50
50
  });
51
- }, [navigation, sensor, station, title, unit]);
51
+ }, [navigation, sensor, station, title, unit, isGGHomeConnected]);
52
52
 
53
53
  const isConnectedViaInternet =
54
54
  status === undefined
55
55
  ? !serverDown && isNetworkConnected && sensor.is_connected
56
56
  : !serverDown && isNetworkConnected && status.is_connected;
57
-
58
57
  const isConnectedViaBLE =
59
58
  isBluetoothEnabled &&
60
- isBluetoothDeviceConnected(
61
- sensor?.remote_control_options?.bluetooth?.address
62
- );
63
-
59
+ isDeviceConnected(sensor?.remote_control_options?.bluetooth?.address);
60
+ const isConnectedViaGGHome =
61
+ !!sensor &&
62
+ sensor?.is_other_device &&
63
+ !sensor?.device_type !== DEVICE_TYPE.LG_THINQ &&
64
+ isGGHomeConnected;
64
65
  const isConnected =
65
- !!sensor && sensor?.is_other_device
66
- ? sensor?.device_type === DEVICE_TYPE.LG_THINQ
67
- ? true
68
- : isGGHomeConnected
69
- : isConnectedViaInternet || isConnectedViaBLE;
70
-
66
+ isConnectedViaInternet || isConnectedViaGGHome || isConnectedViaBLE;
71
67
  const borderColor = isConnected ? Colors.Gray4 : Colors.Red6;
72
68
  const textConnected = isConnected ? t('connected') : t('disconnected');
73
69
 
74
70
  return (
75
- <TouchableWithoutFeedback
76
- onPress={goToSensorDisplay}
77
- testID={`${TESTID.SENSOR_NAME}-${sensor?.id}`}
78
- >
71
+ <TouchableWithoutFeedback onPress={goToSensorDisplay}>
79
72
  <View
80
73
  style={[styles.container, wrapStyle, { borderColor }]}
81
74
  testID={TESTID.SUB_UNIT_DEVICES}
@@ -52,21 +52,6 @@ const chartOptions = {
52
52
  format: '{value:%d.%m %H:%M}',
53
53
  },
54
54
  },
55
- legend: {
56
- useHTML: true,
57
- labelFormatter: function () {
58
- if (this.visible) {
59
- return (
60
- '<span style="color:#333333;font-weight:bold">' +
61
- this.name +
62
- '</span>'
63
- );
64
- }
65
- return (
66
- '<span style="color:#cccccc;font-weight:bold">' + this.name + '</span>'
67
- );
68
- },
69
- },
70
55
  };
71
56
 
72
57
  function LinearChart({ datas }) {
@@ -1,5 +1,4 @@
1
1
  import React, { memo, useCallback } from 'react';
2
- import { View } from 'react-native';
3
2
  import { FlatList } from 'react-native';
4
3
  import QualityIndicatorItem from '../WaterQualitySensor/QualityIndicatorsItem';
5
4
  import styles from './PMSensorIndicatorStyles';
@@ -27,21 +26,18 @@ const PMSensorIndicatior = memo(({ data, style }) => {
27
26
  const isScrollMode = data.length > 3;
28
27
 
29
28
  return (
30
- <View style={styles.wrap}>
31
- <FlatList
32
- bounces={false}
33
- numColumns={1}
34
- horizontal={true}
35
- contentContainerStyle={[
36
- styles.standard,
37
- !isScrollMode && styles.centerItem,
38
- ]}
39
- data={data}
40
- keyExtractor={keyExtractor}
41
- renderItem={renderItem}
42
- scrollIndicatorInsets={{ right: 1 }}
43
- />
44
- </View>
29
+ <FlatList
30
+ bounces={false}
31
+ numColumns={1}
32
+ horizontal={true}
33
+ contentContainerStyle={[
34
+ styles.standard,
35
+ !isScrollMode && styles.centerItem,
36
+ ]}
37
+ data={data}
38
+ keyExtractor={keyExtractor}
39
+ renderItem={renderItem}
40
+ />
45
41
  );
46
42
  });
47
43
 
@@ -10,7 +10,4 @@ export default StyleSheet.create({
10
10
  flex: 1,
11
11
  justifyContent: 'center',
12
12
  },
13
- wrap: {
14
- marginVertical: 16,
15
- },
16
13
  });
@@ -69,7 +69,7 @@ const SonosSpeaker = memo(() => {
69
69
  <View style={styles.containerSlider}>
70
70
  <Slider
71
71
  value={value}
72
- onValueChange={setValue}
72
+ onValueChange={(value) => setValue(value)}
73
73
  step={1}
74
74
  minimumValue={0}
75
75
  maximumValue={100}
@@ -27,7 +27,6 @@ const ListQualityIndicator = ({ data, style }) => {
27
27
  showsHorizontalScrollIndicator={false}
28
28
  nestedScrollEnabled
29
29
  contentContainerStyle={[styles.flatlistContent, style]}
30
- scrollIndicatorInsets={{ right: 1 }}
31
30
  />
32
31
  </View>
33
32
  );
@@ -37,7 +37,7 @@ const QualityIndicatorItem = memo(
37
37
  >
38
38
  <IconOutline
39
39
  name={'info-circle'}
40
- size={18}
40
+ size={16}
41
41
  color={Colors.Gray8}
42
42
  />
43
43
  </TouchableOpacity>
@@ -92,11 +92,6 @@ const styles = StyleSheet.create({
92
92
  marginTop: 8,
93
93
  },
94
94
  iconInfo: {
95
- width: 40,
96
- height: 40,
97
- justifyContent: 'center',
98
- alignItems: 'center',
99
- marginRight: -10,
100
- marginTop: -2,
95
+ top: 10,
101
96
  },
102
97
  });
@@ -2,15 +2,12 @@ import React from 'react';
2
2
  import renderer, { act } from 'react-test-renderer';
3
3
  import CityItem from '../CityItem';
4
4
  import { TouchableOpacity } from 'react-native';
5
+ import axios from 'axios';
5
6
  import { API } from '../../../configs';
6
7
  import Pin from '../../../../assets/images/Explore/Pin.svg';
7
8
  import PinOutline from '../../../../assets/images/Explore/PinOutline.svg';
8
9
  import { SCProvider } from '../../../context';
9
10
  import { mockSCStore } from '../../../context/mockStore';
10
- import MockAdapter from 'axios-mock-adapter';
11
- import api from '../../../utils/Apis/axios';
12
-
13
- const mock = new MockAdapter(api.axiosInstance);
14
11
 
15
12
  const mockedDispatch = jest.fn();
16
13
 
@@ -20,6 +17,7 @@ const wrapComponent = (item, mockeSelect) => (
20
17
  </SCProvider>
21
18
  );
22
19
 
20
+ jest.mock('axios');
23
21
  jest.mock('react-redux', () => ({
24
22
  ...jest.requireActual('react-redux'),
25
23
  useDispatch: () => mockedDispatch,
@@ -27,6 +25,9 @@ jest.mock('react-redux', () => ({
27
25
 
28
26
  describe('Test CityItem', () => {
29
27
  let tree;
28
+ afterEach(() => {
29
+ axios.post.mockClear();
30
+ });
30
31
 
31
32
  test('render CityItem is_pin: true', async () => {
32
33
  const item = {
@@ -37,23 +38,37 @@ describe('Test CityItem', () => {
37
38
  count_pin: 1,
38
39
  };
39
40
  const mockeSelect = jest.fn();
40
- mock.onPost(API.UNIT.PIN_UNIT()).reply(200);
41
+ const response = {
42
+ status: 200,
43
+ };
44
+
45
+ axios.post.mockImplementation(async () => {
46
+ return response;
47
+ });
41
48
  await act(async () => {
42
49
  tree = await renderer.create(wrapComponent(item, mockeSelect));
43
50
  });
44
51
  const instance = tree.root;
45
52
  const buttons = instance.findAllByType(TouchableOpacity);
46
53
  expect(buttons.length).toBe(2);
47
- await buttons[0].props.onPress();
54
+ await act(async () => {
55
+ await buttons[0].props.onPress();
56
+ });
48
57
  expect(mockeSelect).toHaveBeenCalledTimes(1);
58
+
49
59
  const pin = instance.findAllByType(Pin);
50
60
  expect(pin.length).toBe(2);
51
- mock.onPost(API.UNIT.PIN_UNIT()).reply(200);
52
- await pin[1].props.onPress();
61
+ await act(async () => {
62
+ await pin[1].props.onPress();
63
+ });
64
+ expect(axios.post).toHaveBeenCalledWith(API.UNIT.UNPIN_UNIT(1));
65
+
53
66
  const unpin = instance.findAllByType(PinOutline);
54
- mock.onPost(API.UNIT.UNPIN_UNIT(1)).reply(200);
55
- await unpin[1].props.onPress();
56
67
  expect(unpin.length).toBe(2);
68
+ await act(async () => {
69
+ await unpin[1].props.onPress();
70
+ });
71
+ expect(axios.post).toHaveBeenCalledWith(API.UNIT.UNPIN_UNIT(1));
57
72
  });
58
73
 
59
74
  test('render CityItem is_pin: false', async () => {
@@ -65,33 +80,24 @@ describe('Test CityItem', () => {
65
80
  count_pin: 1,
66
81
  };
67
82
  const mockeSelect = jest.fn();
83
+ const response = {
84
+ status: 200,
85
+ };
86
+
87
+ axios.post.mockImplementation(async () => {
88
+ return response;
89
+ });
68
90
  await act(async () => {
69
91
  tree = await renderer.create(wrapComponent(item, mockeSelect));
70
92
  });
71
93
  const instance = tree.root;
94
+
72
95
  const unpin = instance.findAllByType(PinOutline);
73
- mock.onPost(API.UNIT.PIN_UNIT(1)).reply(200);
74
- await unpin[1].props.onPress();
75
96
  expect(unpin.length).toBe(2);
76
- });
77
-
78
- test('render CityItem is_pin: false and call api false', async () => {
79
- const item = {
80
- id: 1,
81
- name: 'name',
82
- icon: 'icon',
83
- is_pin: false,
84
- count_pin: 1,
85
- };
86
- const mockeSelect = jest.fn();
87
97
  await act(async () => {
88
- tree = await renderer.create(wrapComponent(item, mockeSelect));
98
+ await unpin[1].props.onPress();
89
99
  });
90
- const instance = tree.root;
91
- const unpin = instance.findAllByType(PinOutline);
92
- mock.onPost(API.UNIT.PIN_UNIT(1)).reply(400);
93
- await unpin[1].props.onPress();
94
- expect(unpin.length).toBe(2);
100
+ expect(axios.post).toHaveBeenCalledWith(API.UNIT.PIN_UNIT(1));
95
101
  });
96
102
 
97
103
  test('render CityItem PinOutline axios.post response false', async () => {
@@ -103,14 +109,22 @@ describe('Test CityItem', () => {
103
109
  count_pin: 1,
104
110
  };
105
111
  const mockeSelect = jest.fn();
106
- mock.onPost(API.UNIT.PIN_UNIT()).reply(200, {});
112
+ const response = {};
113
+
114
+ axios.post.mockImplementation(async () => {
115
+ return response;
116
+ });
107
117
  await act(async () => {
108
118
  tree = await renderer.create(wrapComponent(item, mockeSelect));
109
119
  });
110
120
  const instance = tree.root;
121
+
111
122
  const unpin = instance.findAllByType(PinOutline);
112
- await unpin[1].props.onPress();
113
123
  expect(unpin.length).toBe(2);
124
+ await act(async () => {
125
+ await unpin[1].props.onPress();
126
+ });
127
+ expect(axios.post).not.toHaveBeenCalledWith(API.UNIT.UNPIN_UNIT(1));
114
128
  });
115
129
 
116
130
  test('render CityItem Pin axios.post response false', async () => {
@@ -122,14 +136,21 @@ describe('Test CityItem', () => {
122
136
  count_pin: 1,
123
137
  };
124
138
  const mockeSelect = jest.fn();
125
- mock.onPost(API.UNIT.UNPIN_UNIT(1)).reply(400, {});
139
+ const response = {};
140
+
141
+ axios.post.mockImplementation(async () => {
142
+ return response;
143
+ });
126
144
  await act(async () => {
127
145
  tree = await renderer.create(wrapComponent(item, mockeSelect));
128
146
  });
129
147
  const instance = tree.root;
130
148
  const pin = instance.findAllByType(Pin);
131
- await pin[1].props.onPress();
132
149
  expect(pin.length).toBe(2);
150
+ await act(async () => {
151
+ await pin[1].props.onPress();
152
+ });
153
+ expect(axios.post).toHaveBeenCalledWith(API.UNIT.UNPIN_UNIT(1));
133
154
  });
134
155
 
135
156
  test('render CityItem icon null', async () => {
@@ -1,10 +1,4 @@
1
- import React, {
2
- useState,
3
- useRef,
4
- useCallback,
5
- useMemo,
6
- useEffect,
7
- } from 'react';
1
+ import React, { useState, useRef, useCallback, useMemo } from 'react';
8
2
  import {
9
3
  View,
10
4
  TextInput,
@@ -12,7 +6,6 @@ import {
12
6
  TouchableWithoutFeedback,
13
7
  Platform,
14
8
  } from 'react-native';
15
- import AndroidKeyboardAdjust from 'react-native-android-keyboard-adjust';
16
9
  import Text from '../Text';
17
10
  import { Colors } from '../../configs';
18
11
 
@@ -132,13 +125,6 @@ const CurrencyInput = ({
132
125
  return textInputValue.toString().length < 2 ? -12 : 0;
133
126
  }, [textInputValue]);
134
127
 
135
- useEffect(() => {
136
- const isAndroid = Platform.OS === 'android';
137
- isAndroid && AndroidKeyboardAdjust.setAdjustResize();
138
-
139
- return () => isAndroid && AndroidKeyboardAdjust.setAdjustPan();
140
- }, []);
141
-
142
128
  return (
143
129
  <TouchableWithoutFeedback onPress={focusInput}>
144
130
  <View style={styles.wrap}>
@@ -90,7 +90,7 @@ const styles = StyleSheet.create({
90
90
  borderRadius: 2,
91
91
  paddingTop: 12,
92
92
  paddingBottom: 12,
93
- paddingRight: 20,
93
+ paddingHorizontal: 20,
94
94
  backgroundColor: Colors.White,
95
95
  // ...Theme.shadow,
96
96
  shadowColor: Colors.Gray13,
@@ -22,8 +22,7 @@ const styles = StyleSheet.create({
22
22
  left: 0,
23
23
  bottom: 0,
24
24
  right: 0,
25
- zIndex: 1000, // works on ios
26
- elevation: 1000, // works on android
25
+ zIndex: 10,
27
26
  },
28
27
  background: {
29
28
  backgroundColor: colorOpacity(Colors.White, 0.8),
@@ -6,7 +6,6 @@ import { Icon } from '@ant-design/react-native';
6
6
  import { useNavigation } from '@react-navigation/native';
7
7
  import styles from './Styles/HeaderCustomStyles';
8
8
  import { useTranslations } from '../../hooks/Common/useTranslations';
9
- import { notImplemented } from '../../utils/Utils';
10
9
 
11
10
  const HeaderCustom = ({
12
11
  title = '',
@@ -34,7 +33,7 @@ const HeaderCustom = ({
34
33
  };
35
34
 
36
35
  const handleClose = useCallback(() => {
37
- onClose ? onClose() : notImplemented(t);
36
+ onClose ? onClose() : alert(t('feature_under_development'));
38
37
  // eslint-disable-next-line react-hooks/exhaustive-deps
39
38
  }, []);
40
39
 
@@ -6,7 +6,6 @@ import { getStatusBarHeight } from 'react-native-iphone-x-helper';
6
6
 
7
7
  import Text from '../../commons/Text';
8
8
  import { Colors, Constants } from '../../configs';
9
- import { TESTID } from '../../configs/Constants';
10
9
 
11
10
  const screenHeight = Constants.height;
12
11
  const default_height = 44;
@@ -90,11 +89,7 @@ const HeaderAni = memo(
90
89
  },
91
90
  ]}
92
91
  >
93
- <TouchableOpacity
94
- style={styles.btnBack}
95
- onPress={onPressLeft}
96
- testID={TESTID.ICON_BACK}
97
- >
92
+ <TouchableOpacity style={styles.btnBack} onPress={onPressLeft}>
98
93
  <Icon name={'left'} size={27} color={Colors.Gray9} />
99
94
  </TouchableOpacity>
100
95
  <View styles={styles.wrapRightComponent}>{rightComponent}</View>
@@ -76,8 +76,8 @@ const HorizontalPicker = ({
76
76
  }, [maximum, minimum, time]);
77
77
 
78
78
  useEffect(() => {
79
- const scrollListener = scrollX.addListener(({ value: scrollValue }) => {
80
- isCanChangeValue && onChangeValue && onChangeValue(scrollValue);
79
+ const scrollListener = scrollX.addListener(({ value }) => {
80
+ isCanChangeValue && onChangeValue && onChangeValue(value);
81
81
  });
82
82
  return () => scrollX.removeListener(scrollListener);
83
83
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -68,6 +68,12 @@ export default StyleSheet.create({
68
68
  right: 0,
69
69
  bottom: 0,
70
70
  },
71
+ firstOpenCamera: {
72
+ zIndex: -9999,
73
+ position: 'absolute',
74
+ width: 1,
75
+ height: 1,
76
+ },
71
77
  loading: {
72
78
  position: 'absolute',
73
79
  zIndex: 10,