@eohjsc/react-native-smart-city 0.3.35 → 0.3.36

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 (27) hide show
  1. package/assets/images/AddNewDevice/on-icon.svg +5 -0
  2. package/assets/images/AddNewDevice/router-connect-icon.svg +3 -0
  3. package/package.json +1 -1
  4. package/src/commons/Device/HorizontalBarChart.js +2 -6
  5. package/src/configs/Constants.js +2 -0
  6. package/src/navigations/AddGatewayStack.js +10 -0
  7. package/src/screens/AddNewGateway/ConnectingModbusDevice.js +0 -1
  8. package/src/screens/AddNewGateway/PlugAndPlay/ConnectRouterGuide.js +49 -0
  9. package/src/screens/AddNewGateway/PlugAndPlay/ConnectRouterGuideStyles.js +31 -0
  10. package/src/screens/AddNewGateway/PlugAndPlay/ZigbeeDeviceConnectGuide.js +51 -0
  11. package/src/screens/AddNewGateway/ScanGatewayQR.js +11 -23
  12. package/src/screens/AddNewGateway/ScanModbusQR.js +75 -11
  13. package/src/screens/AddNewGateway/ScanWifiDeviceQR.js +19 -9
  14. package/src/screens/AddNewGateway/SelectDeviceSubUnit.js +26 -7
  15. package/src/screens/AddNewGateway/SelectDeviceType.js +8 -1
  16. package/src/screens/AddNewGateway/SelectZigbeeGateway.js +1 -1
  17. package/src/screens/AddNewGateway/ShareWifiPassword.js +1 -2
  18. package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +4 -6
  19. package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +5 -7
  20. package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +2 -1
  21. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +1 -1
  22. package/src/screens/ScanChipQR/components/InvalidQRCode/index.js +33 -0
  23. package/src/screens/ScanChipQR/components/QRScan/index.js +7 -5
  24. package/src/screens/SmartAccount/ListDevice/index.js +0 -1
  25. package/src/utils/I18n/translations/en.json +8 -0
  26. package/src/utils/I18n/translations/vi.json +8 -0
  27. package/src/utils/Route/index.js +3 -0
