@eohjsc/react-native-smart-city 0.2.19 → 0.2.23

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 (242) hide show
  1. package/assets/images/Add.svg +5 -0
  2. package/assets/images/AddLocationMaps/Point.svg +3 -0
  3. package/assets/images/CheckCircle.svg +4 -0
  4. package/assets/images/Close.svg +3 -0
  5. package/assets/images/Event.svg +9 -0
  6. package/assets/images/HowToStart.svg +14 -0
  7. package/assets/images/OneTap.svg +14 -0
  8. package/assets/images/Rearrange.svg +3 -0
  9. package/assets/images/Schedule.svg +39 -0
  10. package/assets/images/WeatherChange.svg +49 -0
  11. package/index.js +2 -0
  12. package/package.json +7 -4
  13. package/src/Images/Common/ActiveButton.png +0 -0
  14. package/src/Images/Common/ActiveButton@2x.png +0 -0
  15. package/src/Images/Common/ActiveButton@3x.png +0 -0
  16. package/src/Images/Common/file@2x.png +0 -0
  17. package/src/Images/Common/file@3x.png +0 -0
  18. package/src/Images/Common/fullscreen@2x.png +0 -0
  19. package/src/Images/Common/fullscreen@3x.png +0 -0
  20. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +6 -3
  21. package/src/commons/ActionGroup/StatesGridActionTemplate.js +10 -1
  22. package/src/commons/ActionGroup/ThreeButtonTemplate.js +13 -6
  23. package/src/commons/ActionGroup/ThreeButtonTemplateStyle.js +1 -1
  24. package/src/commons/ActionGroup/TimerActionTemplate.js +158 -33
  25. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +2 -1
  26. package/src/commons/ActionGroup/hooks/useDropdownAction.js +2 -1
  27. package/src/commons/Automate/ItemAddNewScriptAction.js +30 -0
  28. package/src/commons/Automate/ItemAddNewScriptActionStyles.js +38 -0
  29. package/src/commons/Automate/ItemAutomate.js +63 -0
  30. package/src/commons/Automate/ItemAutomateStyles.js +30 -0
  31. package/src/commons/Automate/ItemScriptAction.js +41 -0
  32. package/src/commons/Automate/ItemScriptActionStyles.js +38 -0
  33. package/src/commons/BottomScrollPicker/index.js +58 -0
  34. package/src/commons/BottomScrollPicker/styles.js +13 -0
  35. package/src/commons/BottomSheet/index.js +36 -0
  36. package/src/commons/BottomSheet/styles.js +37 -0
  37. package/src/commons/Button/index.js +6 -1
  38. package/src/commons/CameraDevice/index.js +22 -10
  39. package/src/commons/ChartLoading/index.js +2 -1
  40. package/src/commons/DateTimeRangeChange/index.js +2 -1
  41. package/src/commons/Device/ConnectedViewHeader.js +3 -1
  42. package/src/commons/Device/DeviceAlertStatus.js +2 -1
  43. package/src/commons/Device/DisconnectedView.js +34 -26
  44. package/src/commons/Device/Emergency/EmergencyButton.js +2 -1
  45. package/src/commons/Device/Emergency/EmergencyDetail.js +2 -1
  46. package/src/commons/Device/FlatListItems.js +2 -1
  47. package/src/commons/Device/FooterInfo.js +2 -1
  48. package/src/commons/Device/HistoryChart.js +2 -1
  49. package/src/commons/Device/HorizontalBarChart.js +3 -3
  50. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +7 -2
  51. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +3 -1
  52. package/src/commons/Device/RainningSensor/CurrentRainSensor.js +3 -1
  53. package/src/commons/Device/SensorConnectedStatus.js +2 -1
  54. package/src/commons/Device/WindDirection/Compass/index.js +1 -1
  55. package/src/commons/Device/WindSpeed/LinearChart/index.js +2 -1
  56. package/src/commons/Device/__test__/DeviceAlertStatus.test.js +2 -1
  57. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -1
  58. package/src/commons/EmergencyButton/AlertSent.js +3 -2
  59. package/src/commons/Explore/CityItem/index.js +2 -1
  60. package/src/commons/Explore/HeaderExplore/index.js +2 -1
  61. package/src/commons/Explore/HeaderLabel/index.js +2 -1
  62. package/src/commons/Explore/SearchBox/index.js +2 -1
  63. package/src/commons/Header/HeaderCustom.js +36 -10
  64. package/src/commons/Header/Styles/HeaderCustomStyles.js +8 -3
  65. package/src/commons/HeaderAni/index.js +6 -3
  66. package/src/commons/IconComponent/index.js +18 -3
  67. package/src/commons/ImagePicker/index.js +3 -1
  68. package/src/commons/MediaPlayer/index.js +118 -62
  69. package/src/commons/MediaPlayer/styles.js +56 -0
  70. package/src/commons/MediaPlayerDetail/MediaPlayerDetailStyles.js +15 -0
  71. package/src/commons/MediaPlayerDetail/index.js +149 -64
  72. package/src/commons/MenuActionAddnew/index.js +2 -1
  73. package/src/commons/Modal/ModalCustom.js +22 -0
  74. package/src/commons/Modal/ModalFullVideo.js +48 -0
  75. package/src/commons/Modal/Styles/ModalFullVideoStyles.js +26 -0
  76. package/src/commons/Modal/index.js +4 -0
  77. package/src/commons/NavBar/index.js +2 -2
  78. package/src/commons/Sharing/DevicePermissionsCheckbox.js +2 -1
  79. package/src/commons/Sharing/MemberList.js +3 -1
  80. package/src/commons/Sharing/RowMember.js +3 -2
  81. package/src/commons/Sharing/StationDevicePermissions.js +2 -1
  82. package/src/commons/SubUnit/OneTap/ItemOneTap.js +86 -0
  83. package/src/commons/SubUnit/OneTap/ItemOneTapStyles.js +41 -0
  84. package/src/commons/SubUnit/OneTap/OneTapStyles.js +36 -0
  85. package/src/commons/SubUnit/OneTap/index.js +29 -0
  86. package/src/commons/SubUnit/ShortDetail.js +3 -1
  87. package/src/commons/Today/index.js +2 -1
  88. package/src/commons/Unit/SharedUnit.js +2 -1
  89. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -2
  90. package/src/commons/UnitSummary/AirQuality/index.js +5 -120
  91. package/src/commons/UnitSummary/AirQuality/styles.js +112 -0
  92. package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -1
  93. package/src/commons/WheelDateTimePicker/Picker.js +57 -0
  94. package/src/commons/WheelDateTimePicker/index.js +160 -0
  95. package/src/commons/WheelDateTimePicker/styles.js +21 -0
  96. package/src/configs/API.js +25 -3
  97. package/src/configs/Colors.js +1 -0
  98. package/src/configs/Constants.js +4 -0
  99. package/src/configs/Images.js +4 -0
  100. package/src/configs/SCConfig.js +94 -0
  101. package/src/context/SCContext.tsx +5 -11
  102. package/src/context/reducer.ts +2 -0
  103. package/src/hooks/Common/useStatusBar.js +3 -0
  104. package/src/hooks/Common/useTranslations.ts +34 -0
  105. package/src/iot/Monitor.js +2 -1
  106. package/src/iot/RemoteControl/Bluetooth.js +2 -6
  107. package/src/iot/RemoteControl/GoogleHome.js +1 -1
  108. package/src/iot/RemoteControl/Internet.js +1 -1
  109. package/src/iot/RemoteControl/LG.js +57 -15
  110. package/src/iot/RemoteControl/__test__/Bluetooth.test.js +2 -1
  111. package/src/iot/RemoteControl/__test__/GoogleHome.test.js +2 -1
  112. package/src/iot/RemoteControl/__test__/Internet.test.js +2 -1
  113. package/src/iot/RemoteControl/__test__/index.test.js +2 -1
  114. package/src/iot/RemoteControl/index.js +1 -1
  115. package/src/iot/states.js +1 -0
  116. package/src/navigations/AddGatewayStack.js +5 -0
  117. package/src/navigations/AddNewActionStack.js +23 -0
  118. package/src/navigations/SharedStack.js +2 -1
  119. package/src/navigations/UnitStack.js +72 -1
  120. package/src/screens/AQIGuide/index.js +2 -2
  121. package/src/screens/ActivityLog/hooks/index.js +1 -1
  122. package/src/screens/ActivityLog/index.js +2 -1
  123. package/src/screens/AddCommon/SelectSubUnit.js +143 -0
  124. package/src/screens/AddCommon/SelectSubUnitStyles.js +55 -0
  125. package/src/screens/AddCommon/SelectUnit.js +3 -2
  126. package/src/screens/AddLocationMaps/index.js +2 -1
  127. package/src/screens/AddNewAction/Device/DeviceStyles.js +43 -0
  128. package/src/screens/AddNewAction/Device/index.js +33 -0
  129. package/src/screens/AddNewAction/SelectDevice.js +106 -0
  130. package/src/screens/AddNewAction/Styles/SelectDeviceStyles.js +36 -0
  131. package/src/screens/AddNewDevice/ConnectDevices.js +2 -1
  132. package/src/screens/AddNewDevice/ConnectingDevices.js +2 -1
  133. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +2 -1
  134. package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +2 -1
  135. package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +2 -1
  136. package/src/screens/AddNewDevice/hooks/useStateAlertRename.js +2 -1
  137. package/src/screens/AddNewDevice/index.js +23 -4
  138. package/src/screens/AddNewGateway/AddNewGatewayStyles.js +29 -0
  139. package/src/screens/AddNewGateway/ConnectedGateway.js +2 -1
  140. package/src/screens/AddNewGateway/ConnectingGateway.js +100 -25
  141. package/src/screens/AddNewGateway/ConnectingGatewayStyles.js +92 -0
  142. package/src/screens/AddNewGateway/SetupGatewayWifi.js +25 -3
  143. package/src/screens/AddNewGateway/SetupGatewayWifiStyles.js +6 -1
  144. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +2 -1
  145. package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +2 -1
  146. package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +2 -1
  147. package/src/screens/AddNewGateway/hooks/useStateAlertRename.js +2 -1
  148. package/src/screens/AddNewGateway/index.js +28 -110
  149. package/src/screens/AddNewOneTap/AddNewOneTapStyles.js +43 -0
  150. package/src/screens/AddNewOneTap/index.js +67 -0
  151. package/src/screens/AddNewScriptAction/AddNewScriptActionStyles.js +27 -0
  152. package/src/screens/AddNewScriptAction/index.js +92 -0
  153. package/src/screens/AllCamera/Styles/index.js +101 -0
  154. package/src/screens/AllCamera/index.js +208 -0
  155. package/src/screens/Device/HeaderDevice/styles.js +2 -2
  156. package/src/screens/Device/__test__/detail.test.js +2 -1
  157. package/src/screens/Device/detail.js +66 -23
  158. package/src/screens/Device/hooks/useEmergencyButton.js +7 -6
  159. package/src/screens/Device/styles.js +3 -0
  160. package/src/screens/DeviceInfo/index.js +3 -2
  161. package/src/screens/EditActionsList/Styles/indexStyles.js +73 -0
  162. package/src/screens/EditActionsList/index.js +122 -0
  163. package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +3 -2
  164. package/src/screens/EmergencyContacts/EmergencyContactsList.js +9 -2
  165. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +2 -1
  166. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +2 -1
  167. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +2 -1
  168. package/src/screens/EmergencyContacts/hook.js +3 -2
  169. package/src/screens/Explore/index.js +3 -2
  170. package/src/screens/GuestInfo/components/AccessScheduleItem.js +27 -0
  171. package/src/screens/GuestInfo/components/AccessScheduleSheet.js +193 -0
  172. package/src/screens/GuestInfo/components/HeaderGuestInfo.js +31 -0
  173. package/src/screens/GuestInfo/components/RecurringDetail.js +99 -0
  174. package/src/screens/GuestInfo/components/RowGuestInfo.js +31 -0
  175. package/src/screens/GuestInfo/components/TemporaryDetail.js +46 -0
  176. package/src/screens/GuestInfo/constant.js +59 -0
  177. package/src/screens/GuestInfo/index.js +151 -0
  178. package/src/screens/GuestInfo/styles/AccessScheduleDetailStyles.js +31 -0
  179. package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +22 -0
  180. package/src/screens/GuestInfo/styles/HeaderGuestInfoStyles.js +31 -0
  181. package/src/screens/GuestInfo/styles/indexStyles.js +38 -0
  182. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +82 -0
  183. package/src/screens/ManageAccess/hooks/index.js +32 -0
  184. package/src/screens/ManageAccess/index.js +126 -0
  185. package/src/screens/ManageAccess/styles/ManageAccessStyles.js +72 -0
  186. package/src/screens/PlayBackCamera/Styles/TimerStyles.js +22 -0
  187. package/src/screens/PlayBackCamera/Styles/index.js +81 -0
  188. package/src/screens/PlayBackCamera/Timer.js +127 -0
  189. package/src/screens/PlayBackCamera/index.js +233 -0
  190. package/src/screens/ScanChipQR/components/QRScan/index.js +2 -1
  191. package/src/screens/ScanChipQR/hooks/index.js +4 -11
  192. package/src/screens/ScriptDetail/Styles/indexStyles.js +140 -0
  193. package/src/screens/ScriptDetail/index.js +241 -0
  194. package/src/screens/SharedUnit/TabHeader.js +2 -1
  195. package/src/screens/SharedUnit/index.js +3 -2
  196. package/src/screens/Sharing/MemberList.js +2 -1
  197. package/src/screens/Sharing/SelectPermission.js +2 -1
  198. package/src/screens/Sharing/SelectUser.js +3 -2
  199. package/src/screens/Sharing/__test__/MemberList.test.js +2 -1
  200. package/src/screens/Sharing/__test__/SelectUser.test.js +2 -1
  201. package/src/screens/Sharing/hooks/index.js +22 -17
  202. package/src/screens/SubUnit/AddSubUnit.js +14 -72
  203. package/src/screens/SubUnit/AddSubUnitStyles.js +66 -0
  204. package/src/screens/SubUnit/Detail.js +5 -63
  205. package/src/screens/SubUnit/DetailStyles.js +46 -0
  206. package/src/screens/SubUnit/ManageSubUnit.js +5 -4
  207. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +2 -1
  208. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -1
  209. package/src/screens/SyncLGDevice/AddLGDevice.js +3 -2
  210. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +2 -1
  211. package/src/screens/TDSGuide/index.js +2 -1
  212. package/src/screens/UVIndexGuide/index.js +2 -1
  213. package/src/screens/Unit/AddMenu.js +3 -2
  214. package/src/screens/Unit/Detail.js +75 -20
  215. package/src/screens/Unit/ManageUnit/index.js +4 -3
  216. package/src/screens/Unit/ManageUnit.js +4 -3
  217. package/src/screens/Unit/MoreMenu.js +3 -2
  218. package/src/screens/Unit/SelectLocation.js +10 -2
  219. package/src/screens/Unit/SelectLocationStyles.js +11 -0
  220. package/src/screens/Unit/components/Header/index.js +2 -1
  221. package/src/screens/Unit/components/ListMyAllUnit/index.js +2 -1
  222. package/src/screens/Unit/components/MyUnit/index.js +2 -1
  223. package/src/screens/Unit/components/SearchLocation/index.js +2 -1
  224. package/src/screens/Unit/components/SharedUnit/index.js +2 -1
  225. package/src/screens/Unit/styles.js +4 -0
  226. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -1
  227. package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -1
  228. package/src/screens/UnitSummary/components/Temperature/index.js +2 -1
  229. package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -1
  230. package/src/screens/UnitSummary/components/UvIndex/index.js +2 -1
  231. package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -1
  232. package/src/screens/UnitSummary/index.js +2 -1
  233. package/src/screens/WaterQualityGuide/index.js +2 -1
  234. package/src/utils/Converter/__test__/time.test.js +3 -1
  235. package/src/utils/Converter/array.js +4 -0
  236. package/src/utils/Converter/time.js +29 -4
  237. package/src/utils/I18n/index.ts +6 -0
  238. package/src/utils/I18n/translations/en.json +51 -2
  239. package/src/utils/I18n/translations/vi.json +48 -1
  240. package/src/utils/I18n/translations.ts +45 -0
  241. package/src/utils/Route/index.js +11 -0
  242. package/src/utils/I18n/index.js +0 -19
