@eohjsc/react-native-smart-city 0.2.92 → 0.2.95

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 (89) hide show
  1. package/assets/images/Device/air-dry.svg +3 -0
  2. package/assets/images/Device/auto.svg +3 -0
  3. package/assets/images/Device/circulator.svg +4 -0
  4. package/assets/images/Device/clean.svg +5 -0
  5. package/assets/images/Device/current-state.svg +3 -0
  6. package/assets/images/Device/door-state.svg +3 -0
  7. package/assets/images/Device/wind-strength.svg +12 -0
  8. package/package.json +1 -1
  9. package/src/commons/Action/ItemQuickAction.js +1 -0
  10. package/src/commons/Action/__test__/ItemQuickAction.test.js +49 -2
  11. package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplateStyle.js +2 -1
  12. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +31 -11
  13. package/src/commons/ActionGroup/OptionsDropdownActionTemplateStyle.js +5 -2
  14. package/src/commons/ActionGroup/StatesGridActionTemplate.js +42 -36
  15. package/src/commons/ActionGroup/StatesGridActionTemplateStyle.js +5 -10
  16. package/src/commons/ActionGroup/TimerActionTemplate.js +14 -10
  17. package/src/commons/ActionGroup/TimerActionTemplateStyles.js +12 -0
  18. package/src/commons/ActionGroup/TwoButtonTemplate/TwoButtonTemplateStyles.js +55 -0
  19. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +170 -0
  20. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +1 -1
  21. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +112 -0
  22. package/src/commons/ActionGroup/index.js +3 -0
  23. package/src/commons/CameraDevice/index.js +6 -1
  24. package/src/commons/Device/HistoryChart.js +2 -2
  25. package/src/commons/Device/ItemDevice.js +3 -13
  26. package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +19 -0
  27. package/src/commons/Explore/SearchBox/index.js +2 -0
  28. package/src/commons/IconComponent/index.js +32 -26
  29. package/src/commons/MediaPlayerDetail/index.js +16 -4
  30. package/src/commons/MenuActionMore/index.js +2 -2
  31. package/src/commons/Modal/ModalCustom.js +9 -1
  32. package/src/commons/SubUnit/Favorites/index.js +8 -7
  33. package/src/commons/SubUnit/__test__/Favorites.test.js +33 -35
  34. package/src/configs/API.js +6 -2
  35. package/src/configs/Colors.js +1 -0
  36. package/src/configs/Constants.js +24 -0
  37. package/src/context/actionType.ts +17 -0
  38. package/src/context/mockStore.ts +18 -0
  39. package/src/context/reducer.ts +102 -0
  40. package/src/iot/RemoteControl/Bluetooth.js +2 -0
  41. package/src/iot/RemoteControl/GoogleHome.js +1 -0
  42. package/src/navigations/AutomateStack.js +16 -1
  43. package/src/navigations/UnitStack.js +27 -0
  44. package/src/screens/AddCommon/SelectSubUnit.js +1 -0
  45. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +2 -0
  46. package/src/screens/AddNewAction/Device/__test__/index.test.js +1 -1
  47. package/src/screens/AddNewAction/SelectAction.js +13 -15
  48. package/src/screens/AddNewAction/__test__/SelectAction.test.js +0 -7
  49. package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +2 -0
  50. package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +2 -0
  51. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +9 -0
  52. package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +15 -0
  53. package/src/screens/AddNewGateway/SetupGatewayWifi.js +6 -1
  54. package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +34 -0
  55. package/src/screens/AllCamera/index.js +1 -0
  56. package/src/screens/Automate/MultiUnits.js +9 -9
  57. package/src/screens/Automate/index.js +21 -20
  58. package/src/screens/Device/__test__/detail.test.js +119 -86
  59. package/src/screens/Device/detail.js +38 -51
  60. package/src/screens/Device/hooks/useFavoriteDevice.js +38 -0
  61. package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -1
  62. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +41 -44
  63. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +1 -0
  64. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +18 -19
  65. package/src/screens/MoveToAnotherSubUnit/index.js +3 -1
  66. package/src/screens/Notification/__test__/NotificationItem.test.js +64 -53
  67. package/src/screens/Notification/components/NotificationItem.js +13 -4
  68. package/src/screens/ScriptDetail/__test__/index.test.js +15 -4
  69. package/src/screens/ScriptDetail/hooks/useStarredScript.js +32 -0
  70. package/src/screens/ScriptDetail/index.js +11 -20
  71. package/src/screens/SharedUnit/__test__/TabHeader.test.js +5 -0
  72. package/src/screens/Sharing/SelectUser.js +3 -23
  73. package/src/screens/Sharing/__test__/SelectUser.test.js +12 -80
  74. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +33 -0
  75. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +2 -0
  76. package/src/screens/Unit/ChooseLocation.js +5 -0
  77. package/src/screens/Unit/Detail.js +33 -37
  78. package/src/screens/Unit/ManageUnit.js +21 -20
  79. package/src/screens/Unit/ManageUnitStyles.js +1 -0
  80. package/src/screens/Unit/SelectAddress.js +8 -2
  81. package/src/screens/Unit/Summaries.js +12 -15
  82. package/src/screens/Unit/__test__/Detail.test.js +25 -0
  83. package/src/screens/Unit/components/__test__/Header.test.js +32 -0
  84. package/src/screens/Unit/hook/useFavorites.js +28 -0
  85. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +1 -1
  86. package/src/screens/UnitSummary/components/PowerConsumption/index.js +1 -1
  87. package/src/utils/Apis/axios.js +7 -2
  88. package/src/utils/I18n/translations/en.json +2 -5
  89. package/src/utils/I18n/translations/vi.json +1 -4
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M12.1302 0.511174C11.3959 1.343 4.08508 10.1691 4.08508 15.4443C4.08508 19.8876 7.68713 23.4894 12.1302 23.4894C16.5733 23.4894 20.1753 19.8876 20.1753 15.4443C20.1753 9.80224 12.1024 0.427685 12.1302 0.511174ZM11.6441 21.4844L11.6203 21.4839C9.92602 21.3784 7.67768 20.7243 6.57036 18.2043C6.47513 17.9873 6.57445 17.7332 6.79121 17.6375C7.00644 17.5443 7.26559 17.6479 7.35802 17.8581C8.29096 19.9816 10.2178 20.5348 11.6706 20.625C11.907 20.6395 12.0878 20.844 12.0733 21.0807C12.0587 21.3072 11.8703 21.4844 11.6441 21.4844Z" fill="#262626"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M10 18C14.42 18 18 14.42 18 10C18 5.58 14.42 2 10 2C5.58 2 2 5.58 2 10C2 14.42 5.58 18 10 18ZM10 0C15.52 0 20 4.48 20 10C20 15.43 15.67 19.85 10.28 20H10C4.48 20 0 15.52 0 10C0 4.48 4.48 0 10 0ZM10.83 5H9.18L6 14H8.24L8.67 12.66H11.35L11.75 14H14L10.83 5ZM10.06 8.41L10.8 10.81H9.28L10.06 8.41Z" fill="#262626"/>
3
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M2.11682 11.024C2.40536 9.18824 3.22604 7.47741 4.47723 6.1034C5.72841 4.72939 7.35515 3.75257 9.15598 3.29389C10.9568 2.83521 12.8526 2.91484 14.6087 3.5229C16.3647 4.13096 17.9038 5.24075 19.0353 6.71483L19.6441 7.50745V4.69527H21.0013V10.1242H15.5724V8.76696H17.9944L17.6211 8.23323C16.7705 7.01113 15.5737 6.0715 14.1846 5.53525C12.7956 4.999 11.2778 4.89065 9.82666 5.22414C8.37551 5.55764 7.05734 6.31772 6.04175 7.40659C5.02617 8.49547 4.35963 9.86332 4.12789 11.3342L2.11682 11.024Z" fill="black"/>
3
+ <path d="M11.5006 22C10.0429 22.0056 8.60381 21.673 7.29637 21.0285C5.98894 20.3839 4.84881 19.4449 3.96561 18.2852L3.35723 17.4913V20.3034H2V14.8745H7.42891V16.2317H5.00694L5.38018 16.7655C6.23084 17.9875 7.4277 18.9271 8.81677 19.4633C10.2058 19.9996 11.7236 20.1079 13.1747 19.7744C14.6259 19.4409 15.9441 18.6809 16.9597 17.592C17.9753 16.5032 18.6419 15.1354 18.8737 13.6646L20.8852 13.9747C20.5347 16.2116 19.3964 18.2497 17.6756 19.7212C15.9548 21.1928 13.7648 22.001 11.5006 22Z" fill="black"/>
4
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M23.2968 16.5784C21.8701 16.5784 20.5301 16.028 19.5234 15.0284C18.517 14.0294 17.963 12.6988 17.963 11.2817C17.963 10.8934 17.648 10.5786 17.2598 10.5786C16.8715 10.5786 16.5567 10.8934 16.5567 11.2817C16.5567 12.6988 16.0024 14.0294 14.9961 15.0284C13.9894 16.028 12.6494 16.5784 11.2227 16.5784C10.8343 16.5784 10.5195 16.8932 10.5195 17.2816C10.5195 17.6699 10.8343 17.9847 11.2227 17.9847C14.1637 17.9847 16.5567 20.3678 16.5567 23.2969C16.5567 23.6853 16.8715 24.0001 17.2598 24.0001C17.648 24.0001 17.963 23.6853 17.963 23.2969C17.963 20.3678 20.3558 17.9847 23.2968 17.9847C23.6852 17.9847 23.9999 17.6699 23.9999 17.2816C23.9999 16.8932 23.6852 16.5784 23.2968 16.5784Z" fill="black"/>
3
+ <path d="M9.62036 11.0806C7.54962 11.0806 5.86487 9.40826 5.86487 7.35254C5.86487 6.96436 5.55011 6.64941 5.16174 6.64941C4.77338 6.64941 4.45862 6.96436 4.45862 7.35254C4.45862 9.40826 2.77386 11.0806 0.703125 11.0806C0.314758 11.0806 0 11.3955 0 11.7837C0 12.1721 0.314758 12.4868 0.703125 12.4868C2.77386 12.4868 4.45862 14.1644 4.45862 16.2264C4.45862 16.6146 4.77338 16.9295 5.16174 16.9295C5.55011 16.9295 5.86487 16.6146 5.86487 16.2264C5.86487 14.1644 7.54962 12.4868 9.62036 12.4868C10.0087 12.4868 10.3235 12.1721 10.3235 11.7837C10.3235 11.3955 10.0087 11.0806 9.62036 11.0806Z" fill="black"/>
4
+ <path d="M10.7642 4.85889C12.287 4.85889 13.5261 6.08844 13.5261 7.59961C13.5261 7.98779 13.8409 8.30273 14.2292 8.30273C14.6176 8.30273 14.9324 7.98779 14.9324 7.59961C14.9324 6.0835 16.1714 4.8501 17.6943 4.8501C18.0827 4.8501 18.3975 4.53516 18.3975 4.14697C18.3975 3.75861 18.0827 3.44385 17.6943 3.44385C16.1714 3.44385 14.9324 2.21429 14.9324 0.703125C14.9324 0.314758 14.6176 0 14.2292 0C13.8409 0 13.5261 0.314758 13.5261 0.703125C13.5261 2.21924 12.287 3.45264 10.7642 3.45264C10.3758 3.45264 10.061 3.7674 10.061 4.15576C10.061 4.54413 10.3758 4.85889 10.7642 4.85889Z" fill="black"/>
5
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M10.8333 17.5003C10.8333 17.9612 11.2058 18.3337 11.6667 18.3337H14.1667C15.0508 18.3337 15.8983 17.9828 16.5233 17.3578C17.1483 16.7328 17.5 15.8845 17.5 15.0003V14.167C17.5 13.707 17.1267 13.3337 16.6667 13.3337H11.6667C11.2058 13.3337 10.8333 13.707 10.8333 14.167V17.5003ZM8.33333 18.3337C8.79333 18.3337 9.16667 17.9612 9.16667 17.5003V9.16699C9.16667 8.70699 8.79333 8.33366 8.33333 8.33366H3.33333C2.8725 8.33366 2.5 8.70699 2.5 9.16699V15.0003C2.5 15.8845 2.85083 16.7328 3.47583 17.3578C4.10083 17.9828 4.94917 18.3337 5.83333 18.3337H8.33333ZM11.6667 1.66699C11.2058 1.66699 10.8333 2.04033 10.8333 2.50033V10.8337C10.8333 11.2945 11.2058 11.667 11.6667 11.667H16.6667C17.1267 11.667 17.5 11.2945 17.5 10.8337V5.00033C17.5 4.11699 17.1483 3.26866 16.5233 2.64366C15.8983 2.01866 15.0508 1.66699 14.1667 1.66699H11.6667ZM9.16667 2.50033C9.16667 2.04033 8.79333 1.66699 8.33333 1.66699H5.83333C4.94917 1.66699 4.10083 2.01866 3.47583 2.64366C2.85083 3.26866 2.5 4.11699 2.5 5.00033V5.83366C2.5 6.29449 2.8725 6.66699 3.33333 6.66699H8.33333C8.79333 6.66699 9.16667 6.29449 9.16667 5.83366V2.50033Z" fill="#262626"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="14" height="20" viewBox="0 0 14 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M5.08207 0V1.4578H0.44812V18.5208L5.08207 18.5246V20L13.543 18.4803L13.5517 1.53027L5.08207 0ZM6.4854 9.33048C6.76956 9.33048 6.99993 9.63026 6.99993 10C6.99993 10.3698 6.7696 10.6695 6.4854 10.6695C6.20121 10.6695 5.97087 10.3698 5.97087 10C5.97083 9.63026 6.20125 9.33048 6.4854 9.33048ZM1.82397 17.1461V2.83366H5.08207V17.1487L1.82397 17.1461Z" fill="#262626"/>
3
+ </svg>
@@ -0,0 +1,12 @@
1
+ <svg width="19" height="19" viewBox="0 0 19 19" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M9.58338 8.90405C8.73524 8.90405 8.04529 9.59401 8.04529 10.4421C8.04529 11.2903 8.73524 11.9802 9.58338 11.9802C10.4315 11.9802 11.1215 11.2903 11.1215 10.4421C11.1215 9.59401 10.4315 8.90405 9.58338 8.90405Z" fill="#262626"/>
3
+ <path d="M10.0896 1.0983C10.05 0.849986 9.8352 0.666748 9.58337 0.666748C9.33153 0.666748 9.11722 0.849507 9.07716 1.09782C8.70402 4.72594 7.74586 6.7972 8.36633 8.20011C8.73014 8.00173 9.14063 7.87868 9.58337 7.87868C10.021 7.87868 10.4271 7.99913 10.788 8.19334C11.4004 6.7651 10.4525 4.62911 10.0896 1.0983Z" fill="#262626"/>
4
+ <path d="M18.1316 14.6488C15.1069 12.5509 13.6552 10.7323 12.1377 10.5322C12.1065 11.4101 11.6353 12.1731 10.9347 12.6112C11.8983 13.8846 14.3342 14.0934 17.6464 15.5385C17.8858 15.6247 18.1498 15.5233 18.2708 15.3017C18.392 15.0794 18.3329 14.802 18.1316 14.6488Z" fill="#262626"/>
5
+ <path d="M7.02812 10.5229C5.53447 10.7118 4.13354 12.5038 1.03566 14.6484C0.833895 14.8021 0.774798 15.0795 0.895965 15.3018C1.01399 15.5191 1.27536 15.6259 1.52033 15.5386C4.89766 14.0713 7.29305 13.8803 8.2387 12.6149C7.53207 12.1759 7.05629 11.4075 7.02812 10.5229Z" fill="#262626"/>
6
+ <path d="M4.08742 9.17253C4.02384 9.44843 4.19607 9.72381 4.47194 9.78739C4.51101 9.79641 4.54956 9.80041 4.5876 9.80041C4.82091 9.80041 5.03221 9.64018 5.08677 9.40287C5.36653 8.18688 6.13776 7.15968 7.1704 6.52144C7.2054 6.12909 7.26884 5.71527 7.34947 5.27661C5.72907 5.98082 4.49129 7.4176 4.08742 9.17253Z" fill="#262626"/>
7
+ <path d="M1.89294 10.4422C1.89294 10.7542 1.91147 11.0611 1.94753 11.3635C1.98157 11.649 2.24199 11.8456 2.51731 11.8121C2.7982 11.7786 2.99945 11.5237 2.96592 11.2423C2.93488 10.98 2.91834 10.7131 2.91834 10.4422C2.91834 7.49837 4.87318 4.95502 7.57711 4.0943C7.6469 3.73856 7.71731 3.3685 7.78564 2.9729C4.39986 3.79175 1.89294 6.86092 1.89294 10.4422Z" fill="#262626"/>
8
+ <path d="M11.5742 15.1955C11.4916 14.9246 11.2062 14.7694 10.9339 14.8556C9.76304 15.2133 8.46678 15.0536 7.38673 14.4771C7.02542 14.6444 6.62582 14.7981 6.20032 14.9462C7.17034 15.6732 8.35757 16.0817 9.58353 16.0817C10.1458 16.0817 10.7011 15.9991 11.2343 15.8359C11.5046 15.7533 11.6574 15.4663 11.5742 15.1955Z" fill="#262626"/>
9
+ <path d="M14.2983 15.8736C14.1291 15.6483 13.8076 15.6027 13.5803 15.7724C12.4192 16.6457 11.0374 17.1073 9.5834 17.1073C7.89129 17.1073 6.28662 16.4572 5.06627 15.3291C4.72242 15.4422 4.36162 15.5636 3.98523 15.6951C5.4295 17.2333 7.44556 18.1668 9.5834 18.1668C11.2612 18.1668 12.8568 17.5999 14.1972 16.5916C14.4235 16.4213 14.4685 16.0999 14.2983 15.8736Z" fill="#262626"/>
10
+ <path d="M12.603 3.36954C12.3451 3.2574 12.0417 3.37809 11.9301 3.63895C11.8184 3.89882 11.9391 4.20022 12.1994 4.31188C14.6593 5.36629 16.2484 7.77255 16.2484 10.4422C16.2484 10.9121 16.1958 11.3723 16.1007 11.8223C16.3763 12.0494 16.6665 12.2855 16.9745 12.5304C17.1657 11.8552 17.2739 11.1587 17.2739 10.4422C17.2739 7.36147 15.4404 4.58522 12.603 3.36954Z" fill="#262626"/>
11
+ <path d="M13.4302 6.31817C13.2224 6.12441 12.8979 6.13593 12.7057 6.34271C12.5124 6.54998 12.5234 6.87445 12.7302 7.0677C13.6476 7.92394 14.1551 9.07894 14.1859 10.3264C14.5032 10.5404 14.8303 10.7891 15.1759 11.0666C15.1989 10.8595 15.2231 10.6523 15.2231 10.4423C15.2231 8.88515 14.5697 7.38161 13.4302 6.31817Z" fill="#262626"/>
12
+ </svg>
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.92",
4
+ "version": "0.2.95",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -94,6 +94,7 @@ const ItemQuickAction = memo(({ sensor, wrapperStyle, setStatus, unit }) => {
94
94
  icon={action.icon}
95
95
  iconKit={action.icon_kit}
96
96
  isSendingCommand={isSendingCommand}
97
+ icon_outlined={'poweroff'}
97
98
  />
98
99
  </View>
99
100
  </TouchableOpacity>
@@ -41,7 +41,6 @@ describe('Test ItemQuickAction', () => {
41
41
  command_prefer_over_googlehome: false,
42
42
  command_prefer_over_internet: false,
43
43
  id: 9,
44
- icon: 'caret-up',
45
44
  },
46
45
  quick_action: {
47
46
  config_id: 51,
@@ -97,9 +96,42 @@ describe('Test ItemQuickAction', () => {
97
96
  expect(buttonOnActionPress).toHaveLength(0);
98
97
  });
99
98
 
100
- test('render with full action data case on', () => {
99
+ test('render with full action data case on and icon up', () => {
101
100
  const mockSetStatus = jest.fn();
101
+ sensor.action.icon = 'up';
102
+ act(() => {
103
+ tree = create(
104
+ <ItemQuickAction
105
+ sensor={sensor}
106
+ wrapperStyle={style}
107
+ setStatus={mockSetStatus}
108
+ />
109
+ );
110
+ });
111
+
112
+ const instance = tree.root;
113
+ const buttonOnActionPress = instance.find(
114
+ (el) =>
115
+ el.props.testID === TESTID.ITEM_QUICK_ACTION_PRESS &&
116
+ el.type === TouchableOpacity
117
+ );
118
+ expect(buttonOnActionPress).toBeDefined();
102
119
 
120
+ mockSetState.mockClear();
121
+ act(() => {
122
+ buttonOnActionPress.props.onPress();
123
+ });
124
+ expect(sendRemoteCommand).toBeCalled();
125
+ expect(mockSetState).toBeCalledTimes(1);
126
+
127
+ jest.runAllTimers();
128
+ expect(mockSetState).toBeCalledTimes(3);
129
+ expect(mockSetState).toBeCalledWith(sensor.quick_action.off_action);
130
+ });
131
+
132
+ test('render with icon_outlined poweroff', () => {
133
+ const mockSetStatus = jest.fn();
134
+ sensor.action.icon = null;
103
135
  act(() => {
104
136
  tree = create(
105
137
  <ItemQuickAction
@@ -188,6 +220,21 @@ describe('Test ItemQuickAction', () => {
188
220
  expect(buttonOnActionPress).toBeDefined();
189
221
  });
190
222
 
223
+ test('click quick action icon down , isSendingCommand = true', () => {
224
+ sensor.action.icon = 'down';
225
+ useState.mockImplementationOnce((init) => [true, mockSetState]);
226
+ act(() => {
227
+ tree = create(<ItemQuickAction sensor={sensor} wrapperStyle={style} />);
228
+ });
229
+
230
+ const instance = tree.root;
231
+ const buttonOnActionPress = instance.find(
232
+ (el) =>
233
+ el.props.testID === TESTID.ITEM_QUICK_ACTION_PRESS &&
234
+ el.type === TouchableOpacity
235
+ );
236
+ expect(buttonOnActionPress).toBeDefined();
237
+ });
191
238
  test('trigger action with quick action no auto update', () => {
192
239
  const noAutoUpdateSensor = {
193
240
  action: {
@@ -3,7 +3,7 @@ import { StyleSheet } from 'react-native';
3
3
 
4
4
  export default StyleSheet.create({
5
5
  wrap: {
6
- paddingVertical: 36,
6
+ paddingVertical: 16,
7
7
  paddingHorizontal: 16,
8
8
  marginHorizontal: 20,
9
9
  marginTop: 20,
@@ -21,5 +21,6 @@ export default StyleSheet.create({
21
21
  },
22
22
  marginRight: {
23
23
  marginRight: 10,
24
+ paddingBottom: 2,
24
25
  },
25
26
  });
@@ -12,6 +12,9 @@ import { watchMultiConfigs } from '../../iot/Monitor';
12
12
  import { TESTID } from '../../configs/Constants';
13
13
  import IconComponent from '../../commons/IconComponent';
14
14
  import { useTranslations } from '../../hooks/Common/useTranslations';
15
+ import SvgDoorState from '../../../assets/images/Device/door-state.svg';
16
+ import SvgCurrentState from '../../../assets/images/Device/current-state.svg';
17
+ import SvgWindStrength from '../../../assets/images/Device/wind-strength.svg';
15
18
 
16
19
  function getOptionValue(option) {
17
20
  if (option.value_text) {
@@ -27,7 +30,7 @@ const OptionsDropdownActionTemplate = ({ actionGroup, doAction, sensor }) => {
27
30
  configuration;
28
31
  // eslint-disable-next-line no-unused-vars
29
32
  const [configValues, setConfigValues] = useConfigGlobalState('configValues');
30
-
33
+ const checkIcon = /\d/.test(icon); // to do check icon svg and icon antDesign
31
34
  const selectedOption = useMemo(() => {
32
35
  const currentValue = configValues[configuration.config];
33
36
  if (currentValue === null || currentValue === undefined) {
@@ -84,23 +87,40 @@ const OptionsDropdownActionTemplate = ({ actionGroup, doAction, sensor }) => {
84
87
  return selectedOption.text;
85
88
  }, [configuration.config, selectedOption.text, t]);
86
89
 
90
+ const iconSvg = useMemo(() => {
91
+ switch (icon) {
92
+ case 'door-state-1':
93
+ return <SvgDoorState width={24} height={24} />;
94
+ case 'curent-state-1':
95
+ return <SvgCurrentState width={24} height={24} />;
96
+ case 'wind-strength-1':
97
+ return <SvgWindStrength width={24} height={24} />;
98
+ default:
99
+ return () => <></>;
100
+ }
101
+ }, [icon]);
102
+
87
103
  return (
88
104
  <View style={styles.wrap}>
89
105
  <View style={styles.iconAndText}>
90
- <IconComponent
91
- icon={icon}
92
- iconKit={iconKit}
93
- icon_outlined={icon_outlined}
94
- isSendingCommand={false}
95
- size={17}
96
- style={styles.marginRight}
97
- />
98
- <Text type="H4">{title}</Text>
106
+ {!checkIcon && (
107
+ <IconComponent
108
+ icon={icon}
109
+ iconKit={iconKit}
110
+ icon_outlined={icon_outlined}
111
+ isSendingCommand={false}
112
+ size={17}
113
+ style={styles.marginRight}
114
+ />
115
+ )}
116
+ {checkIcon && <View style={styles.marginRight}>{iconSvg}</View>}
117
+ <Text style={styles.textTitle} type="H4">
118
+ {title}
119
+ </Text>
99
120
  </View>
100
121
  <TouchableOpacity style={styles.iconAndTextOption} onPress={onShowAlert}>
101
122
  <Text
102
123
  testID={TESTID.OPTIONS_DROPDOWN_ACTION_DISPLAY_SELECTED}
103
- type="Body"
104
124
  color={
105
125
  displaySelected === t('not_available') ? Colors.Gray6 : Colors.Gray8
106
126
  }
@@ -3,7 +3,7 @@ import { Colors } from '../../configs';
3
3
 
4
4
  export default StyleSheet.create({
5
5
  wrap: {
6
- paddingVertical: 36,
6
+ paddingVertical: 16,
7
7
  paddingHorizontal: 16,
8
8
  marginHorizontal: 20,
9
9
  marginTop: 20,
@@ -43,7 +43,7 @@ export default StyleSheet.create({
43
43
  },
44
44
  text: {
45
45
  fontSize: 16,
46
- lineHeight: 24,
46
+ lineHeight: 20,
47
47
  color: Colors.Gray9,
48
48
  },
49
49
  writeNotAvailable: {
@@ -52,4 +52,7 @@ export default StyleSheet.create({
52
52
  scrollView: {
53
53
  height: 350,
54
54
  },
55
+ textTitle: {
56
+ paddingTop: 2,
57
+ },
55
58
  });
@@ -8,6 +8,10 @@ import { watchMultiConfigs } from '../../iot/Monitor';
8
8
  import IconComponent from '../IconComponent';
9
9
  import styles from './StatesGridActionTemplateStyle';
10
10
  import { TESTID } from '../../configs/Constants';
11
+ import SvgClean from '../../../assets/images/Device/clean.svg';
12
+ import SvgCirculator from '../../../assets/images/Device/circulator.svg';
13
+ import SvgAuo from '../../../assets/images/Device/auto.svg';
14
+ import SvgAirDry from '../../../assets/images/Device/air-dry.svg';
11
15
 
12
16
  const buttonStyle = {
13
17
  OFF: {
@@ -21,21 +25,6 @@ const buttonStyle = {
21
25
  };
22
26
 
23
27
  const GridItem = ({ item, index, length, doAction, sensor, title }) => {
24
- const isFirst = index === 0;
25
- const isLast = index === length - 1;
26
- const isNextLine = index % 4 === 0;
27
-
28
- let extraStyle = {};
29
- if (isFirst || isNextLine) {
30
- extraStyle.marginLeft = 24;
31
- }
32
- if (isLast) {
33
- extraStyle.marginRight = 24;
34
- }
35
- if (index > 3) {
36
- extraStyle.marginTop = 24;
37
- }
38
-
39
28
  const {
40
29
  active,
41
30
  text,
@@ -46,6 +35,7 @@ const GridItem = ({ item, index, length, doAction, sensor, title }) => {
46
35
  config,
47
36
  } = item;
48
37
  const buttonOnOffStyle = active ? buttonStyle.ON : buttonStyle.OFF;
38
+ const checkIcon = /\d/.test(icon); // to do check icon svg and icon antDesign
49
39
 
50
40
  const doActionAndWatchConfig = useCallback(
51
41
  (actionData) => {
@@ -63,22 +53,40 @@ const GridItem = ({ item, index, length, doAction, sensor, title }) => {
63
53
 
64
54
  const iconKit = !!icon_kit_data && icon_kit_data.icon;
65
55
 
56
+ const iconSvg = useMemo(() => {
57
+ switch (icon) {
58
+ case 'clean-1':
59
+ return <SvgClean width={24} height={24} />;
60
+ case 'circulator-1':
61
+ return <SvgCirculator width={24} height={24} />;
62
+ case 'auto-1':
63
+ return <SvgAuo width={24} height={24} />;
64
+ case 'air-dry-1':
65
+ return <SvgAirDry width={24} height={24} />;
66
+ default:
67
+ return () => <></>;
68
+ }
69
+ }, [icon]);
70
+
66
71
  return (
67
72
  <View
68
- style={[styles.gridItem, extraStyle]}
73
+ style={[styles.gridItem]}
69
74
  testID={TESTID.STATES_GRID_ACTION_GRID_ITEM}
70
75
  >
71
76
  <TouchableOpacity
72
77
  style={[styles.button, buttonOnOffStyle]}
73
78
  onPress={() => doActionAndWatchConfig(action_data)}
74
79
  >
75
- <IconComponent
76
- icon={icon}
77
- iconKit={iconKit}
78
- icon_outlined={icon_outlined}
79
- isSendingCommand={false}
80
- size={24}
81
- />
80
+ {!checkIcon && (
81
+ <IconComponent
82
+ icon={icon}
83
+ iconKit={iconKit}
84
+ icon_outlined={icon_outlined}
85
+ isSendingCommand={false}
86
+ size={24}
87
+ />
88
+ )}
89
+ {checkIcon && <View>{iconSvg}</View>}
82
90
  </TouchableOpacity>
83
91
  <Text center color={Colors.Gray8} style={styles.textMargin}>
84
92
  {text}
@@ -116,19 +124,17 @@ const StatesGridActionTemplate = ({ actionGroup, doAction, sensor }) => {
116
124
  <Text type="H4" style={styles.textModeMargin}>
117
125
  {title}
118
126
  </Text>
119
- <View style={styles.center}>
120
- <View style={styles.wrapOption}>
121
- {options.map((item, index) => (
122
- <GridItem
123
- item={item}
124
- index={index}
125
- length={options.length}
126
- doAction={doAction}
127
- sensor={sensor}
128
- title={title}
129
- />
130
- ))}
131
- </View>
127
+ <View style={styles.wrapOption}>
128
+ {options.map((item, index) => (
129
+ <GridItem
130
+ item={item}
131
+ index={index}
132
+ length={options.length}
133
+ doAction={doAction}
134
+ sensor={sensor}
135
+ title={title}
136
+ />
137
+ ))}
132
138
  </View>
133
139
  </View>
134
140
  );
@@ -8,23 +8,18 @@ export default StyleSheet.create({
8
8
  marginHorizontal: 20,
9
9
  borderWidth: 1,
10
10
  borderColor: Colors.Gray4,
11
- borderTopWidth: 0,
11
+ borderTopRightRadius: 10,
12
+ borderTopLeftRadius: 10,
12
13
  borderBottomRightRadius: 10,
13
14
  borderBottomLeftRadius: 10,
14
- },
15
- center: {
16
- flex: 1,
17
- alignItems: 'center',
15
+ marginTop: 20,
18
16
  },
19
17
  wrapOption: {
20
18
  flex: 1,
21
19
  flexDirection: 'row',
20
+ justifyContent: 'space-between',
22
21
  flexWrap: 'wrap',
23
- width: 312,
24
- },
25
- gridItem: {
26
- width: 48,
27
- marginHorizontal: 12,
22
+ paddingHorizontal: 16,
28
23
  },
29
24
  textMargin: {
30
25
  marginTop: 8,
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useMemo, useState } from 'react';
2
2
  import { Switch, TouchableOpacity, View } from 'react-native';
3
+ import { Icon } from '@ant-design/react-native';
3
4
  import DateTimePickerModal from 'react-native-modal-datetime-picker';
4
5
  import moment from 'moment';
5
6
  import { IconOutline } from '@ant-design/icons-react-native';
@@ -167,18 +168,21 @@ const TimerActionTemplate = ({ actionGroup, doAction, sensor }) => {
167
168
  <TouchableOpacity style={styles.timerButton} onPress={onShowTimer}>
168
169
  <View style={styles.timerTitle}>
169
170
  <Text>{title}</Text>
170
- {textTimer && (
171
- <Text type="Label" color={Colors.Gray7}>
172
- {textTimer}
173
- </Text>
171
+ {configuration.config_hour && configuration.config_minute && (
172
+ <View style={styles.wrapTimer}>
173
+ <Icon style={styles.iconClockCircle} name={'clock-circle'} />
174
+ <Text type="Label" color={Colors.Gray7}>
175
+ {textTimer ? textTimer : t('set_time')}
176
+ </Text>
177
+ </View>
174
178
  )}
175
179
  </View>
176
- <View style={styles.timerButton}>
177
- <IconOutline name="right" size={20} />
178
- <Text color={Colors.Gray11} type="Label">
179
- |
180
- </Text>
181
- </View>
180
+ {configuration.config_hour && !configuration.config_minute && (
181
+ <View style={styles.timerButton}>
182
+ <Text style={styles.textTimerEndLine}>{textTimer}</Text>
183
+ <IconOutline name="right" size={20} />
184
+ </View>
185
+ )}
182
186
  </TouchableOpacity>
183
187
  {configuration.config_hour && configuration.config_minute && (
184
188
  <Switch
@@ -24,4 +24,16 @@ export default StyleSheet.create({
24
24
  flex: 1,
25
25
  justifyContent: 'center',
26
26
  },
27
+ wrapTimer: {
28
+ paddingTop: 10,
29
+ flexDirection: 'row',
30
+ },
31
+ iconClockCircle: {
32
+ fontSize: 16,
33
+ color: Colors.Black,
34
+ paddingRight: 15,
35
+ },
36
+ textTimerEndLine: {
37
+ paddingRight: 10,
38
+ },
27
39
  });
@@ -0,0 +1,55 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { Colors } from '../../../configs';
3
+
4
+ export default StyleSheet.create({
5
+ wrap: {
6
+ paddingVertical: 16,
7
+ paddingHorizontal: 16,
8
+ marginHorizontal: 20,
9
+ marginTop: 20,
10
+ flex: 1,
11
+ flexDirection: 'row',
12
+ justifyContent: 'center',
13
+ alignItems: 'center',
14
+ },
15
+ bigCircle: {
16
+ backgroundColor: Colors.Gray2,
17
+ width: 160,
18
+ height: 160,
19
+ borderRadius: 200,
20
+ justifyContent: 'center',
21
+ alignItems: 'center',
22
+ margin: 10,
23
+
24
+ shadowColor: Colors.Gray11,
25
+ shadowOffset: {
26
+ width: 0,
27
+ height: 8,
28
+ },
29
+ shadowOpacity: 1,
30
+ shadowRadius: 12,
31
+ elevation: 5,
32
+ },
33
+ smallCircle: {
34
+ backgroundColor: Colors.White,
35
+ width: 130,
36
+ height: 130,
37
+ borderRadius: 200,
38
+ justifyContent: 'center',
39
+ alignItems: 'center',
40
+
41
+ shadowColor: Colors.Black,
42
+ shadowOffset: {
43
+ width: 0,
44
+ height: 4,
45
+ },
46
+ shadowOpacity: 0.15,
47
+ shadowRadius: 12,
48
+ elevation: 2,
49
+ },
50
+ textBig: {
51
+ marginTop: 18,
52
+ fontSize: 16,
53
+ color: Colors.Gray8,
54
+ },
55
+ });