@@ -0,0 +1,5 @@
1
+ <svg width="70" height="70" viewBox="0 0 70 70" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M35 67C52.6731 67 67 52.6731 67 35C67 17.3269 52.6731 3 35 3C17.3269 3 3 17.3269 3 35C3 52.6731 17.3269 67 35 67ZM35 70C54.33 70 70 54.33 70 35C70 15.67 54.33 0 35 0C15.67 0 0 15.67 0 35C0 54.33 15.67 70 35 70Z" fill="#00979D"/>
3
+ <path d="M34.0401 34.9093C34.0401 36.8684 33.6732 38.5463 32.9393 39.9431C32.2113 41.3339 31.217 42.3993 29.9563 43.1391C28.7016 43.8789 27.2782 44.2488 25.6861 44.2488C24.094 44.2488 22.6676 43.8789 21.407 43.1391C20.1522 42.3933 19.1579 41.325 18.424 39.9342C17.696 38.5374 17.332 36.8624 17.332 34.9093C17.332 32.9503 17.696 31.2753 18.424 29.8845C19.1579 28.4877 20.1522 27.4194 21.407 26.6796C22.6676 25.9397 24.094 25.5698 25.6861 25.5698C27.2782 25.5698 28.7016 25.9397 29.9563 26.6796C31.217 27.4194 32.2113 28.4877 32.9393 29.8845C33.6732 31.2753 34.0401 32.9503 34.0401 34.9093ZM30.7287 34.9093C30.7287 33.5303 30.5127 32.3673 30.0806 31.4203C29.6545 30.4674 29.0626 29.7483 28.305 29.263C27.5475 28.7718 26.6745 28.5261 25.6861 28.5261C24.6977 28.5261 23.8247 28.7718 23.0671 29.263C22.3095 29.7483 21.7147 30.4674 21.2827 31.4203C20.8565 32.3673 20.6435 33.5303 20.6435 34.9093C20.6435 36.2883 20.8565 37.4543 21.2827 38.4072C21.7147 39.3542 22.3095 40.0733 23.0671 40.5645C23.8247 41.0498 24.6977 41.2925 25.6861 41.2925C26.6745 41.2925 27.5475 41.0498 28.305 40.5645C29.0626 40.0733 29.6545 39.3542 30.0806 38.4072C30.5127 37.4543 30.7287 36.2883 30.7287 34.9093Z" fill="#00979D"/>
4
+ <path d="M52.0954 25.8184V44.0002H49.1657L40.5986 31.6156H40.4477V44.0002H37.154V25.8184H40.1015L48.6597 38.2119H48.8195V25.8184H52.0954Z" fill="#00979D"/>
5
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="133" height="59" viewBox="0 0 133 59" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M127.202 34.4313C128.51 34.4315 129.8 34.3786 131.002 33.7424C131.461 33.2829 131.885 32.8588 132.345 32.3639C133.228 30.7026 133.21 29.0234 132.344 27.3441L131.018 26.0183C129.799 25.3995 128.508 25.3463 127.2 25.3461C122.033 25.3543 116.866 25.3536 111.699 25.353L111.691 25.353C106.521 25.3523 101.35 25.3516 96.1801 25.3598C95.9524 25.3598 95.7173 25.4111 95.4419 25.4712C95.2898 25.5044 95.1252 25.5403 94.9428 25.5717C94.9528 25.0269 94.9657 24.5051 94.9782 23.9998L94.9783 23.9992C95.0095 22.7342 95.0383 21.5724 95.0129 20.4105C94.9064 17.1936 92.4138 14.6303 89.1969 14.5946C85.7827 14.5447 82.3772 14.5553 78.9682 14.566H78.968L78.9673 14.566L78.9667 14.566L78.966 14.566L78.9654 14.566L78.9647 14.566L78.964 14.566L78.9634 14.566L78.9627 14.5661C77.5026 14.5706 76.0418 14.5752 74.5794 14.575C73.4481 14.5749 72.9356 15.1227 72.9181 16.2716C72.9065 16.8662 72.9257 17.4608 72.9452 18.0656C72.9553 18.3777 72.9654 18.6924 72.9715 19.0113C70.9035 18.9934 68.9945 18.9931 67.0856 18.9929C65.4064 19.0103 64.0455 19.6995 63.1619 21.1488C61.3241 24.1887 63.3749 27.9361 66.963 28.025C68.271 28.0605 69.579 28.0332 70.887 28.0058C71.541 27.9922 72.1949 27.9785 72.8489 27.9727C72.849 28.6342 72.8446 29.264 72.8402 29.8851L72.8402 29.8884L72.8402 29.8884L72.8402 29.8895C72.8359 30.495 72.8317 31.0921 72.8317 31.7022C72.6949 31.7022 72.5539 31.7063 72.4088 31.7106L72.4079 31.7106L72.4075 31.7106L72.4072 31.7106H72.4072H72.4071C72.2529 31.7151 72.0939 31.7198 71.9303 31.7198C71.5144 31.7197 71.0995 31.7185 70.6853 31.7174H70.6852H70.6852H70.6851H70.6851H70.685H70.685H70.6849H70.6849C69.4444 31.7139 68.2089 31.7105 66.9635 31.7368C64.3476 31.8072 62.4036 33.8572 62.4923 36.3848C62.5633 38.8594 64.4901 40.7156 67.0707 40.7512C68.2884 40.7735 69.4992 40.7612 70.703 40.7489C71.4213 40.7415 72.1372 40.7342 72.8506 40.7343C72.8614 40.8313 72.8722 40.8757 72.8789 40.9036C72.8833 40.9215 72.886 40.9326 72.886 40.9464C72.9037 41.7418 72.9038 42.5195 72.9039 43.2973C72.9218 44.6583 73.4168 45.1886 74.7601 45.1888C76.3024 45.189 77.8428 45.1911 79.382 45.1932L79.3842 45.1932H79.3865H79.3887L79.4166 45.1932L79.438 45.1933L79.4593 45.1933H79.4613C82.5876 45.1976 85.7087 45.202 88.8297 45.1906C92.4708 45.1911 94.9981 42.6285 95.033 38.9873C95.0441 38.032 95.0266 37.0767 95.0078 36.0486L95.0078 36.0474C94.997 35.4591 94.9858 34.8469 94.9793 34.1973C95.1655 34.226 95.3372 34.2634 95.5003 34.2989C95.7397 34.351 95.9605 34.399 96.1813 34.4096C101.351 34.4191 106.521 34.4198 111.691 34.4204C116.861 34.4211 122.031 34.4218 127.202 34.4313ZM76.6686 42.1488C76.4565 42.1488 76.2444 42.1488 76.0147 42.1311C76.0136 33.9297 76.0125 25.8344 76.0291 17.6507C76.1487 17.6507 76.2847 17.6425 76.4252 17.634L76.4255 17.634C76.5759 17.6249 76.7314 17.6154 76.8776 17.6155C78.1681 17.6156 79.4607 17.6139 80.7545 17.6121L80.7634 17.6121L80.767 17.612L80.7679 17.612L80.769 17.612L80.7741 17.612C83.3721 17.6085 85.9754 17.6049 88.5787 17.617C90.7351 17.6173 91.9725 18.8547 91.9728 21.0464L91.9751 38.7572C91.9754 40.9489 90.8089 42.1507 88.6526 42.1504L76.6687 42.1488H76.6686ZM95.3067 31.3678C95.2362 31.3595 95.1694 31.3516 95.1027 31.3516C95.1202 30.3796 95.1201 29.4253 95.1199 28.365L95.1199 28.3645L95.1258 28.3645C98.3584 28.3826 101.591 28.4007 104.841 28.4011L127.784 28.4041C128.049 28.3864 128.332 28.3865 128.615 28.4219C129.481 28.5457 130.011 29.1467 129.958 29.9421C129.905 30.7728 129.446 31.2323 128.615 31.356C128.438 31.3913 128.226 31.3913 128.05 31.3912L95.5622 31.387C95.4689 31.387 95.3855 31.3771 95.3067 31.3678ZM72.8835 21.9984H72.8835C72.863 22.6147 72.8366 23.1891 72.8111 23.7426L72.8111 23.7436C72.7927 24.1423 72.7749 24.5301 72.7602 24.9149C72.4677 24.9202 72.1732 24.926 71.877 24.9318C70.2397 24.9641 68.5506 24.9973 66.8743 24.9671C66.0435 24.9493 65.4778 24.2422 65.5131 23.4645C65.5306 22.6338 66.1138 22.0506 67.0506 22.033C68.9594 21.9979 70.8682 21.9982 72.8831 21.9984H72.8831H72.8832H72.8832H72.8833H72.8833H72.8834H72.8834H72.8835ZM70.5785 34.8483C71.3364 34.8626 72.0982 34.877 72.8675 34.8838C72.8617 35.1842 72.8578 35.4867 72.8539 35.7891C72.8461 36.394 72.8383 36.9989 72.8148 37.5881L72.4526 37.5978L71.9783 37.6109C70.2556 37.6585 68.5216 37.7063 66.7875 37.6757C65.9921 37.6579 65.5148 37.0392 65.5324 36.2085C65.5323 35.3954 66.0271 34.8299 66.8579 34.8123C68.0992 34.8015 69.3338 34.8248 70.5785 34.8483ZM34.2029 34.3223C34.3625 34.2948 34.5334 34.2653 34.724 34.2425C34.7241 34.863 34.722 35.4522 34.7201 36.0222L34.7201 36.0232C34.7164 37.1088 34.7129 38.1249 34.7246 39.1562C34.7958 42.6206 37.3237 45.1839 40.7881 45.2197C45.5251 45.2557 50.2797 45.2386 55.0344 45.2215C56.307 45.2217 56.8372 44.6915 56.8371 43.3835C56.8367 40.392 56.8382 37.4024 56.8398 34.4141V34.4049V34.4049V34.4048V34.4048V34.4047V34.4046V34.4046V34.4045V34.4044C56.843 28.4267 56.8461 22.4542 56.8336 16.4816C56.8334 15.1383 56.3207 14.6256 54.942 14.6255C50.2934 14.6072 45.6271 14.6066 40.9785 14.6237C37.2667 14.6232 34.7218 17.1681 34.7046 20.8622C34.7048 22.347 34.7226 23.8494 34.7582 25.5816C34.5829 25.5565 34.4253 25.527 34.2776 25.4993C34.0084 25.4489 33.772 25.4047 33.5209 25.4047C24.4213 25.3858 15.3393 25.3846 6.2573 25.3834L6.24781 25.3834L6.2477 25.3834C5.75282 25.3834 5.25795 25.3833 4.76309 25.4539C1.75833 25.9131 0.044255 29.2535 1.47631 31.958C2.39566 33.6904 3.93351 34.4152 5.8778 34.4155C10.4999 34.4073 15.122 34.4079 19.7441 34.4085L19.7452 34.4085H19.7515L19.7558 34.4085L19.7579 34.4085C24.3754 34.4091 28.9929 34.4097 33.6105 34.4014C33.8014 34.3914 33.9924 34.3585 34.2029 34.3223ZM53.3192 17.6115L53.3192 17.6115C53.4388 17.6162 53.5493 17.6206 53.6345 17.6301V17.6383C53.6355 25.8016 53.6366 33.9295 53.62 42.0751C53.5614 42.0751 53.4846 42.0812 53.3947 42.0883C53.2675 42.0983 53.114 42.1104 52.9483 42.1104C49.0421 42.1276 45.1358 42.1447 41.2295 42.1266C38.9671 42.1263 37.7473 40.9065 37.747 38.6794L37.7447 20.9687C37.7445 18.7769 38.9286 17.5928 41.0849 17.5931C43.7375 17.5817 46.3901 17.586 49.0375 17.5902L49.0445 17.5902C50.3639 17.5924 51.682 17.5945 52.9981 17.5947C53.1049 17.6029 53.2154 17.6073 53.3191 17.6114L53.3192 17.6115ZM5.62956 28.4058L34.6879 28.4096C34.6703 29.4167 34.6704 30.3355 34.6706 31.3249L34.6706 31.325L34.6706 31.3261C34.5824 31.3319 34.4962 31.3397 34.41 31.3476L34.4094 31.3476C34.2365 31.3633 34.0637 31.379 33.8752 31.379L6.23092 31.3754C6.03649 31.393 5.85973 31.393 5.6653 31.3753C4.60478 31.3398 3.98606 30.7564 4.00362 29.855C4.02118 28.9536 4.6044 28.4057 5.62956 28.4058ZM57.9637 8.13901C58.1405 8.31578 58.3192 8.49059 58.4979 8.66541C58.8554 9.01503 59.2129 9.36466 59.5547 9.73C60.1734 10.3841 60.1735 11.1971 59.5903 11.8157C58.9894 12.4519 58.1057 12.4872 57.4339 11.8508C56.3556 10.8078 55.3126 9.76479 54.2696 8.68646C53.6332 8.01471 53.6508 7.14862 54.287 6.54774C54.8879 5.98221 55.7186 5.96464 56.3727 6.58337C56.7964 6.95408 57.1804 7.34463 57.5693 7.74015L57.5695 7.7404L57.5698 7.74066L57.5701 7.74092L57.5703 7.74117L57.5706 7.74142L57.5708 7.74169L57.5711 7.74195C57.7008 7.87393 57.8312 8.00647 57.9637 8.13901ZM73.3279 10.8139C73.5026 10.6352 73.6774 10.4565 73.8541 10.2798C74.0322 10.1017 74.2122 9.92567 74.3909 9.75092C74.7443 9.40535 75.0924 9.06496 75.4094 8.72456C76.0633 8.03531 76.0455 7.16921 75.4091 6.56816C74.8257 5.9848 73.9773 5.98469 73.3411 6.58557C72.263 7.62828 71.2203 8.67099 70.1776 9.74905C69.5237 10.4383 69.5415 11.3044 70.1779 11.9054C70.7789 12.4711 71.6273 12.4712 72.2635 11.8704C72.6288 11.5287 72.9783 11.1713 73.3279 10.8139ZM71.7031 51.5692C71.5316 51.3976 71.36 51.23 71.1891 51.0631L71.1889 51.0629C70.8492 50.731 70.5121 50.4017 70.1828 50.0489C69.5464 49.3771 69.564 48.5111 70.1825 47.8925C70.7834 47.327 71.6142 47.3094 72.2682 47.9281C73.3466 48.9711 74.3896 50.0141 75.4325 51.0924C76.0689 51.7642 76.0514 52.6303 75.4328 53.2488C74.8319 53.8143 74.0189 53.8142 73.3471 53.2132L73.2764 53.1425L71.7031 51.5692ZM56.4247 48.9499L56.4246 48.95L56.4245 48.9501L56.4244 48.9502C56.2576 49.1209 56.0901 49.2923 55.9187 49.4637C55.7368 49.6457 55.5509 49.8277 55.3643 50.0103C54.9893 50.3775 54.6115 50.7473 54.2575 51.125C53.6743 51.7789 53.6744 52.6273 54.2577 53.2107C54.8411 53.7941 55.7072 53.8472 56.3434 53.2463C57.4392 52.186 58.5172 51.1079 59.5776 50.0122C60.1785 49.3759 60.1607 48.5098 59.5773 47.9265C58.9763 47.2901 58.1279 47.29 57.4386 47.9439C57.0859 48.2731 56.7567 48.6101 56.4249 48.9497L56.4247 48.9499ZM66.0227 1.06991C66.0732 1.26605 66.1254 1.4391 66.1732 1.5975C66.2762 1.93871 66.3587 2.21194 66.3588 2.50166C66.3943 3.80964 66.3944 5.11762 66.3593 6.42559C66.3417 7.43308 65.7232 8.08699 64.8394 8.08687C63.9556 8.08676 63.3723 7.43269 63.3368 6.40752C63.3016 5.07556 63.3185 3.76098 63.3358 2.41209V2.41206V2.41203V2.41199L63.3363 2.37754C63.3538 1.6882 63.6366 1.08727 64.3082 0.945956C64.6995 0.867739 65.1198 0.933931 65.5547 1.00243L65.5547 1.00244L65.5547 1.00244L65.5547 1.00245C65.7091 1.02676 65.8653 1.05137 66.0227 1.06991ZM65.4472 58.815C65.6085 58.7848 65.765 58.7555 65.9065 58.7446C65.982 58.5593 66.0654 58.4034 66.1393 58.2653L66.1393 58.2653C66.2557 58.0478 66.3483 57.8748 66.3483 57.7018C66.3518 57.5432 66.3555 57.3848 66.3591 57.2265L66.3593 57.2214L66.3594 57.2163C66.3925 55.7905 66.4254 54.3759 66.33 52.9471C66.2945 52.1341 65.6405 51.6921 64.8274 51.7273C64.0143 51.7626 63.4488 52.2574 63.4136 53.0705C63.3431 54.5906 63.3256 56.1283 63.4318 57.6484C63.4496 58.0903 63.9799 58.656 64.4041 58.8328C64.6977 58.9552 65.0845 58.8828 65.4472 58.815ZM86.0882 30.9616C85.4871 30.3605 85.487 29.4768 86.0525 28.8759C86.6358 28.2573 87.5372 28.2397 88.1382 28.8054C88.7746 29.4065 88.7924 30.3433 88.1739 30.9618C87.5907 31.545 86.6892 31.5273 86.0882 30.9616ZM42.6421 30.9559C43.2255 31.5393 44.1269 31.5217 44.7278 30.9208C45.311 30.3376 45.3109 29.4538 44.7275 28.8351C44.1265 28.2341 43.2604 28.2163 42.6418 28.7995C42.0056 29.4004 42.0057 30.3549 42.6421 30.9559Z" fill="#00979D"/>
3
+ </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.3.35",
4
+ "version": "0.3.36",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -33,7 +33,7 @@ const HorizontalBarChart = memo(({ datas, config }) => {
33
33
  },
34
34
  yAxis: {
35
35
  min: 0,
36
- minRange: 0.5,
36
+ minRange: 0,
37
37
  title: {
38
38
  text: null,
39
39
  },
@@ -87,6 +87,7 @@ const HorizontalBarChart = memo(({ datas, config }) => {
87
87
  );
88
88
  },
89
89
  align: 'right',
90
+ inside: false,
90
91
  },
91
92
  labels: {
92
93
  style: {
@@ -129,9 +130,6 @@ const HorizontalBarChart = memo(({ datas, config }) => {
129
130
  ...options,
130
131
  chart: {
131
132
  ...options.chart,
132
- scrollablePlotArea: {
133
- minHeight: dataY.length * 32,
134
- },
135
133
  },
136
134
  xAxis: {
137
135
  ...options.xAxis,
@@ -139,8 +137,6 @@ const HorizontalBarChart = memo(({ datas, config }) => {
139
137
  },
140
138
  series: [
141
139
  {
142
- marker: { enabled: true },
143
- color: Colors.Primary + '50',
144
140
  name: JSON.stringify(config),
145
141
  data: dataY,
146
142
  },
@@ -81,6 +81,8 @@ export const DEVICE_TYPE = {
81
81
  HANET: 'HANET',
82
82
  ZIGBEE: 'ZIGBEE',
83
83
  GOOGLE_HOME: 'GOOGLE_HOME',
84
+ WIFI_DEVICE: 'WIFI_DEVICE',
85
+ MODBUS: 'MODBUS',
84
86
  };
85
87
 
86
88
  const marginItem = 12;
@@ -19,6 +19,8 @@ import ShareWifiPassword from '../screens/AddNewGateway/ShareWifiPassword';
19
19
  import ScanGatewayQR from '../screens/AddNewGateway/ScanGatewayQR';
20
20
  import RenameNewDevices from '../screens/AddNewGateway/RenameNewDevices';
21
21
  import ConnectingWifiGuide from '../screens/AddNewGateway/ConnectingWifiGuide';
22
+ import ConnectRouterGuide from '../screens/AddNewGateway/PlugAndPlay/ConnectRouterGuide';
23
+ import ZigbeeDeviceConnectGuide from '../screens/AddNewGateway/PlugAndPlay/ZigbeeDeviceConnectGuide';
22
24
 
23
25
  const Stack = createStackNavigator();
24
26
 
@@ -82,6 +84,14 @@ export const AddGatewayStack = memo(() => {
82
84
  name={Route.ConnectingWifiGuide}
83
85
  component={ConnectingWifiGuide}
84
86
  />
87
+ <Stack.Screen
88
+ name={Route.ConnectRouterGuide}
89
+ component={ConnectRouterGuide}
90
+ />
91
+ <Stack.Screen
92
+ name={Route.ZigbeeDeviceConnectGuide}
93
+ component={ZigbeeDeviceConnectGuide}
94
+ />
85
95
  </Stack.Navigator>
86
96
  );
87
97
  });
@@ -35,7 +35,6 @@ const ConnectingModbusDevice = ({ route }) => {
35
35
  channel_name: channelName,
36
36
  }
37
37
  );
38
-
39
38
  if (!success) {
40
39
  addingModbusDeviceFail(JSON.stringify(problem || data));
41
40
  return;
@@ -0,0 +1,49 @@
1
+ import React, { useCallback } from 'react';
2
+ import { View } from 'react-native';
3
+ import { useNavigation } from '@react-navigation/native';
4
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
5
+ import { HeaderCustom } from '../../../commons/Header';
6
+ import { ViewButtonBottom } from '../../../commons';
7
+ import RouterConnectIcon from '../../../../assets/images/AddNewDevice/router-connect-icon.svg';
8
+ import Routes from '../../../utils/Route';
9
+ import { Colors } from '../../../configs';
10
+ import Text from '../../../commons/Text';
11
+ import styles from './ConnectRouterGuideStyles';
12
+
13
+ const ConnectRouterGuide = ({ route }) => {
14
+ const t = useTranslations();
15
+ const { navigate, goBack } = useNavigation();
16
+
17
+ const onRight = useCallback(() => {
18
+ navigate(Routes.SelectZigbeeGateway, {
19
+ ...route?.params,
20
+ });
21
+ }, [navigate, route]);
22
+
23
+ return (
24
+ <View style={styles.container}>
25
+ <HeaderCustom isShowSeparator />
26
+ <View style={styles.contentContainer}>
27
+ <View style={styles.guideContent}>
28
+ <RouterConnectIcon width={94} height={94} />
29
+ <Text type="H4" semibold style={styles.txtContent}>
30
+ {t('connect_to_router')}
31
+ </Text>
32
+ <Text style={styles.txtContent}>{t('connect_router_content')}</Text>
33
+ <Text semibold color={Colors.Gray7} style={styles.txtContent}>
34
+ {t('read_device_manual_guide')}
35
+ </Text>
36
+ </View>
37
+ <ViewButtonBottom
38
+ leftTitle={t('cancel')}
39
+ onLeftClick={goBack}
40
+ rightTitle={t('text_next')}
41
+ onRightClick={onRight}
42
+ styleButtonLeftText={styles.buttonLeftText}
43
+ />
44
+ </View>
45
+ </View>
46
+ );
47
+ };
48
+
49
+ export default ConnectRouterGuide;
@@ -0,0 +1,31 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { Colors } from '../../../configs';
3
+
4
+ const styles = StyleSheet.create({
5
+ container: {
6
+ flex: 1,
7
+ backgroundColor: Colors.White,
8
+ },
9
+ contentContainer: {
10
+ flex: 1,
11
+ justifyContent: 'space-between',
12
+ alignItems: 'center',
13
+ paddingVertical: 16,
14
+ },
15
+ guideContent: {
16
+ flex: 1,
17
+ justifyContent: 'center',
18
+ alignItems: 'center',
19
+ marginBottom: 80,
20
+ },
21
+ txtContent: {
22
+ marginVertical: 7,
23
+ paddingHorizontal: 40,
24
+ textAlign: 'center',
25
+ },
26
+ buttonLeftText: {
27
+ color: Colors.Gray6,
28
+ },
29
+ });
30
+
31
+ export default styles;
@@ -0,0 +1,51 @@
1
+ import React, { useCallback } from 'react';
2
+ import { View } from 'react-native';
3
+ import { useNavigation } from '@react-navigation/native';
4
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
5
+ import Text from '../../../commons/Text';
6
+ import { HeaderCustom } from '../../../commons/Header';
7
+ import { ViewButtonBottom } from '../../../commons';
8
+ import TurnOnIcon from '../../../../assets/images/AddNewDevice/on-icon.svg';
9
+ import Routes from '../../../utils/Route';
10
+ import { Colors } from '../../../configs';
11
+ import styles from './ConnectRouterGuideStyles';
12
+
13
+ const ZigbeeDeviceConnectGuide = ({ route }) => {
14
+ const t = useTranslations();
15
+ const { navigate, goBack } = useNavigation();
16
+
17
+ const onRight = useCallback(() => {
18
+ navigate(Routes.ConnectingZigbeeDevice, {
19
+ ...route?.params,
20
+ });
21
+ }, [navigate, route]);
22
+
23
+ return (
24
+ <View style={styles.container}>
25
+ <HeaderCustom title={t('turn_on_zigbee_device')} isShowSeparator />
26
+ <View style={styles.contentContainer}>
27
+ <View style={styles.guideContent}>
28
+ <TurnOnIcon />
29
+ <Text type="H4" semibold style={styles.txtContent}>
30
+ {t('turn_on_device_to_connect')}
31
+ </Text>
32
+ <Text style={styles.txtContent}>
33
+ {t('turn_on_zigbee_device_content')}
34
+ </Text>
35
+ <Text semibold color={Colors.Gray7} style={styles.txtContent}>
36
+ {t('read_device_manual_guide')}
37
+ </Text>
38
+ </View>
39
+ <ViewButtonBottom
40
+ leftTitle={t('cancel')}
41
+ onLeftClick={goBack}
42
+ rightTitle={t('text_next')}
43
+ onRightClick={onRight}
44
+ styleButtonLeftText={styles.buttonLeftText}
45
+ />
46
+ </View>
47
+ </View>
48
+ );
49
+ };
50
+
51
+ export default ZigbeeDeviceConnectGuide;
@@ -1,16 +1,13 @@
1
1
  import React, { memo, useCallback, useState } from 'react';
2
2
  import { View, StyleSheet } from 'react-native';
3
- import QRScan from '../ScanChipQR/components/QRScan';
4
- import Routes from '../../utils/Route';
5
- import { useTranslations } from '../../hooks/Common/useTranslations';
6
3
  import { useNavigation } from '@react-navigation/native';
7
- import BottomSheet from '../../commons/BottomSheet';
8
- import Text from '../../commons/Text';
9
- import { ViewButtonBottom } from '../../commons';
4
+
5
+ import Routes from '../../utils/Route';
6
+ import QRScan from '../ScanChipQR/components/QRScan';
7
+ import InvalidQRCode from '../ScanChipQR/components/InvalidQRCode';
10
8
 
11
9
  const ScanGatewayQR = memo(({ route }) => {
12
10
  // same as Scan Wifi Device, not sure if we should separated it
13
- const t = useTranslations();
14
11
  const { unitId, stationId } = route?.params || {};
15
12
  const [isInvalidQrCode, setIsInvalidQrCode] = useState(false);
16
13
  const { navigate, goBack } = useNavigation();
@@ -35,13 +32,13 @@ const ScanGatewayQR = memo(({ route }) => {
35
32
  }
36
33
  navigate(Routes.ConnectingWifiGuide, {
37
34
  unitId,
38
- stationId,
35
+ stationId: stationId,
39
36
  prefix: devicePrefixName,
40
37
  qrData: data,
41
38
  });
42
39
  setLoading(true);
43
40
  },
44
- [navigate, unitId, stationId]
41
+ [navigate, stationId, unitId]
45
42
  );
46
43
 
47
44
  const onRetry = useCallback(() => {
@@ -53,17 +50,11 @@ const ScanGatewayQR = memo(({ route }) => {
53
50
  return (
54
51
  <View style={styles.container}>
55
52
  <QRScan onScan={onScan} />
56
- <BottomSheet isVisible={isInvalidQrCode} title={t('invalid_qr_code')}>
57
- <Text style={styles.warningContainer}>
58
- {t('invalid_qr_code_warning')}
59
- </Text>
60
- <ViewButtonBottom
61
- leftTitle={t('cancel')}
62
- onLeftClick={goBack}
63
- rightTitle={t('retry')}
64
- onRightClick={onRetry}
65
- />
66
- </BottomSheet>
53
+ <InvalidQRCode
54
+ isInvalidQrCode={isInvalidQrCode}
55
+ goBack={goBack}
56
+ onRetry={onRetry}
57
+ />
67
58
  </View>
68
59
  );
69
60
  });
@@ -72,9 +63,6 @@ const styles = StyleSheet.create({
72
63
  container: {
73
64
  flex: 1,
74
65
  },
75
- warningContainer: {
76
- paddingHorizontal: 16,
77
- },
78
66
  });
79
67
 
80
68
  export default ScanGatewayQR;
@@ -1,15 +1,23 @@
1
- import React, { memo, useCallback } from 'react';
1
+ import React, { memo, useCallback, useEffect, useState } from 'react';
2
2
  import { View, StyleSheet } from 'react-native';
3
- import QRScan from '../ScanChipQR/components/QRScan';
3
+ import { useNavigation } from '@react-navigation/native';
4
+
4
5
  import Routes from '../../utils/Route';
5
- import { ToastBottomHelper } from '../../utils/Utils';
6
6
  import { useTranslations } from '../../hooks/Common/useTranslations';
7
- import { useNavigation } from '@react-navigation/native';
7
+ import { ModalCustom } from '../../commons/Modal';
8
+ import { ViewButtonBottom } from '../../commons';
9
+ import useBoolean from '../../hooks/Common/useBoolean';
10
+ import Text from '../../commons/Text';
11
+ import QRScan from '../ScanChipQR/components/QRScan';
12
+ import InvalidQRCode from '../ScanChipQR/components/InvalidQRCode';
13
+ import { Colors } from '../../configs';
8
14
 
9
15
  const ScanModbusQR = memo(({ route }) => {
10
16
  const t = useTranslations();
11
17
  const { unitId, stationId, chipId } = route?.params || {};
12
- const navigation = useNavigation();
18
+ const { navigate, goBack } = useNavigation();
19
+ const [showPopupGuide, setShowPopupGuide, setHidePopupGuide] = useBoolean();
20
+ const [isInvalidQrCode, setIsInvalidQrCode] = useState(false);
13
21
 
14
22
  const onScan = useCallback(
15
23
  (body, setLoading) => {
@@ -17,29 +25,66 @@ const ScanModbusQR = memo(({ route }) => {
17
25
  try {
18
26
  data = JSON.parse(body);
19
27
  } catch (e) {
20
- ToastBottomHelper.error(t('wrong_qr_format'));
28
+ setIsInvalidQrCode(true);
21
29
  setLoading(false);
22
30
  return;
23
31
  }
24
32
  const devicePrefixName = data?.imei?.split('-')[0]; // todo Bang change QR format
25
33
  if (devicePrefixName !== 'SENSOR') {
26
- ToastBottomHelper.error(t('wrong_qr_format'));
34
+ setIsInvalidQrCode(true);
27
35
  setLoading(false);
28
36
  return;
29
37
  }
30
- navigation.navigate(Routes.ConnectingModbusDevice, {
38
+ navigate(Routes.ConnectingModbusDevice, {
31
39
  unitId,
32
- stationId,
40
+ stationId: stationId,
33
41
  chipId,
34
42
  qrData: data,
35
43
  });
36
44
  },
37
- [navigation, unitId, stationId, chipId, t]
45
+ [navigate, unitId, stationId, chipId]
38
46
  );
39
47
 
48
+ const onRetry = useCallback(() => {
49
+ if (isInvalidQrCode) {
50
+ setIsInvalidQrCode(false);
51
+ }
52
+ }, [isInvalidQrCode]);
53
+
54
+ useEffect(() => {
55
+ setShowPopupGuide();
56
+ }, [setShowPopupGuide]);
57
+
40
58
  return (
41
59
  <View style={styles.container}>
42
- <QRScan onScan={onScan} />
60
+ <QRScan isScanReady={!showPopupGuide} onScan={onScan} />
61
+ <ModalCustom
62
+ onBackButtonPress={goBack}
63
+ isVisible={showPopupGuide}
64
+ style={styles.modal}
65
+ >
66
+ <View style={styles.modalWrapper}>
67
+ <View style={styles.modalContent}>
68
+ <Text type="H4" semibold style={styles.txtCenter}>
69
+ {t('turn_off_device')}
70
+ </Text>
71
+ <Text style={styles.txtCenter}>
72
+ {t('turn_off_device_when_scan_qr_guide')}
73
+ </Text>
74
+ </View>
75
+ <ViewButtonBottom
76
+ leftTitle={t('cancel')}
77
+ onLeftClick={goBack}
78
+ rightTitle={t('ok')}
79
+ onRightClick={setHidePopupGuide}
80
+ />
81
+ </View>
82
+ </ModalCustom>
83
+ <InvalidQRCode
84
+ isInvalidQrCode={isInvalidQrCode}
85
+ goBack={goBack}
86
+ onRetry={onRetry}
87
+ />
43
88
  </View>
44
89
  );
45
90
  });
@@ -48,6 +93,25 @@ const styles = StyleSheet.create({
48
93
  container: {
49
94
  flex: 1,
50
95
  },
96
+ modal: {
97
+ flex: 1,
98
+ justifyContent: 'center',
99
+ alignItems: 'center',
100
+ },
101
+ modalWrapper: {
102
+ backgroundColor: Colors.White,
103
+ borderRadius: 10,
104
+ justifyContent: 'center',
105
+ alignItems: 'center',
106
+ width: 280,
107
+ },
108
+ modalContent: {
109
+ paddingHorizontal: 16,
110
+ paddingTop: 16,
111
+ },
112
+ txtCenter: {
113
+ textAlign: 'center',
114
+ },
51
115
  });
52
116
 
53
117
  export default ScanModbusQR;
@@ -1,15 +1,14 @@
1
- import React, { memo, useCallback } from 'react';
1
+ import React, { memo, useCallback, useState } from 'react';
2
2
  import { View, StyleSheet } from 'react-native';
3
3
  import QRScan from '../ScanChipQR/components/QRScan';
4
4
  import Routes from '../../utils/Route';
5
- import { ToastBottomHelper } from '../../utils/Utils';
6
- import { useTranslations } from '../../hooks/Common/useTranslations';
7
5
  import { useNavigation } from '@react-navigation/native';
6
+ import InvalidQRCode from '../ScanChipQR/components/InvalidQRCode';
8
7
 
9
8
  const ScanWifiDeviceQR = memo(({ route }) => {
10
- const t = useTranslations();
11
9
  const { unitId, stationId } = route?.params || {};
12
- const navigation = useNavigation();
10
+ const [isInvalidQrCode, setIsInvalidQrCode] = useState(false);
11
+ const { navigate, goBack } = useNavigation();
13
12
 
14
13
  const onScan = useCallback(
15
14
  (body, setLoading) => {
@@ -17,18 +16,18 @@ const ScanWifiDeviceQR = memo(({ route }) => {
17
16
  try {
18
17
  data = JSON.parse(body);
19
18
  } catch (e) {
20
- ToastBottomHelper.error(t('wrong_qr_format'));
19
+ setIsInvalidQrCode(true);
21
20
  setLoading(false);
22
21
  return;
23
22
  }
24
23
  const devicePrefixName = data?.imei?.split('-')[0];
25
24
  // todo Bang change QR format
26
25
  if (['ROBOT'].indexOf(devicePrefixName) === -1) {
27
- ToastBottomHelper.error(t('wrong_qr_format'));
26
+ setIsInvalidQrCode(true);
28
27
  setLoading(false);
29
28
  return;
30
29
  }
31
- navigation.navigate(Routes.ShareWifiPassword, {
30
+ navigate(Routes.ConnectingWifiGuide, {
32
31
  unitId,
33
32
  stationId,
34
33
  prefix: devicePrefixName,
@@ -36,12 +35,23 @@ const ScanWifiDeviceQR = memo(({ route }) => {
36
35
  });
37
36
  setLoading(true);
38
37
  },
39
- [navigation, unitId, stationId, t]
38
+ [navigate, unitId, stationId]
40
39
  );
41
40
 
41
+ const onRetry = useCallback(() => {
42
+ if (isInvalidQrCode) {
43
+ setIsInvalidQrCode(false);
44
+ }
45
+ }, [isInvalidQrCode]);
46
+
42
47
  return (
43
48
  <View style={styles.container}>
44
49
  <QRScan onScan={onScan} />
50
+ <InvalidQRCode
51
+ isInvalidQrCode={isInvalidQrCode}
52
+ goBack={goBack}
53
+ onRetry={onRetry}
54
+ />
45
55
  </View>
46
56
  );
47
57
  });
@@ -4,20 +4,39 @@ import { useCallback } from 'react';
4
4
  import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
  import { useNavigation } from '@react-navigation/native';
6
6
  import Routes from '../../utils/Route';
7
+ import { DEVICE_TYPE } from '../../configs/Constants';
7
8
 
8
9
  const SelectDeviceSubUnit = ({ route }) => {
9
- const { unitId, unitName } = route?.params || {};
10
+ const { unitId, unitName, deviceType } = route?.params || {};
10
11
  const t = useTranslations();
11
12
  const navigation = useNavigation();
12
13
  const onPressNext = useCallback(
13
14
  (unit, subUnit) => {
14
- navigation.navigate(Routes.SelectDeviceType, {
15
- unitId,
16
- unitName,
17
- stationId: subUnit?.id,
18
- });
15
+ switch (deviceType) {
16
+ case DEVICE_TYPE.WIFI_DEVICE:
17
+ navigation.navigate(Routes.ScanWifiDeviceQR, {
18
+ unitId,
19
+ unitName,
20
+ stationId: subUnit?.id,
21
+ });
22
+ break;
23
+ case DEVICE_TYPE.MODBUS:
24
+ navigation.navigate(Routes.SelectModbusGateway, {
25
+ unitId,
26
+ unitName,
27
+ stationId: subUnit?.id,
28
+ });
29
+ break;
30
+ case DEVICE_TYPE.ZIGBEE:
31
+ navigation.navigate(Routes.ConnectRouterGuide, {
32
+ unitId,
33
+ unitName,
34
+ stationId: subUnit?.id,
35
+ });
36
+ break;
37
+ }
19
38
  },
20
- [navigation, unitId, unitName]
39
+ [deviceType, navigation, unitId, unitName]
21
40
  );
22
41
  return (
23
42
  <SelectSubUnit
@@ -13,6 +13,7 @@ import AddModbusDeviceIcon from '../../../assets/images/AddNewDevice/add-modbus-
13
13
  import AddZigbeeDeviceIcon from '../../../assets/images/AddNewDevice/add-zigbee-device-icon.svg';
14
14
  import styles from './SelectDeviceTypeStyles';
15
15
  import AccessibilityLabel from '../../configs/AccessibilityLabel';
16
+ import { DEVICE_TYPE } from '../../configs/Constants';
16
17
 
17
18
  const SelectDeviceGrid = ({ options, onSelect }) => {
18
19
  const [selectIndexes, setSelectIndexes] = useState();
@@ -76,6 +77,8 @@ const SelectDeviceType = ({ route }) => {
76
77
  data: {
77
78
  unitId,
78
79
  unitName,
80
+ stationId,
81
+ deviceType: DEVICE_TYPE.WIFI_DEVICE,
79
82
  },
80
83
  title: t('wifi_device'),
81
84
  subtitle: t('device_connect_without_gateway'),
@@ -89,6 +92,8 @@ const SelectDeviceType = ({ route }) => {
89
92
  data: {
90
93
  unitId,
91
94
  unitName,
95
+ stationId,
96
+ deviceType: DEVICE_TYPE.MODBUS,
92
97
  },
93
98
  title: t('modbus'),
94
99
  subtitle: t('device_connect_directly_to_the_gateway'),
@@ -97,11 +102,13 @@ const SelectDeviceType = ({ route }) => {
97
102
  id: 4,
98
103
  image: <AddZigbeeDeviceIcon width={60} height={60} />,
99
104
  route: stationId
100
- ? Routes.SelectZigbeeGateway
105
+ ? Routes.ConnectRouterGuide
101
106
  : Routes.SelectDeviceSubUnit,
102
107
  data: {
103
108
  unitId,
104
109
  unitName,
110
+ stationId,
111
+ deviceType: DEVICE_TYPE.ZIGBEE,
105
112
  },
106
113
  title: t('zigbee'),
107
114
  subtitle: t('device_connect_remotely_to_the_gateway'),
@@ -11,7 +11,7 @@ const SelectZigbeeGateway = ({ route }) => {
11
11
 
12
12
  const onPressNext = useCallback(
13
13
  (gateway) => {
14
- navigation.navigate(Routes.ConnectingZigbeeDevice, {
14
+ navigation.navigate(Routes.ZigbeeDeviceConnectGuide, {
15
15
  unitId,
16
16
  stationId,
17
17
  chipId: gateway.id,
@@ -92,12 +92,11 @@ const ShareWifiPassword = ({ route }) => {
92
92
  } catch (e) {
93
93
  return;
94
94
  }
95
-
96
95
  if (ssid !== currentSsid) {
97
96
  clearInterval(checkWifiInterval);
98
97
  navigation.navigate(Routes.ConnectingWifiDevice, {
99
98
  unitId,
100
- stationId,
99
+ stationId: stationId,
101
100
  gateway: gatewayInfo,
102
101
  selectedWifi: {
103
102
  ssid: selectedWifi,
@@ -5,7 +5,6 @@ import ScanModbusQR from '../ScanModbusQR';
5
5
  import { SCProvider } from '../../../context';
6
6
  import { mockSCStore } from '../../../context/mockStore';
7
7
  import QRScan from '../../ScanChipQR/components/QRScan';
8
- import Toast from 'react-native-toast-message';
9
8
  import { getTranslate } from '../../../utils/I18n';
10
9
  import Routes from '../../../utils/Route';
11
10
 
@@ -57,12 +56,11 @@ describe('test scan modbus QR', () => {
57
56
 
58
57
  test('on scan wrong QR code', async () => {
59
58
  await scanQRCode({ imei: 'SAMSUNG-xxx' });
60
- expect(Toast.show).toBeCalledWith({
61
- type: 'error',
62
- position: 'bottom',
63
- text1: getTranslate('en', 'wrong_qr_format'),
64
- visibilityTime: 1000,
59
+ const instance = tree.root;
60
+ const bottomSheet = instance.findByProps({
61
+ title: getTranslate('en', 'invalid_qr_code'),
65
62
  });
63
+ expect(bottomSheet.props.isVisible).toBe(true);
66
64
  });
67
65
 
68
66
  test('on scan correct QR code', async () => {
@@ -5,7 +5,6 @@ import ScanWifiDeviceQR from '../ScanWifiDeviceQR';
5
5
  import { SCProvider } from '../../../context';
6
6
  import { mockSCStore } from '../../../context/mockStore';
7
7
  import QRScan from '../../ScanChipQR/components/QRScan';
8
- import Toast from 'react-native-toast-message';
9
8
  import { getTranslate } from '../../../utils/I18n';
10
9
  import Routes from '../../../utils/Route';
11
10
 
@@ -57,17 +56,16 @@ describe('test scan wifi device QR', () => {
57
56
 
58
57
  test('on scan wrong QR code', async () => {
59
58
  await scanQRCode({ imei: 'SAMSUNG-xxx' });
60
- expect(Toast.show).toBeCalledWith({
61
- type: 'error',
62
- position: 'bottom',
63
- text1: getTranslate('en', 'wrong_qr_format'),
64
- visibilityTime: 1000,
59
+ const instance = tree.root;
60
+ const bottomSheet = instance.findByProps({
61
+ title: getTranslate('en', 'invalid_qr_code'),
65
62
  });
63
+ expect(bottomSheet.props.isVisible).toBe(true);
66
64
  });
67
65
 
68
66
  test('on scan correct QR code', async () => {
69
67
  await scanQRCode({ imei: 'ROBOT-xxx' }, jest.fn());
70
68
  expect(mockedNavigate).toHaveBeenCalled();
71
- expect(mockedNavigate.mock.calls[0][0]).toEqual(Routes.ShareWifiPassword);
69
+ expect(mockedNavigate.mock.calls[0][0]).toEqual(Routes.ConnectingWifiGuide);
72
70
  });
73
71
  });
@@ -5,6 +5,7 @@ import SelectDeviceSubUnit from '../SelectDeviceSubUnit';
5
5
  import { ViewButtonBottom } from '../../../commons';
6
6
  import { SCProvider } from '../../../context';
7
7
  import { mockSCStore } from '../../../context/mockStore';
8
+ import { DEVICE_TYPE } from '../../../configs/Constants';
8
9
 
9
10
  const mockedGoBack = jest.fn();
10
11
  const mockedNavigate = jest.fn();
@@ -33,7 +34,7 @@ describe('Test SelectSubUnit', () => {
33
34
  let tree;
34
35
 
35
36
  test('test ViewButtonBottom onRightClick', async () => {
36
- const route = { params: { addType: 'AddNewGateway' } };
37
+ const route = { params: { deviceType: DEVICE_TYPE.WIFI_DEVICE } };
37
38
  await act(async () => {
38
39
  tree = renderer.create(wrapComponent(route));
39
40
  });
@@ -68,7 +68,7 @@ describe('Test select zigbee gateway', () => {
68
68
  selectGateway.props.onPressNext({ id: 3 });
69
69
  });
70
70
 
71
- expect(mockedNavigate).toBeCalledWith(Routes.ConnectingZigbeeDevice, {
71
+ expect(mockedNavigate).toBeCalledWith(Routes.ZigbeeDeviceConnectGuide, {
72
72
  unitId: 1,
73
73
  stationId: 2,
74
74
  chipId: 3,
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+
4
+ import { useTranslations } from '../../../../hooks/Common/useTranslations';
5
+ import Text from '../../../../commons/Text';
6
+ import { ViewButtonBottom } from '../../../../commons';
7
+ import BottomSheet from '../../../../commons/BottomSheet';
8
+
9
+ const InvalidQRCode = ({ isInvalidQrCode, goBack, onRetry }) => {
10
+ const t = useTranslations();
11
+
12
+ return (
13
+ <BottomSheet isVisible={isInvalidQrCode} title={t('invalid_qr_code')}>
14
+ <Text style={styles.warningContainer}>
15
+ {t('invalid_qr_code_warning')}
16
+ </Text>
17
+ <ViewButtonBottom
18
+ leftTitle={t('cancel')}
19
+ onLeftClick={goBack}
20
+ rightTitle={t('retry')}
21
+ onRightClick={onRetry}
22
+ />
23
+ </BottomSheet>
24
+ );
25
+ };
26
+
27
+ export default InvalidQRCode;
28
+
29
+ const styles = StyleSheet.create({
30
+ warningContainer: {
31
+ paddingHorizontal: 16,
32
+ },
33
+ });
@@ -46,7 +46,7 @@ const VerifingQRCode = memo(() => {
46
46
  );
47
47
  });
48
48
 
49
- const QRScan = ({ onScan }) => {
49
+ const QRScan = ({ isScanReady = true, onScan }) => {
50
50
  const t = useTranslations();
51
51
  const navigation = useNavigation();
52
52
  const isFocused = useIsFocused();
@@ -55,12 +55,14 @@ const QRScan = ({ onScan }) => {
55
55
 
56
56
  const onBarCodeRead = useCallback(
57
57
  (e) => {
58
- setLoading(true);
59
- if (!loading) {
60
- onScan(e.data, setLoading);
58
+ if (isScanReady) {
59
+ setLoading(true);
60
+ if (!loading) {
61
+ onScan(e.data, setLoading);
62
+ }
61
63
  }
62
64
  },
63
- [loading, onScan]
65
+ [isScanReady, loading, onScan]
64
66
  );
65
67
 
66
68
  const onPressClose = useCallback(() => {
@@ -113,7 +113,6 @@ const ListDeviceSmartAccount = ({ route }) => {
113
113
  setListDeviceSuccess([]);
114
114
  circleOfSelectAll.current = false;
115
115
  }
116
- // eslint-disable-next-line react-hooks/exhaustive-deps
117
116
  }, [listSelectAll, listSelectedDevice.length, listDevices]);
118
117
 
119
118
  return (
@@ -1032,5 +1032,13 @@
1032
1032
  "warning_connecting_smart_account": "Don't turn off the device or close this app during the setup process. Setup may take few minutes to complete.",
1033
1033
  "unidentified": "Unidentified",
1034
1034
  "select_all": "Select All",
1035
+ "turn_off_device": "Turn off device",
1036
+ "turn_off_device_when_scan_qr_guide": "Turn off the device you want to add new before scanning the QR code. Press ‘’OK’’ to continue.",
1037
+ "connect_to_router": "Connect to the Router",
1038
+ "connect_router_content": "Please plug in the gatewayand connect it to the router, making sure your phone and the gatewayare under the same network. Then, comfirm that the light is on and press “Next”",
1039
+ "turn_on_zigbee_device": "Turn on zigbee device",
1040
+ "turn_on_device_to_connect": "Turn on device to connect",
1041
+ "turn_on_zigbee_device_content": "Power ON the device and keep the device connected to the router. Make sure the end device still ON",
1042
+ "read_device_manual_guide": "Read Device's manual guide for more details.",
1035
1043
  "click_here_to_setup_device": "Click here to setup device"
1036
1044
  }
@@ -1030,5 +1030,13 @@
1030
1030
  "warning_connecting_smart_account": "Đừng tắt thiết bị hoặc đóng ứng dụng này trong quá trình thiết lập. Quá trình thiết lập có thể mất vài phút để hoàn thành.",
1031
1031
  "unidentified": "Chưa xếp vào phòng",
1032
1032
  "select_all": "Chọn tất cả",
1033
+ "turn_off_device": "Tắt thiết bị",
1034
+ "turn_off_device_when_scan_qr_guide": "Tắt thiết bị bạn muốn thêm mới trước khi quét mã QR. Nhấn ‘’OK’’ để tiếp tục.",
1035
+ "connect_to_router": "Kết nối với Bộ định tuyến",
1036
+ "connect_router_content": "Vui lòng cắm cổng vào và kết nối nó với bộ định tuyến, đảm bảo rằng điện thoại của bạn và cổng kết nối nằm trong cùng một mạng. Sau đó, xác nhận rằng đèn đã sáng và nhấn “Tiếp theo”",
1037
+ "turn_on_zigbee_device": "Bật thiết bị zigbee",
1038
+ "turn_on_device_to_connect": "Bật thiết bị để kết nối",
1039
+ "turn_on_zigbee_device_content": "BẬT nguồn thiết bị và giữ thiết bị kết nối với bộ định tuyến. Đảm bảo thiết bị cuối vẫn BẬT",
1040
+ "read_device_manual_guide": "Đọc hướng dẫn sử dụng của Thiết bị để biết thêm chi tiết.",
1033
1041
  "click_here_to_setup_device": "Chọn thiết bị thêm vào phòng"
1034
1042
  }
@@ -66,6 +66,7 @@ const Routes = {
66
66
  SelectZigbeeGateway: 'SelectZigbeeGateway',
67
67
  ConnectingZigbeeDevice: 'ConnectingZigbeeDevice',
68
68
  ScanModbusQR: 'ScanModbusQR',
69
+ ScanZigbeeGateway: 'ScanZigbeeGateway',
69
70
  ConnectingModbusDevice: 'ConnectingModbusDevice',
70
71
  ScanWifiDeviceQR: 'ScanWifiDeviceQR',
71
72
  ScanGatewayQR: 'ScanGatewayQR',
@@ -139,6 +140,8 @@ const Routes = {
139
140
  SmartAccountConnecting: 'SmartAccountConnecting',
140
141
  EmergencySetting: 'EmergencySetting',
141
142
  FirstWarning: 'FirstWarning',
143
+ ConnectRouterGuide: 'ConnectRouterGuide',
144
+ ZigbeeDeviceConnectGuide: 'ZigbeeDeviceConnectGuide',
142
145
  ConfirmUnitDeletion: 'ConfirmUnitDeletion',
143
146
  SmartAccount: 'SmartAccount',
144
147
  SmartHomeDashboard: 'SmartHomeDashboard',