@@ -0,0 +1,5 @@
1
+ <svg width="32" height="33" viewBox="0 0 32 33" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <circle cx="16" cy="16.5938" r="16" fill="#F5F5F5"/>
3
+ <path d="M15.4374 9.99414H16.5624C16.6624 9.99414 16.7124 10.0439 16.7124 10.1435V23.2873C16.7124 23.3869 16.6624 23.4367 16.5624 23.4367H15.4374C15.3374 23.4367 15.2874 23.3869 15.2874 23.2873V10.1435C15.2874 10.0439 15.3374 9.99414 15.4374 9.99414Z" fill="#595959"/>
4
+ <path d="M9.6998 16.0059H22.2998C22.3998 16.0059 22.4498 16.0556 22.4498 16.1552V17.2754C22.4498 17.375 22.3998 17.4248 22.2998 17.4248H9.6998C9.5998 17.4248 9.5498 17.375 9.5498 17.2754V16.1552C9.5498 16.0556 9.5998 16.0059 9.6998 16.0059Z" fill="#595959"/>
5
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M16 10.2188C15.0656 10.2188 14.1875 10.5812 13.525 11.2437C13.1994 11.5684 12.9413 11.9542 12.7654 12.3789C12.5895 12.8037 12.4993 13.259 12.5 13.7188C12.5 14.6531 12.8656 15.5312 13.525 16.1938C13.8496 16.5193 14.2354 16.7775 14.6602 16.9534C15.0849 17.1293 15.5403 17.2195 16 17.2188C16.9344 17.2188 17.8125 16.8531 18.475 16.1938C19.1375 15.5312 19.5 14.6531 19.5 13.7188C19.5 12.7844 19.1375 11.9062 18.475 11.2437C17.8125 10.5812 16.9344 10.2188 16 10.2188ZM26.7062 9.03438C26.1179 7.67775 25.2697 6.44944 24.2094 5.41875C23.1456 4.37875 21.8915 3.55331 20.5156 2.9875C19.0844 2.39375 17.5656 2.09375 16 2.09375C14.4344 2.09375 12.9156 2.39375 11.4844 2.98438C10.1 3.55625 8.85938 4.375 7.79063 5.41563C6.73101 6.44689 5.88286 7.67506 5.29375 9.03125C4.68437 10.4375 4.375 11.9312 4.375 13.4688C4.375 15.675 4.90313 17.8719 5.94063 19.9906C6.775 21.6938 7.94063 23.3531 9.40938 24.9312C11.9188 27.625 14.55 29.2719 15.2969 29.7125C15.5089 29.8377 15.7507 29.9036 15.9969 29.9031C16.2406 29.9031 16.4812 29.8406 16.6969 29.7125C17.4437 29.2719 20.075 27.625 22.5844 24.9312C24.0531 23.3562 25.2188 21.6938 26.0531 19.9906C27.0969 17.875 27.625 15.6812 27.625 13.4719C27.625 11.9344 27.3156 10.4406 26.7062 9.03438ZM16 19.2188C12.9625 19.2188 10.5 16.7563 10.5 13.7188C10.5 10.6812 12.9625 8.21875 16 8.21875C19.0375 8.21875 21.5 10.6812 21.5 13.7188C21.5 16.7563 19.0375 19.2188 16 19.2188Z" fill="#1890FF"/>
3
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="33" height="33" viewBox="0 0 33 33" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <circle cx="16.5" cy="16.5928" r="16" fill="#F5F5F5"/>
3
+ <path d="M24.8327 9.88477H23.3764C23.1723 9.88477 22.9785 9.97852 22.8535 10.1389L14.2639 21.0202L10.1452 15.8014C10.0829 15.7223 10.0035 15.6584 9.9129 15.6143C9.82234 15.5703 9.72297 15.5474 9.62228 15.5473H8.16603C8.02644 15.5473 7.94936 15.7077 8.03478 15.816L13.741 23.0452C14.0077 23.3827 14.5202 23.3827 14.7889 23.0452L24.9639 10.1514C25.0494 10.0452 24.9723 9.88477 24.8327 9.88477Z" fill="#BFBFBF"/>
4
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="10" height="12" viewBox="0 0 10 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M5.80926 6.03906L9.91082 1.15C9.97957 1.06875 9.92176 0.945312 9.81551 0.945312H8.56863C8.49519 0.945312 8.42488 0.978125 8.37644 1.03437L4.99363 5.06719L1.61082 1.03437C1.56394 0.978125 1.49363 0.945312 1.41863 0.945312H0.171756C0.0655061 0.945312 0.00769351 1.06875 0.0764435 1.15L4.17801 6.03906L0.0764435 10.9281C0.0610429 10.9462 0.0511628 10.9684 0.0479759 10.9919C0.0447889 11.0155 0.048429 11.0395 0.0584644 11.061C0.0684997 11.0826 0.0845088 11.1008 0.104591 11.1135C0.124672 11.1263 0.147983 11.1329 0.171756 11.1328H1.41863C1.49207 11.1328 1.56238 11.1 1.61082 11.0438L4.99363 7.01094L8.37644 11.0438C8.42332 11.1 8.49363 11.1328 8.56863 11.1328H9.81551C9.92176 11.1328 9.97957 11.0094 9.91082 10.9281L5.80926 6.03906Z" fill="#262626"/>
3
+ </svg>
@@ -0,0 +1,9 @@
1
+ <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M30.4995 0H15.4991L9.50098 21.5962H15.5113L10.4009 40H12.2012L29.5983 18.4029H20.785L30.4995 0Z" fill="url(#paint0_linear)"/>
3
+ <defs>
4
+ <linearGradient id="paint0_linear" x1="9.50098" y1="0" x2="42.409" y2="17.2947" gradientUnits="userSpaceOnUse">
5
+ <stop stop-color="#2B6B9F"/>
6
+ <stop offset="1" stop-color="#D5FFCB"/>
7
+ </linearGradient>
8
+ </defs>
9
+ </svg>
@@ -0,0 +1,14 @@
1
+ <svg width="40" height="41" viewBox="0 0 40 41" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M20 23.0381H10C8.61816 23.0381 7.5 21.9209 7.5 20.5381C7.5 19.1553 8.61816 18.0381 10 18.0381H20C21.3818 18.0381 22.5 19.1553 22.5 20.5381C22.5 21.9209 21.3818 23.0381 20 23.0381Z" fill="url(#paint0_linear)"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M30 8.03809H35C37.7588 8.03809 40 10.2803 40 13.0381V35.5381C40 38.2959 37.7588 40.5381 35 40.5381H12.5C9.74121 40.5381 7.5 38.2959 7.5 35.5381V30.5381H5C2.24121 30.5381 0 28.2959 0 25.5381V5.53809C0 2.78029 2.24121 0.538086 5 0.538086H25C27.7588 0.538086 30 2.78029 30 5.53809V8.03809ZM5 5.53809V25.5381H25V5.53809H5ZM35 35.5381H12.5V30.5381H25C27.7588 30.5381 30 28.2959 30 25.5381V13.0381H35V35.5381Z" fill="url(#paint1_linear)"/>
4
+ <defs>
5
+ <linearGradient id="paint0_linear" x1="0" y1="0.538086" x2="39.9557" y2="40.5381" gradientUnits="userSpaceOnUse">
6
+ <stop stop-color="#2B6B9F"/>
7
+ <stop offset="1" stop-color="#D5FFCB"/>
8
+ </linearGradient>
9
+ <linearGradient id="paint1_linear" x1="0" y1="0.538086" x2="39.9557" y2="40.5381" gradientUnits="userSpaceOnUse">
10
+ <stop stop-color="#2B6B9F"/>
11
+ <stop offset="1" stop-color="#D5FFCB"/>
12
+ </linearGradient>
13
+ </defs>
14
+ </svg>
@@ -0,0 +1,14 @@
1
+ <svg width="33" height="33" viewBox="0 0 33 33" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M16.5 18.5928H8.5C7.39453 18.5928 6.5 17.699 6.5 16.5928C6.5 15.4865 7.39453 14.5928 8.5 14.5928H16.5C17.6055 14.5928 18.5 15.4865 18.5 16.5928C18.5 17.699 17.6055 18.5928 16.5 18.5928Z" fill="url(#paint0_linear)"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M24.5 6.59277H28.5C30.707 6.59277 32.5 8.38654 32.5 10.5928V28.5928C32.5 30.799 30.707 32.5928 28.5 32.5928H10.5C8.29297 32.5928 6.5 30.799 6.5 28.5928V24.5928H4.5C2.29297 24.5928 0.5 22.799 0.5 20.5928V4.59277C0.5 2.38654 2.29297 0.592773 4.5 0.592773H20.5C22.707 0.592773 24.5 2.38654 24.5 4.59277V6.59277ZM4.5 4.59277V20.5928H20.5V4.59277H4.5ZM28.5 28.5928H10.5V24.5928H20.5C22.707 24.5928 24.5 22.799 24.5 20.5928V10.5928H28.5V28.5928Z" fill="url(#paint1_linear)"/>
4
+ <defs>
5
+ <linearGradient id="paint0_linear" x1="0.5" y1="0.592773" x2="32.4646" y2="32.5928" gradientUnits="userSpaceOnUse">
6
+ <stop stop-color="#2B6B9F"/>
7
+ <stop offset="1" stop-color="#D5FFCB"/>
8
+ </linearGradient>
9
+ <linearGradient id="paint1_linear" x1="0.5" y1="0.592773" x2="32.4646" y2="32.5928" gradientUnits="userSpaceOnUse">
10
+ <stop stop-color="#2B6B9F"/>
11
+ <stop offset="1" stop-color="#D5FFCB"/>
12
+ </linearGradient>
13
+ </defs>
14
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M21.6875 7.44531H3.3125C3.20937 7.44531 3.125 7.52969 3.125 7.63281V9.13281C3.125 9.23594 3.20937 9.32031 3.3125 9.32031H21.6875C21.7906 9.32031 21.875 9.23594 21.875 9.13281V7.63281C21.875 7.52969 21.7906 7.44531 21.6875 7.44531ZM21.6875 14.7578H3.3125C3.20937 14.7578 3.125 14.8422 3.125 14.9453V16.4453C3.125 16.5484 3.20937 16.6328 3.3125 16.6328H21.6875C21.7906 16.6328 21.875 16.5484 21.875 16.4453V14.9453C21.875 14.8422 21.7906 14.7578 21.6875 14.7578Z" fill="#262626"/>
3
+ </svg>
@@ -0,0 +1,39 @@
1
+ <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0)">
3
+ <path d="M16.332 21.377L18.5464 25.1419L20.0979 23.5904L16.332 21.377Z" fill="url(#paint0_linear)"/>
4
+ <path d="M19.5571 26.1531L23.3215 28.3659L21.1083 24.6016L19.5571 26.1531Z" fill="url(#paint1_linear)"/>
5
+ <path d="M19.2856 7.71777V8.49292H20.7142V7.71777C20.2415 7.79895 19.7584 7.79895 19.2856 7.71777Z" fill="url(#paint2_linear)"/>
6
+ <path d="M20 9.92188C11.7157 9.92188 5 16.6376 5 24.9219C5 33.2062 11.7157 39.9219 20 39.9219C28.2843 39.9219 35 33.2062 35 24.9219C34.9906 16.6415 28.2804 9.93134 20 9.92188ZM20 38.4934C12.5046 38.4934 6.42853 32.4173 6.42853 24.9219C6.42853 17.4265 12.5046 11.3504 20 11.3504C27.4951 11.3504 33.5715 17.4265 33.5715 24.9219C33.5633 32.4137 27.4918 38.4851 20 38.4934Z" fill="url(#paint3_linear)"/>
7
+ <path d="M20.0001 6.35041C21.7753 6.35041 23.2142 4.9115 23.2142 3.13629C23.2142 1.36109 21.7753 -0.078125 20.0001 -0.078125C18.2249 -0.078125 16.7856 1.36109 16.7856 3.13629C16.7878 4.91059 18.2258 6.34858 20.0001 6.35041ZM20.0001 2.42188C20.3947 2.42188 20.7142 2.7417 20.7142 3.13629C20.7142 3.53058 20.3943 3.85041 20.0001 3.85041C19.6055 3.85041 19.2856 3.53058 19.2856 3.13629C19.2856 2.7417 19.6055 2.42188 20.0001 2.42188Z" fill="url(#paint4_linear)"/>
8
+ <path d="M19.9999 12.7793C13.2936 12.7793 7.85693 18.216 7.85693 24.9223C7.85693 31.6285 13.2936 37.0652 19.9999 37.0652C26.7061 37.0652 32.1428 31.6285 32.1428 24.9223C32.1352 18.2191 26.7031 12.7869 19.9999 12.7793ZM19.2855 14.9222C19.2855 14.5277 19.6053 14.2078 19.9999 14.2078C20.3945 14.2078 20.714 14.5277 20.714 14.9222V16.3508C20.714 16.7454 20.3942 17.0652 19.9999 17.0652C19.6053 17.0652 19.2855 16.7454 19.2855 16.3508V14.9222ZM11.4284 25.6367H9.99988C9.60529 25.6367 9.28546 25.3168 9.28546 24.9223C9.28546 24.5277 9.60529 24.2078 9.99988 24.2078H11.4284C11.823 24.2078 12.1428 24.5277 12.1428 24.9223C12.1428 25.3168 11.823 25.6367 11.4284 25.6367ZM20.714 34.9223C20.714 35.3169 20.3942 35.6364 19.9999 35.6364C19.6053 35.6364 19.2855 35.3169 19.2855 34.9223V33.4937C19.2855 33.0991 19.6053 32.7793 19.9999 32.7793C20.3945 32.7793 20.714 33.0991 20.714 33.4937V34.9223ZM25.8376 30.8829C25.6075 31.1131 25.2511 31.1585 24.9706 30.9937L18.037 26.9172C18.0306 26.9135 18.0278 26.9065 18.0211 26.9022C17.9815 26.872 17.9454 26.8375 17.9134 26.7994C17.8691 26.7634 17.8295 26.7216 17.7956 26.6758C17.7919 26.67 17.7855 26.6679 17.7828 26.6624L13.7047 19.7288C13.5039 19.3891 13.6159 18.9512 13.9556 18.7501C14.1799 18.617 14.4588 18.617 14.6834 18.7501L21.6176 22.8266C21.624 22.8309 21.6271 22.8379 21.6335 22.8416C21.6726 22.8721 21.7086 22.9066 21.7412 22.9444C21.7852 22.9807 21.8245 23.0222 21.8584 23.068C21.8621 23.0735 21.8685 23.0765 21.8718 23.0823L25.9484 30.0156C26.1135 30.2964 26.0677 30.6528 25.8376 30.8829ZM29.9999 25.6367H28.5714C28.1768 25.6367 27.8569 25.3168 27.8569 24.9223C27.8569 24.5277 28.1768 24.2078 28.5714 24.2078H29.9999C30.3945 24.2078 30.7143 24.5277 30.7143 24.9223C30.714 25.3168 30.3942 25.6367 29.9999 25.6367Z" fill="url(#paint5_linear)"/>
9
+ </g>
10
+ <defs>
11
+ <linearGradient id="paint0_linear" x1="16.332" y1="21.377" x2="20.0928" y2="25.1428" gradientUnits="userSpaceOnUse">
12
+ <stop stop-color="#2B6B9F"/>
13
+ <stop offset="1" stop-color="#D5FFCB"/>
14
+ </linearGradient>
15
+ <linearGradient id="paint1_linear" x1="19.5571" y1="24.6016" x2="23.3173" y2="28.3659" gradientUnits="userSpaceOnUse">
16
+ <stop stop-color="#2B6B9F"/>
17
+ <stop offset="1" stop-color="#D5FFCB"/>
18
+ </linearGradient>
19
+ <linearGradient id="paint2_linear" x1="19.2856" y1="7.71777" x2="19.9344" y2="8.91471" gradientUnits="userSpaceOnUse">
20
+ <stop stop-color="#2B6B9F"/>
21
+ <stop offset="1" stop-color="#D5FFCB"/>
22
+ </linearGradient>
23
+ <linearGradient id="paint3_linear" x1="5" y1="9.92187" x2="34.9668" y2="39.9219" gradientUnits="userSpaceOnUse">
24
+ <stop stop-color="#2B6B9F"/>
25
+ <stop offset="1" stop-color="#D5FFCB"/>
26
+ </linearGradient>
27
+ <linearGradient id="paint4_linear" x1="16.7856" y1="-0.078125" x2="23.2071" y2="6.3504" gradientUnits="userSpaceOnUse">
28
+ <stop stop-color="#2B6B9F"/>
29
+ <stop offset="1" stop-color="#D5FFCB"/>
30
+ </linearGradient>
31
+ <linearGradient id="paint5_linear" x1="7.85693" y1="12.7793" x2="32.116" y2="37.0652" gradientUnits="userSpaceOnUse">
32
+ <stop stop-color="#2B6B9F"/>
33
+ <stop offset="1" stop-color="#D5FFCB"/>
34
+ </linearGradient>
35
+ <clipPath id="clip0">
36
+ <rect width="40" height="40" fill="white"/>
37
+ </clipPath>
38
+ </defs>
39
+ </svg>
@@ -0,0 +1,49 @@
1
+ <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0)">
3
+ <path d="M39.9609 19.4151C39.9609 16.0576 37.5367 13.2553 34.3461 12.6674C34.4469 7.7329 29.6475 3.91545 24.7266 5.38009C23.2367 2.22626 20.0429 0 16.2573 0C11.214 0 7.08931 4.01089 6.90686 9.01047C2.92786 9.87659 0.0390625 13.4122 0.0390625 17.5438C0.0390625 22.3593 3.95639 26.2766 8.77196 26.2766H33.0993C36.8825 26.2766 39.9609 23.1983 39.9609 19.4151Z" fill="url(#paint0_linear)"/>
4
+ <path d="M27.4194 28.2794C26.8033 27.9714 26.0538 28.221 25.7457 28.8374L23.2506 33.8276C22.833 34.6629 23.4486 35.6334 24.3655 35.6334C24.8231 35.6334 25.2637 35.3806 25.4823 34.9435L27.9774 29.9533C28.2855 29.337 28.0357 28.5876 27.4194 28.2794Z" fill="url(#paint1_linear)"/>
5
+ <path d="M38.647 28.2794C38.0308 27.9714 37.2813 28.221 36.9732 28.8374L34.4781 33.8276C34.0605 34.6629 34.6762 35.6334 35.593 35.6334C36.0507 35.6334 36.4913 35.3806 36.7098 34.9435L39.2049 29.9533C39.513 29.337 39.2633 28.5876 38.647 28.2794Z" fill="url(#paint2_linear)"/>
6
+ <path d="M16.1914 28.2794C15.5753 27.9714 14.8257 28.221 14.5177 28.8374L12.0226 33.8276C11.6049 34.6629 12.2206 35.6334 13.1375 35.6334C13.5951 35.6334 14.0357 35.3806 14.2543 34.9435L16.7494 29.9533C17.0575 29.337 16.8077 28.5876 16.1914 28.2794Z" fill="url(#paint3_linear)"/>
7
+ <path d="M4.96339 28.2794C4.34726 27.9714 3.59771 28.221 3.28964 28.8374L0.794526 33.8276C0.376906 34.6629 0.992575 35.6334 1.90945 35.6334C2.36707 35.6334 2.80769 35.3806 3.02625 34.9435L5.52136 29.9533C5.82943 29.337 5.57969 28.5876 4.96339 28.2794Z" fill="url(#paint4_linear)"/>
8
+ <path d="M19.9336 32.6456C19.3174 32.3376 18.5679 32.5873 18.2599 33.2036L15.7647 38.1938C15.3471 39.029 15.9628 39.9996 16.8797 39.9996C17.3373 39.9996 17.7779 39.7468 17.9965 39.3097L20.4916 34.3194C20.7996 33.7032 20.5499 32.9538 19.9336 32.6456Z" fill="url(#paint5_linear)"/>
9
+ <path d="M31.1621 32.6456C30.5459 32.3376 29.7964 32.5873 29.4884 33.2036L26.9933 38.1938C26.5756 39.029 27.1913 39.9996 28.1082 39.9996C28.5658 39.9996 29.0064 39.7468 29.225 39.3097L31.7201 34.3194C32.0281 33.7032 31.7784 32.9538 31.1621 32.6456Z" fill="url(#paint6_linear)"/>
10
+ <path d="M8.70607 32.6456C8.08985 32.3376 7.34038 32.5873 7.03232 33.2036L4.5372 38.1938C4.11958 39.029 4.73525 39.9996 5.65213 39.9996C6.10975 39.9996 6.55037 39.7468 6.76893 39.3097L9.26404 34.3194C9.57211 33.7032 9.32236 32.9538 8.70607 32.6456Z" fill="url(#paint7_linear)"/>
11
+ </g>
12
+ <defs>
13
+ <linearGradient id="paint0_linear" x1="0.0390625" y1="0" x2="24.1366" y2="36.6517" gradientUnits="userSpaceOnUse">
14
+ <stop stop-color="#2B6B9F"/>
15
+ <stop offset="1" stop-color="#D5FFCB"/>
16
+ </linearGradient>
17
+ <linearGradient id="paint1_linear" x1="23.1172" y1="28.1475" x2="30.0234" y2="32.7581" gradientUnits="userSpaceOnUse">
18
+ <stop stop-color="#2B6B9F"/>
19
+ <stop offset="1" stop-color="#D5FFCB"/>
20
+ </linearGradient>
21
+ <linearGradient id="paint2_linear" x1="34.3447" y1="28.1475" x2="41.2509" y2="32.7581" gradientUnits="userSpaceOnUse">
22
+ <stop stop-color="#2B6B9F"/>
23
+ <stop offset="1" stop-color="#D5FFCB"/>
24
+ </linearGradient>
25
+ <linearGradient id="paint3_linear" x1="11.8892" y1="28.1475" x2="18.7954" y2="32.7582" gradientUnits="userSpaceOnUse">
26
+ <stop stop-color="#2B6B9F"/>
27
+ <stop offset="1" stop-color="#D5FFCB"/>
28
+ </linearGradient>
29
+ <linearGradient id="paint4_linear" x1="0.661133" y1="28.1475" x2="7.56733" y2="32.7581" gradientUnits="userSpaceOnUse">
30
+ <stop stop-color="#2B6B9F"/>
31
+ <stop offset="1" stop-color="#D5FFCB"/>
32
+ </linearGradient>
33
+ <linearGradient id="paint5_linear" x1="15.6313" y1="32.5137" x2="22.5375" y2="37.1244" gradientUnits="userSpaceOnUse">
34
+ <stop stop-color="#2B6B9F"/>
35
+ <stop offset="1" stop-color="#D5FFCB"/>
36
+ </linearGradient>
37
+ <linearGradient id="paint6_linear" x1="26.8599" y1="32.5137" x2="33.766" y2="37.1243" gradientUnits="userSpaceOnUse">
38
+ <stop stop-color="#2B6B9F"/>
39
+ <stop offset="1" stop-color="#D5FFCB"/>
40
+ </linearGradient>
41
+ <linearGradient id="paint7_linear" x1="4.40381" y1="32.5137" x2="11.31" y2="37.1244" gradientUnits="userSpaceOnUse">
42
+ <stop stop-color="#2B6B9F"/>
43
+ <stop offset="1" stop-color="#D5FFCB"/>
44
+ </linearGradient>
45
+ <clipPath id="clip0">
46
+ <rect width="40" height="40" fill="white"/>
47
+ </clipPath>
48
+ </defs>
49
+ </svg>
package/index.js CHANGED
@@ -10,6 +10,7 @@ import SharedStack from './src/navigations/SharedStack';
10
10
  import Explore from './src/screens/Explore';
11
11
  import { AddLGDeviceStack } from './src/navigations/AddLGDeviceStack';
12
12
  import { initSCConfig } from './src/configs';
13
+ import { AddNewActionStack } from './src/navigations/AddNewActionStack';
13
14
 
14
15
  export {
15
16
  AddSubUnitStack,
@@ -25,4 +26,5 @@ export {
25
26
  SCContext,
26
27
  AddLGDeviceStack,
27
28
  initSCConfig,
29
+ AddNewActionStack,
28
30
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.2.19",
4
+ "version": "0.2.23",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -38,7 +38,8 @@
38
38
  "android-deploy-test": "bundle exec fastlane android beta",
39
39
  "reset-cache": "react-native start --reset-cache",
40
40
  "merge_conflict": "yarn jest && yarn update_coverage_result && yarn check_coverage_config",
41
- "jest": "jest --detectOpenHandles"
41
+ "jest": "jest --detectOpenHandles",
42
+ "postinstall": "patch-package"
42
43
  },
43
44
  "repository": {
44
45
  "type": "git",
@@ -83,6 +84,7 @@
83
84
  "typescript": "^4.1.3"
84
85
  },
85
86
  "dependencies": {
87
+ "@messageformat/core": "^3.0.0",
86
88
  "@ant-design/icons-react-native": "^2.2.1",
87
89
  "@ant-design/react-native": "^4.0.5",
88
90
  "@formatjs/intl-getcanonicallocales": "^1.4.5",
@@ -154,14 +156,15 @@
154
156
  "react-native-responsive-fontsize": "^0.5.1",
155
157
  "react-native-safe-area-context": "^3.1.1",
156
158
  "react-native-screens": "^2.9.0",
157
- "react-native-snap-carousel": "^4.0.0-beta.5",
159
+ "react-native-snap-carousel": "4.0.0-beta.5",
158
160
  "react-native-super-grid": "^4.0.3",
159
161
  "react-native-svg": "^12.1.0",
160
162
  "react-native-toast-message": "^1.3.2",
161
163
  "react-native-unimodules": "^0.11.0",
162
164
  "react-native-version-check": "^3.4.2",
163
- "react-native-vlc-media-player": "^1.0.29",
165
+ "react-native-vlc-media-player": "^1.0.39",
164
166
  "react-native-webview": "^10.9.3",
167
+ "react-native-wheel-scrollview-picker": "^1.2.2",
165
168
  "react-navigation": "^2.2.0",
166
169
  "react-redux": "^7.2.1",
167
170
  "redux": "^4.0.5",
Binary file
Binary file
@@ -11,7 +11,7 @@ import styles from './OptionsDropdownActionTemplateStyle';
11
11
  import { watchMultiConfigs } from '../../iot/Monitor';
12
12
  import { TESTID } from '../../configs/Constants';
13
13
  import IconComponent from '../../commons/IconComponent';
14
- import { t } from 'i18n-js';
14
+ import { useTranslations } from '../../hooks/Common/useTranslations';
15
15
 
16
16
  function getOptionValue(option) {
17
17
  if (option.value_text) {
@@ -21,8 +21,10 @@ function getOptionValue(option) {
21
21
  }
22
22
 
23
23
  const OptionsDropdownActionTemplate = ({ actionGroup, doAction, sensor }) => {
24
+ const t = useTranslations();
24
25
  const { configuration, title } = actionGroup;
25
- const { action_data, options, icon, icon_kit_data } = configuration;
26
+ const { action_data, options, icon_kit_data, icon, icon_outlined } =
27
+ configuration;
26
28
  // eslint-disable-next-line no-unused-vars
27
29
  const [configValues, setConfigValues] = useConfigGlobalState('configValues');
28
30
 
@@ -76,7 +78,7 @@ const OptionsDropdownActionTemplate = ({ actionGroup, doAction, sensor }) => {
76
78
  return t('not_available');
77
79
  }
78
80
  return selectedOption.text;
79
- }, [configuration.config, selectedOption]);
81
+ }, [configuration.config, selectedOption.text, t]);
80
82
 
81
83
  return (
82
84
  <View style={styles.wrap}>
@@ -84,6 +86,7 @@ const OptionsDropdownActionTemplate = ({ actionGroup, doAction, sensor }) => {
84
86
  <IconComponent
85
87
  icon={icon}
86
88
  iconKit={iconKit}
89
+ icon_outlined={icon_outlined}
87
90
  isSendingCommand={false}
88
91
  size={17}
89
92
  style={styles.marginRight}
@@ -36,7 +36,15 @@ const GridItem = ({ item, index, length, doAction, sensor }) => {
36
36
  extraStyle.marginTop = 24;
37
37
  }
38
38
 
39
- const { active, text, icon, icon_kit_data, action_data, config } = item;
39
+ const {
40
+ active,
41
+ text,
42
+ icon_kit_data,
43
+ icon,
44
+ icon_outlined,
45
+ action_data,
46
+ config,
47
+ } = item;
40
48
  const buttonOnOffStyle = active ? buttonStyle.ON : buttonStyle.OFF;
41
49
 
42
50
  const doActionAndWatchConfig = useCallback(
@@ -63,6 +71,7 @@ const GridItem = ({ item, index, length, doAction, sensor }) => {
63
71
  <IconComponent
64
72
  icon={icon}
65
73
  iconKit={iconKit}
74
+ icon_outlined={icon_outlined}
66
75
  isSendingCommand={false}
67
76
  size={24}
68
77
  />
@@ -1,7 +1,7 @@
1
1
  import React, { memo, useCallback, useState } from 'react';
2
2
  import { TouchableOpacity, View, Switch } from 'react-native';
3
3
  import { Icon } from '@ant-design/react-native';
4
- import { t } from 'i18n-js';
4
+ import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
  import styles from './ThreeButtonTemplateStyle';
6
6
  import Text from '../Text';
7
7
  import { TESTID } from '../../configs/Constants';
@@ -9,10 +9,15 @@ import { Colors } from '../../configs';
9
9
  import { Card } from '../../commons/CardShadow';
10
10
 
11
11
  const ThreeButtonTemplate = memo(({ actionGroup, doAction }) => {
12
+ const t = useTranslations();
12
13
  const { configuration } = actionGroup;
13
14
  const [lock, setLock] = useState(false);
14
- const iconSquareStop = () => {
15
- return <View style={styles.squareStop} />;
15
+ const iconCustom = (icon) => {
16
+ return icon === 'stop' ? (
17
+ <View style={styles.squareStop} />
18
+ ) : (
19
+ <Icon name={icon} size={30} color={Colors.Primary} />
20
+ );
16
21
  };
17
22
  const onButton1Press = useCallback(
18
23
  () => doAction(configuration.action1_data),
@@ -72,7 +77,7 @@ const ThreeButtonTemplate = memo(({ actionGroup, doAction }) => {
72
77
  onPress={onButton1Press}
73
78
  underlayColor={Colors.Gray2}
74
79
  >
75
- <View style={styles.imageBtn}>
80
+ <View style={styles.imageButton}>
76
81
  <Icon
77
82
  name={configuration.icon1}
78
83
  size={30}
@@ -88,7 +93,9 @@ const ThreeButtonTemplate = memo(({ actionGroup, doAction }) => {
88
93
  onPress={onButton2Press}
89
94
  underlayColor={Colors.Gray2}
90
95
  >
91
- <View style={styles.imageBtn}>{iconSquareStop()}</View>
96
+ <View style={styles.imageButton}>
97
+ {iconCustom(configuration.icon2)}
98
+ </View>
92
99
  <Text style={styles.text}>{configuration.text2}</Text>
93
100
  </TouchableOpacity>
94
101
 
@@ -98,7 +105,7 @@ const ThreeButtonTemplate = memo(({ actionGroup, doAction }) => {
98
105
  onPress={onButton3Press}
99
106
  underlayColor={Colors.Gray2}
100
107
  >
101
- <View style={styles.imageBtn}>
108
+ <View style={styles.imageButton}>
102
109
  <Icon
103
110
  name={configuration.icon3}
104
111
  size={30}
@@ -7,7 +7,7 @@ export default StyleSheet.create({
7
7
  justifyContent: 'space-around',
8
8
  paddingVertical: 16,
9
9
  },
10
- imageBtn: {
10
+ imageButton: {
11
11
  height: 28,
12
12
  marginBottom: 7,
13
13
  },
@@ -3,58 +3,173 @@ import { Switch, TouchableOpacity, View } from 'react-native';
3
3
  import DateTimePickerModal from 'react-native-modal-datetime-picker';
4
4
  import moment from 'moment';
5
5
  import { IconOutline } from '@ant-design/icons-react-native';
6
+ import { watchMultiConfigs } from '../../iot/Monitor';
7
+
8
+ import { useTranslations } from '../../hooks/Common/useTranslations';
6
9
 
7
10
  import styles from './TimerActionTemplateStyles';
8
11
  import Text from '../Text';
9
12
  import { Colors } from '../../configs';
10
13
  import { useConfigGlobalState } from '../../iot/states';
14
+ import BottomScrollPicker from '../BottomScrollPicker';
11
15
 
12
- const TimerActionTemplate = ({ actionGroup, doAction }) => {
16
+ const TimerActionTemplate = ({ actionGroup, doAction, sensor }) => {
17
+ const t = useTranslations();
13
18
  const { configuration, title } = actionGroup;
14
- const [showTimer, setShowTimer] = useState(false);
19
+ const [showTime, setShowTime] = useState(false);
20
+ const [showHour, setShowHour] = useState(false);
21
+
15
22
  // eslint-disable-next-line no-unused-vars
16
23
  const [configValues, setConfigValues] = useConfigGlobalState('configValues');
24
+ const configHour = configValues[configuration.config_hour];
25
+ const configMinute = configValues[configuration.config_minute];
17
26
 
18
- const currentTime = useMemo(() => {
19
- const configHour = configValues[configuration.config_hour];
20
- const configMinute = configValues[configuration.config_minute];
21
- if (!configHour || !configMinute) {
27
+ const dataTime = useMemo(() => {
28
+ if (
29
+ !configuration.config_hour ||
30
+ !configuration.config_minute ||
31
+ configHour === undefined ||
32
+ configHour === null ||
33
+ configHour === -1 ||
34
+ configMinute === undefined ||
35
+ configMinute === null ||
36
+ configMinute === -1
37
+ ) {
22
38
  return undefined;
23
39
  }
24
40
  return moment(`${configHour}:${configMinute}`, 'HH:mm');
25
- }, [configValues, configuration.config_hour, configuration.config_minute]);
41
+ }, [
42
+ configHour,
43
+ configMinute,
44
+ configuration.config_hour,
45
+ configuration.config_minute,
46
+ ]);
26
47
 
27
- const onShowTimer = useCallback(() => {
28
- setShowTimer(true);
48
+ const dataHour = useMemo(() => {
49
+ if (
50
+ !configuration.config_hour ||
51
+ configuration.config_minute ||
52
+ configHour === undefined ||
53
+ configHour === null ||
54
+ configHour === -1
55
+ ) {
56
+ return undefined;
57
+ }
58
+ return configHour;
59
+ }, [configHour, configuration.config_hour, configuration.config_minute]);
60
+
61
+ const onShowHour = useCallback(() => {
62
+ setShowHour(true);
63
+ }, []);
64
+
65
+ const onHideHour = useCallback(() => {
66
+ setShowHour(false);
29
67
  }, []);
30
68
 
31
- const onHideTimer = useCallback(() => {
32
- setShowTimer(false);
69
+ const onShowTime = useCallback(() => {
70
+ setShowTime(true);
33
71
  }, []);
34
72
 
35
- const onConfirm = useCallback(
73
+ const onHideTime = useCallback(() => {
74
+ setShowTime(false);
75
+ }, []);
76
+
77
+ const onShowTimer = useCallback(() => {
78
+ if (configuration.config_hour && configuration.config_minute) {
79
+ onShowTime();
80
+ return;
81
+ }
82
+ onShowHour();
83
+ }, [
84
+ configuration.config_hour,
85
+ configuration.config_minute,
86
+ onShowHour,
87
+ onShowTime,
88
+ ]);
89
+
90
+ const doActionTime = useCallback(
91
+ (hour, minute) => {
92
+ doAction(configuration.action_data, [hour, minute]);
93
+ if (sensor.is_managed_by_backend) {
94
+ hour &&
95
+ minute &&
96
+ watchMultiConfigs([
97
+ configuration.config_hour,
98
+ configuration.config_minute,
99
+ ]);
100
+ }
101
+ },
102
+ [
103
+ configuration.action_data,
104
+ configuration.config_hour,
105
+ configuration.config_minute,
106
+ doAction,
107
+ sensor.is_managed_by_backend,
108
+ ]
109
+ );
110
+
111
+ const doActionHour = useCallback(
112
+ (hour) => {
113
+ doAction(configuration.action_data, hour);
114
+ if (sensor.is_managed_by_backend) {
115
+ hour && watchMultiConfigs([configuration.config_hour]);
116
+ }
117
+ },
118
+ [
119
+ configuration.action_data,
120
+ configuration.config_hour,
121
+ doAction,
122
+ sensor.is_managed_by_backend,
123
+ ]
124
+ );
125
+
126
+ const onConfirmTime = useCallback(
36
127
  (timeData) => {
37
- setShowTimer(false);
128
+ onHideTime();
38
129
  const timeObj = moment(timeData);
39
- doAction(configuration.action_data, [timeObj.hour(), timeObj.minute()]);
130
+ doActionTime(timeObj.hour(), timeObj.minute());
131
+ },
132
+ [doActionTime, onHideTime]
133
+ );
134
+
135
+ const onConfirmHour = useCallback(
136
+ (number) => {
137
+ onHideHour();
138
+ doActionHour(number);
40
139
  },
41
- [configuration.action_data, doAction]
140
+ [doActionHour, onHideHour]
42
141
  );
43
142
 
143
+ const onSwitchOff = useCallback(() => {
144
+ if (!isTimerOn) {
145
+ return;
146
+ }
147
+ doActionTime(-1, -1);
148
+ }, [doActionTime, isTimerOn]);
149
+
44
150
  const isTimerOn = useMemo(() => {
45
- return !!currentTime;
46
- }, [currentTime]);
151
+ return !!dataTime;
152
+ }, [dataTime]);
153
+
154
+ const textTimer = useMemo(() => {
155
+ if (dataTime) {
156
+ return `${t('setting_at')} ${dataTime.format('HH:mm')}`;
157
+ }
158
+ if (dataHour) {
159
+ return `${t('setting_at')} ${dataHour} ${t('hours')}`;
160
+ }
161
+ return null;
162
+ }, [dataHour, dataTime, t]);
47
163
 
48
164
  return (
49
165
  <View style={styles.wrap}>
50
166
  <TouchableOpacity style={styles.timerButton} onPress={onShowTimer}>
51
167
  <View style={styles.timerTitle}>
52
168
  <Text>{title}</Text>
53
- {currentTime && (
54
- <Text
55
- type="Label"
56
- color={Colors.Gray7}
57
- >{`Setting at ${currentTime.format('HH:mm')}`}</Text>
169
+ {textTimer && (
170
+ <Text type="Label" color={Colors.Gray7}>
171
+ {textTimer}
172
+ </Text>
58
173
  )}
59
174
  </View>
60
175
  <View style={styles.timerButton}>
@@ -64,21 +179,31 @@ const TimerActionTemplate = ({ actionGroup, doAction }) => {
64
179
  </Text>
65
180
  </View>
66
181
  </TouchableOpacity>
67
- <Switch
68
- trackColor={{ false: Colors.Gray4, true: Colors.Primary }}
69
- thumbColor={isTimerOn ? Colors.White : Colors.Gray6}
70
- ios_backgroundColor={Colors.Gray4}
71
- value={isTimerOn}
72
- disabled
73
- />
182
+ {configuration.config_hour && configuration.config_minute && (
183
+ <Switch
184
+ trackColor={{ false: Colors.Gray4, true: Colors.Primary }}
185
+ thumbColor={isTimerOn ? Colors.White : Colors.Gray6}
186
+ ios_backgroundColor={Colors.Gray4}
187
+ value={isTimerOn}
188
+ onValueChange={onSwitchOff}
189
+ disabled={!isTimerOn}
190
+ />
191
+ )}
74
192
  <DateTimePickerModal
75
- isVisible={showTimer}
76
- date={currentTime ? currentTime.valueOf() : moment().valueOf()}
193
+ isVisible={showTime}
194
+ date={dataTime ? dataTime.valueOf() : moment().valueOf()}
77
195
  mode="time"
78
- onConfirm={onConfirm}
79
- onCancel={onHideTimer}
196
+ onConfirm={onConfirmTime}
197
+ onCancel={onHideTime}
80
198
  display="spinner"
81
199
  />
200
+ <BottomScrollPicker
201
+ min={configuration.min}
202
+ max={configuration.max}
203
+ isVisible={showHour}
204
+ onHide={onHideHour}
205
+ onPicked={onConfirmHour}
206
+ />
82
207
  </View>
83
208
  );
84
209
  };
@@ -7,7 +7,7 @@ import { watchMultiConfigs } from '../../../iot/Monitor';
7
7
  import { AlertAction, RadioCircle } from '../../../commons';
8
8
  import { TESTID } from '../../../configs/Constants';
9
9
  import IconComponent from '../../../commons/IconComponent';
10
- import { t } from 'i18n-js';
10
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
11
11
 
12
12
  jest.mock('../../../iot/Monitor');
13
13
 
@@ -16,6 +16,7 @@ jest.mock('../../../iot/states', () => ({
16
16
  }));
17
17
 
18
18
  describe('Test OptionsDropdownActionTemplate', () => {
19
+ const t = useTranslations();
19
20
  const action_data = {
20
21
  color: '#00979D',
21
22
  command_prefer_over_bluetooth: true,
@@ -1,7 +1,8 @@
1
- import { t } from 'i18n-js';
1
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
2
2
  import { useCallback, useState } from 'react';
3
3
 
4
4
  export const useDropdownAction = () => {
5
+ const t = useTranslations();
5
6
  const [stateAlert, setStateAlert] = useState({
6
7
  visible: false,
7
8
  title: 'Fan Speed',