@eohjsc/react-native-smart-city 0.2.20 → 0.2.26
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.
- package/README.md +1 -1
- package/assets/images/Add.svg +5 -0
- package/assets/images/AddLocationMaps/Point.svg +3 -0
- package/assets/images/CheckCircle.svg +4 -0
- package/assets/images/Close.svg +3 -0
- package/assets/images/HowToStart.svg +14 -0
- package/assets/images/OneTap.svg +14 -0
- package/assets/images/OneTap@1x.svg +14 -0
- package/assets/images/Rearrange.svg +3 -0
- package/assets/images/Schedule.svg +39 -0
- package/assets/images/WeatherChange.svg +49 -0
- package/package.json +12 -2
- package/src/Images/Common/ActiveButton.png +0 -0
- package/src/Images/Common/ActiveButton@2x.png +0 -0
- package/src/Images/Common/ActiveButton@3x.png +0 -0
- package/src/Images/Common/arrow-back.png +0 -0
- package/src/Images/Common/checked@2x.png +0 -0
- package/src/Images/Common/checked@3x.png +0 -0
- package/src/Images/Common/file.png +0 -0
- package/src/Images/Common/fullscreen.png +0 -0
- package/src/Images/Common/refresh.png +0 -0
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +1 -1
- package/src/commons/ActionGroup/OnOffTemplate/index.js +4 -4
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +7 -4
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +12 -3
- package/src/commons/ActionGroup/ThreeButtonTemplate.js +13 -6
- package/src/commons/ActionGroup/ThreeButtonTemplateStyle.js +1 -1
- package/src/commons/ActionGroup/TimerActionTemplate.js +158 -33
- package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +8 -13
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +26 -45
- package/src/commons/ActionGroup/__test__/ThreeButtonTemplate.test.js +11 -5
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +14 -8
- package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +17 -23
- package/src/commons/ActionGroup/__test__/__snapshots__/ThreeButtonTemplate.test.js.snap +241 -223
- package/src/commons/ActionGroup/__test__/index.test.js +39 -107
- package/src/commons/ActionGroup/hooks/useDropdownAction.js +2 -1
- package/src/commons/ActionTemplate/ActionTemplateStyles.js +14 -0
- package/src/commons/ActionTemplate/OnOffButtonAction.js +40 -0
- package/src/commons/ActionTemplate/OnOffButtonActionStyles.js +11 -0
- package/src/commons/ActionTemplate/OneButtonAction.js +26 -0
- package/src/commons/ActionTemplate/OneButtonActionStyles.js +11 -0
- package/src/commons/ActionTemplate/ThreeButtonAction.js +55 -0
- package/src/commons/ActionTemplate/ThreeButtonActionStyles.js +11 -0
- package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +34 -0
- package/src/commons/ActionTemplate/__test__/OneButtonAction.test.js +33 -0
- package/src/commons/ActionTemplate/__test__/ThreeButtonAction.test.js +35 -0
- package/src/commons/ActionTemplate/__test__/index.test.js +71 -0
- package/src/commons/ActionTemplate/index.js +69 -0
- package/src/commons/Automate/ItemAddNewScriptAction.js +30 -0
- package/src/commons/Automate/ItemAddNewScriptActionStyles.js +38 -0
- package/src/commons/Automate/ItemAutomate.js +33 -0
- package/src/commons/Automate/ItemAutomateStyles.js +33 -0
- package/src/commons/Automate/ItemScriptAction.js +45 -0
- package/src/commons/Automate/ItemScriptActionStyles.js +42 -0
- package/src/commons/BottomScrollPicker/index.js +58 -0
- package/src/commons/BottomScrollPicker/styles.js +13 -0
- package/src/commons/BottomSheet/index.js +36 -0
- package/src/commons/BottomSheet/styles.js +37 -0
- package/src/commons/Button/index.js +6 -1
- package/src/commons/CameraDevice/index.js +2 -1
- package/src/commons/ChartLoading/__test__/ChartLoading.test.js +9 -7
- package/src/commons/ChartLoading/index.js +2 -1
- package/src/commons/DateTimeRangeChange/index.js +2 -1
- package/src/commons/Device/ConnectedViewHeader.js +3 -1
- package/src/commons/Device/DeviceAlertStatus.js +5 -2
- package/src/commons/Device/DisconnectedView.js +34 -26
- package/src/commons/Device/Emergency/EmergencyButton.js +2 -1
- package/src/commons/Device/Emergency/EmergencyDetail.js +2 -1
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +14 -6
- package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +10 -2
- package/src/commons/Device/FlatListItems.js +3 -2
- package/src/commons/Device/FooterInfo.js +2 -1
- package/src/commons/Device/HistoryChart.js +2 -1
- package/src/commons/Device/ItemAddNew/index.js +6 -1
- package/src/commons/Device/SensorConnectedStatus.js +2 -1
- package/src/commons/Device/WindDirection/Compass/Compass.test.js +19 -11
- package/src/commons/Device/WindDirection/Compass/index.js +1 -1
- package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +9 -3
- package/src/commons/Device/WindSpeed/LinearChart/__test__/__snapshots__/LinearChart.test.js.snap +0 -81
- package/src/commons/Device/WindSpeed/LinearChart/index.js +2 -1
- package/src/commons/Device/__test__/ConnectedViewHeader.test.js +16 -8
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +13 -5
- package/src/commons/Device/__test__/DisconnectedView.test.js +13 -5
- package/src/commons/Device/__test__/FlatListItems.test.js +9 -1
- package/src/commons/Device/__test__/FooterInfo.test.js +13 -4
- package/src/commons/Device/__test__/SensorConnectedStatus.test.js +9 -1
- package/src/commons/Device/__test__/__snapshots__/DisconnectedView.test.js.snap +20 -20
- package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +28 -0
- package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -1
- package/src/commons/EmergencyButton/AlertSent.js +3 -2
- package/src/commons/Explore/CityItem/index.js +2 -1
- package/src/commons/Explore/HeaderExplore/index.js +2 -1
- package/src/commons/Explore/HeaderLabel/index.js +2 -1
- package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +9 -2
- package/src/commons/Explore/SearchBox/index.js +2 -1
- package/src/commons/Explore/__test__/CityItem.test.js +13 -15
- package/src/commons/Explore/__test__/HeaderLabel.test.js +15 -9
- package/src/commons/Header/HeaderCustom.js +17 -1
- package/src/commons/Header/Styles/HeaderCustomStyles.js +2 -2
- package/src/commons/Header/__test__/HeaderCT.test.js +12 -4
- package/src/commons/HeaderAni/index.js +6 -3
- package/src/commons/IconComponent/index.js +18 -3
- package/src/commons/ImagePicker/__test__/ImagePicker.test.js +19 -13
- package/src/commons/ImagePicker/index.js +3 -1
- package/src/commons/MediaPlayer/index.js +2 -1
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +14 -8
- package/src/commons/MediaPlayerDetail/index.js +4 -1
- package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +11 -20
- package/src/commons/MenuActionAddnew/index.js +2 -1
- package/src/commons/Modal/ModalBottom.js +51 -0
- package/src/commons/Modal/ModalFullVideo.js +2 -1
- package/src/commons/Modal/Styles/ModalBottomStyles.js +35 -0
- package/src/commons/Modal/index.js +2 -1
- package/src/commons/NavBar/index.js +2 -2
- package/src/commons/SelectActionCard/SelectActionStyles.js +16 -0
- package/src/commons/SelectActionCard/index.js +30 -0
- package/src/commons/Sharing/DevicePermissionsCheckbox.js +2 -1
- package/src/commons/Sharing/MemberList.js +3 -1
- package/src/commons/Sharing/RowMember.js +3 -2
- package/src/commons/Sharing/StationDevicePermissions.js +2 -1
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +15 -9
- package/src/commons/Sharing/__test__/MemberList.test.js +17 -25
- package/src/commons/Sharing/__test__/StationDevicePermission.test.js +17 -12
- package/src/commons/Sharing/__test__/WrapHeaderScrollable.test.js +0 -9
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +97 -0
- package/src/commons/SubUnit/OneTap/ItemOneTapStyles.js +41 -0
- package/src/commons/SubUnit/OneTap/OneTapStyles.js +36 -0
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +149 -0
- package/src/commons/SubUnit/OneTap/index.js +39 -0
- package/src/commons/SubUnit/ShortDetail.js +11 -6
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +14 -6
- package/src/commons/Today/__test__/Today.test.js +9 -1
- package/src/commons/Today/__test__/__snapshots__/Today.test.js.snap +1 -1
- package/src/commons/Today/index.js +2 -1
- package/src/commons/Unit/SharedUnit.js +2 -1
- package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -2
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +16 -17
- package/src/commons/UnitSummary/AirQuality/index.js +5 -120
- package/src/commons/UnitSummary/AirQuality/styles.js +112 -0
- package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -1
- package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +15 -9
- package/src/commons/WheelDateTimePicker/Picker.js +57 -0
- package/src/commons/WheelDateTimePicker/index.js +160 -0
- package/src/commons/WheelDateTimePicker/styles.js +21 -0
- package/src/configs/API.js +25 -0
- package/src/configs/Colors.js +1 -0
- package/src/configs/Constants.js +46 -0
- package/src/configs/Images.js +1 -0
- package/src/configs/SCConfig.js +7 -0
- package/src/context/SCContext.tsx +7 -37
- package/src/context/actionType.ts +11 -0
- package/src/context/mockStore.ts +49 -0
- package/src/context/reducer.ts +23 -0
- package/src/hooks/Common/__test__/useTranslations.test.js +23 -0
- package/src/hooks/Common/index.js +2 -0
- package/src/hooks/Common/useGetIdUser.js +9 -0
- package/src/hooks/Common/useTranslations.ts +34 -0
- package/src/iot/Monitor.js +2 -1
- package/src/iot/RemoteControl/Bluetooth.js +2 -6
- package/src/iot/RemoteControl/GoogleHome.js +1 -1
- package/src/iot/RemoteControl/Internet.js +1 -1
- package/src/iot/RemoteControl/LG.js +57 -15
- package/src/iot/RemoteControl/__test__/Bluetooth.test.js +3 -5
- package/src/iot/RemoteControl/__test__/GoogleHome.test.js +3 -3
- package/src/iot/RemoteControl/__test__/Internet.test.js +1 -8
- package/src/iot/RemoteControl/__test__/LgThinq.test.js +7 -10
- package/src/iot/RemoteControl/index.js +1 -1
- package/src/iot/states.js +1 -0
- package/src/navigations/SharedStack.js +2 -1
- package/src/navigations/UnitStack.js +62 -1
- package/src/screens/AQIGuide/__test__/AQIGuide.test.js +9 -1
- package/src/screens/AQIGuide/index.js +2 -2
- package/src/screens/ActivityLog/__test__/index.test.js +14 -39
- package/src/screens/ActivityLog/index.js +2 -1
- package/src/screens/AddCommon/SelectSubUnit.js +5 -4
- package/src/screens/AddCommon/SelectUnit.js +3 -2
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +61 -0
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +18 -10
- package/src/screens/AddLocationMaps/index.js +2 -1
- package/src/screens/AddNewAction/Device/DeviceStyles.js +43 -0
- package/src/screens/AddNewAction/Device/__test__/index.test.js +42 -0
- package/src/screens/AddNewAction/Device/index.js +33 -0
- package/src/screens/AddNewAction/SelectAction.js +152 -0
- package/src/screens/AddNewAction/SelectDevice.js +120 -0
- package/src/screens/AddNewAction/Styles/SelectActionStyles.js +24 -0
- package/src/screens/AddNewAction/Styles/SelectDeviceStyles.js +36 -0
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +172 -0
- package/src/screens/AddNewAction/__test__/SelectDevice.test.js +191 -0
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +55 -0
- package/src/screens/AddNewAutoSmart/index.js +85 -0
- package/src/screens/AddNewAutoSmart/styles/AddNewAutoSmartStyles.js +36 -0
- package/src/screens/AddNewDevice/ConnectDevices.js +2 -1
- package/src/screens/AddNewDevice/ConnectingDevices.js +2 -1
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +29 -13
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +19 -7
- package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +16 -6
- package/src/screens/AddNewDevice/hooks/useStateAlertRename.js +2 -1
- package/src/screens/AddNewDevice/index.js +2 -1
- package/src/screens/AddNewGateway/ConnectedGateway.js +2 -1
- package/src/screens/AddNewGateway/ConnectingGateway.js +99 -24
- package/src/screens/AddNewGateway/ConnectingGatewayStyles.js +92 -0
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +3 -2
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +35 -72
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +14 -4
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +20 -10
- package/src/screens/AddNewGateway/hooks/useStateAlertRename.js +2 -1
- package/src/screens/AddNewGateway/index.js +2 -1
- package/src/screens/AddNewOneTap/AddNewOneTapStyles.js +43 -0
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +129 -0
- package/src/screens/AddNewOneTap/index.js +80 -0
- package/src/screens/AddNewScriptAction/AddNewScriptActionStyles.js +28 -0
- package/src/screens/AddNewScriptAction/index.js +100 -0
- package/src/screens/AllCamera/index.js +2 -1
- package/src/screens/Device/HeaderDevice/styles.js +2 -2
- package/src/screens/Device/__test__/detail.test.js +26 -18
- package/src/screens/Device/detail.js +56 -28
- package/src/screens/Device/hooks/useCountUp.js +4 -0
- package/src/screens/Device/hooks/useEmergencyButton.js +3 -2
- package/src/screens/Device/styles.js +5 -1
- package/src/screens/DeviceInfo/__test__/index.test.js +12 -3
- package/src/screens/DeviceInfo/index.js +2 -1
- package/src/screens/EditActionsList/Styles/indexStyles.js +84 -0
- package/src/screens/EditActionsList/index.js +186 -0
- package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +3 -2
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +9 -2
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +2 -1
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +15 -18
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +19 -23
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +10 -25
- package/src/screens/EmergencyContacts/hook.js +3 -2
- package/src/screens/Explore/index.js +3 -2
- package/src/screens/GuestInfo/components/AccessScheduleItem.js +27 -0
- package/src/screens/GuestInfo/components/AccessScheduleSheet.js +193 -0
- package/src/screens/GuestInfo/components/HeaderGuestInfo.js +31 -0
- package/src/screens/GuestInfo/components/RecurringDetail.js +99 -0
- package/src/screens/GuestInfo/components/RowGuestInfo.js +31 -0
- package/src/screens/GuestInfo/components/TemporaryDetail.js +46 -0
- package/src/screens/GuestInfo/constant.js +59 -0
- package/src/screens/GuestInfo/index.js +151 -0
- package/src/screens/GuestInfo/styles/AccessScheduleDetailStyles.js +31 -0
- package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +22 -0
- package/src/screens/GuestInfo/styles/HeaderGuestInfoStyles.js +31 -0
- package/src/screens/GuestInfo/styles/indexStyles.js +38 -0
- package/src/screens/ManageAccess/__test__/ManageAccess.test.js +13 -1
- package/src/screens/ManageAccess/hooks/index.js +4 -0
- package/src/screens/ManageAccess/index.js +49 -20
- package/src/screens/ManageAccess/styles/ManageAccessStyles.js +3 -0
- package/src/screens/PlayBackCamera/index.js +9 -5
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +2 -11
- package/src/screens/ScanChipQR/components/QRScan/index.js +2 -1
- package/src/screens/ScriptDetail/Styles/indexStyles.js +143 -0
- package/src/screens/ScriptDetail/index.js +243 -0
- package/src/screens/SharedUnit/TabHeader.js +2 -1
- package/src/screens/SharedUnit/__test__/TabHeader.test.js +40 -0
- package/src/screens/SharedUnit/index.js +3 -2
- package/src/screens/Sharing/MemberList.js +2 -1
- package/src/screens/Sharing/SelectPermission.js +2 -1
- package/src/screens/Sharing/SelectUser.js +3 -2
- package/src/screens/Sharing/__test__/MemberList.test.js +17 -13
- package/src/screens/Sharing/__test__/SelectPermission.test.js +16 -8
- package/src/screens/Sharing/__test__/SelectUser.test.js +33 -15
- package/src/screens/Sharing/hooks/index.js +22 -17
- package/src/screens/SubUnit/AddSubUnit.js +3 -2
- package/src/screens/SubUnit/Detail.js +5 -4
- package/src/screens/SubUnit/ManageSubUnit.js +10 -9
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +17 -11
- package/src/screens/SubUnit/__test__/Detail.test.js +11 -31
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +42 -31
- package/src/screens/SyncLGDevice/AddLGDevice.js +3 -2
- package/src/screens/TDSGuide/__test__/TDSGuide.test.js +9 -1
- package/src/screens/TDSGuide/index.js +2 -1
- package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +9 -1
- package/src/screens/UVIndexGuide/index.js +2 -1
- package/src/screens/Unit/AddMenu.js +3 -2
- package/src/screens/Unit/Detail.js +65 -20
- package/src/screens/Unit/ManageUnit/index.js +4 -3
- package/src/screens/Unit/ManageUnit.js +5 -4
- package/src/screens/Unit/MoreMenu.js +3 -2
- package/src/screens/Unit/SelectLocation.js +8 -2
- package/src/screens/Unit/SelectLocationStyles.js +11 -0
- package/src/screens/Unit/__test__/AddMenu.test.js +15 -15
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +19 -10
- package/src/screens/Unit/__test__/Detail.test.js +92 -33
- package/src/screens/Unit/__test__/ManageUnit.test.js +16 -23
- package/src/screens/Unit/components/Header/index.js +2 -1
- package/src/screens/Unit/components/ListMyAllUnit/index.js +2 -1
- package/src/screens/Unit/components/MyUnit/index.js +2 -1
- package/src/screens/Unit/components/SearchLocation/index.js +2 -1
- package/src/screens/Unit/components/SharedUnit/index.js +2 -1
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +11 -2
- package/src/screens/UnitSummary/__test__/index.test.js +12 -4
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +13 -3
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +16 -12
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +2 -2
- package/src/screens/UnitSummary/components/Temperature/index.js +2 -1
- package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/UvIndex/__test__/__snapshots__/index.test.js.snap +37 -37
- package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +14 -6
- package/src/screens/UnitSummary/components/UvIndex/index.js +2 -1
- package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +11 -5
- package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -1
- package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +13 -7
- package/src/screens/UnitSummary/index.js +2 -1
- package/src/screens/WaterQualityGuide/__test__/index.test.js +12 -12
- package/src/screens/WaterQualityGuide/index.js +2 -1
- package/src/utils/Converter/array.js +4 -0
- package/src/utils/Converter/time.js +29 -4
- package/src/utils/I18n/index.ts +6 -0
- package/src/utils/I18n/translations/en.json +48 -2
- package/src/utils/I18n/translations/vi.json +45 -1
- package/src/utils/I18n/translations.ts +45 -0
- package/src/utils/Route/index.js +8 -0
- package/src/commons/ChartLoading/__test__/__snapshots__/ChartLoading.test.js.snap +0 -66
- package/src/commons/Device/HistoryChart/__test__/HistoryChart.test.js +0 -57
- package/src/commons/Device/HistoryChart/__test__/__snapshots__/HistoryChart.test.js.snap +0 -593
- package/src/commons/Explore/SearchBox/__test__/__snapshots__/SearchBox.test.js.snap +0 -59
- package/src/commons/Explore/__test__/HeaderExplore.test.js +0 -21
- package/src/commons/Header/__test__/Header.test.js +0 -24
- package/src/commons/MenuActionAddnew/__test__/__snapshots__/MenuActionAddNew.test.js.snap +0 -788
- package/src/commons/Sharing/__test__/__snapshots__/WrapHeaderScrollable.test.js.snap +0 -174
- package/src/commons/UnitSummary/AirQuality/__test__/__snapshots__/index.test.js.snap +0 -26679
- package/src/iot/RemoteControl/__test__/index.test.js +0 -101
- package/src/iot/__test__/Monitor.test.js +0 -119
- package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactAddNew.test.js.snap +0 -1706
- package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactList.test.js.snap +0 -4276
- package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactsSelectContacts.test.js.snap +0 -2240
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +0 -358
- package/src/screens/Unit/MyAllUnit/__test__/__snapshots__/index.test.js.snap +0 -1001
- package/src/screens/Unit/MyAllUnit/__test__/index.test.js +0 -48
- package/src/screens/Unit/components/MyAllUnit/__test__/__snapshots__/index.test.js.snap +0 -1001
- package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -48
- package/src/screens/Unit/components/__test__/MyUnit.test.js +0 -85
- package/src/screens/UnitSummary/components/WaterQuality/__test__/__snapshots__/index.test.js.snap +0 -1574
- package/src/screens/WaterQualityGuide/__test__/__snapshots__/index.test.js.snap +0 -3375
- package/src/utils/Converter/__test__/time.test.js +0 -126
- package/src/utils/I18n/index.js +0 -19
- package/src/utils/I18n/index.test.js +0 -7
|
@@ -5,7 +5,7 @@ import { IconOutline } from '@ant-design/icons-react-native';
|
|
|
5
5
|
import { RNCamera } from 'react-native-camera';
|
|
6
6
|
import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
|
7
7
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
8
|
-
import {
|
|
8
|
+
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
9
9
|
|
|
10
10
|
import { Colors, Device } from '../../../../configs';
|
|
11
11
|
import Text from '../../../../commons/Text';
|
|
@@ -26,6 +26,7 @@ const LoadingCamera = memo(() => {
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const VerifingQRCode = memo(() => {
|
|
29
|
+
const t = useTranslations();
|
|
29
30
|
return (
|
|
30
31
|
<View style={styles.maskOutter}>
|
|
31
32
|
<TouchableOpacity style={[styles.viewVerifing, styles.buttonShadow]}>
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Colors } from '../../../configs';
|
|
2
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
3
|
+
import { getBottomSpace } from 'react-native-iphone-x-helper';
|
|
4
|
+
|
|
5
|
+
export default StyleSheet.create({
|
|
6
|
+
wrap: {
|
|
7
|
+
flex: 1,
|
|
8
|
+
backgroundColor: Colors.White,
|
|
9
|
+
},
|
|
10
|
+
wrapContent: {
|
|
11
|
+
flex: 1,
|
|
12
|
+
paddingHorizontal: 16,
|
|
13
|
+
paddingTop: 10,
|
|
14
|
+
paddingBottom: getBottomSpace() + 10,
|
|
15
|
+
},
|
|
16
|
+
headerAniStyle: {
|
|
17
|
+
borderBottomWidth: 0,
|
|
18
|
+
},
|
|
19
|
+
box: {
|
|
20
|
+
height: 76,
|
|
21
|
+
backgroundColor: Colors.White,
|
|
22
|
+
paddingHorizontal: 16,
|
|
23
|
+
flexDirection: 'row',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
borderRadius: 8,
|
|
26
|
+
marginTop: 16,
|
|
27
|
+
marginBottom: 24,
|
|
28
|
+
shadowColor: Colors.Shadow,
|
|
29
|
+
shadowOffset: {
|
|
30
|
+
width: 0,
|
|
31
|
+
height: 2,
|
|
32
|
+
},
|
|
33
|
+
shadowOpacity: 0.22,
|
|
34
|
+
shadowRadius: 4,
|
|
35
|
+
elevation: 3,
|
|
36
|
+
},
|
|
37
|
+
wrapText: {
|
|
38
|
+
flex: 1,
|
|
39
|
+
marginLeft: 16,
|
|
40
|
+
},
|
|
41
|
+
rightComponent: {
|
|
42
|
+
flexDirection: 'row',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
},
|
|
45
|
+
headerButton: {
|
|
46
|
+
marginRight: 20,
|
|
47
|
+
},
|
|
48
|
+
activeButton: {
|
|
49
|
+
alignSelf: 'center',
|
|
50
|
+
},
|
|
51
|
+
row: {
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
justifyContent: 'space-between',
|
|
55
|
+
marginBottom: 16,
|
|
56
|
+
},
|
|
57
|
+
editButton: {
|
|
58
|
+
height: 40,
|
|
59
|
+
justifyContent: 'center',
|
|
60
|
+
alignItems: 'center',
|
|
61
|
+
},
|
|
62
|
+
moreButton: {
|
|
63
|
+
marginLeft: -5,
|
|
64
|
+
},
|
|
65
|
+
wrapStyle: {
|
|
66
|
+
borderRadius: 8,
|
|
67
|
+
borderBottomRightRadius: 8,
|
|
68
|
+
borderBottomLeftRadius: 8,
|
|
69
|
+
width: 160,
|
|
70
|
+
marginTop: Platform.select({
|
|
71
|
+
android: -25,
|
|
72
|
+
ios: 0,
|
|
73
|
+
}),
|
|
74
|
+
marginLeft: -10,
|
|
75
|
+
},
|
|
76
|
+
wrapItem: {
|
|
77
|
+
flexDirection: 'row',
|
|
78
|
+
height: 100,
|
|
79
|
+
marginBottom: 16,
|
|
80
|
+
},
|
|
81
|
+
leftItem: {
|
|
82
|
+
width: 41,
|
|
83
|
+
height: '100%',
|
|
84
|
+
borderWidth: 1,
|
|
85
|
+
justifyContent: 'center',
|
|
86
|
+
alignItems: 'center',
|
|
87
|
+
borderRadius: 4,
|
|
88
|
+
borderColor: Colors.Gray4,
|
|
89
|
+
},
|
|
90
|
+
leftItemAdd: {
|
|
91
|
+
width: 41,
|
|
92
|
+
height: '100%',
|
|
93
|
+
justifyContent: 'center',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
borderRadius: 4,
|
|
96
|
+
borderColor: Colors.Gray4,
|
|
97
|
+
borderStyle: 'dashed',
|
|
98
|
+
borderWidth: 2,
|
|
99
|
+
},
|
|
100
|
+
rightItem: {
|
|
101
|
+
flex: 1,
|
|
102
|
+
marginLeft: 4,
|
|
103
|
+
borderRadius: 4,
|
|
104
|
+
borderColor: Colors.Gray4,
|
|
105
|
+
borderWidth: 1,
|
|
106
|
+
flexDirection: 'row',
|
|
107
|
+
paddingVertical: 15,
|
|
108
|
+
paddingHorizontal: 16,
|
|
109
|
+
},
|
|
110
|
+
rightItemAdd: {
|
|
111
|
+
flex: 1,
|
|
112
|
+
marginLeft: 4,
|
|
113
|
+
borderRadius: 4,
|
|
114
|
+
borderColor: Colors.Gray4,
|
|
115
|
+
flexDirection: 'row',
|
|
116
|
+
alignItems: 'center',
|
|
117
|
+
paddingHorizontal: 16,
|
|
118
|
+
borderStyle: 'dashed',
|
|
119
|
+
borderWidth: 2,
|
|
120
|
+
},
|
|
121
|
+
noBorder: {
|
|
122
|
+
borderWidth: 0,
|
|
123
|
+
},
|
|
124
|
+
iconItem: {
|
|
125
|
+
width: 40,
|
|
126
|
+
height: 40,
|
|
127
|
+
marginRight: 24,
|
|
128
|
+
},
|
|
129
|
+
contentItem: {
|
|
130
|
+
flex: 1,
|
|
131
|
+
},
|
|
132
|
+
addAction: {
|
|
133
|
+
marginLeft: 24,
|
|
134
|
+
marginTop: Platform.select({
|
|
135
|
+
android: 3,
|
|
136
|
+
ios: 0,
|
|
137
|
+
}),
|
|
138
|
+
},
|
|
139
|
+
number: {
|
|
140
|
+
position: 'absolute',
|
|
141
|
+
zIndex: 10,
|
|
142
|
+
},
|
|
143
|
+
});
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useCallback,
|
|
3
|
+
useMemo,
|
|
4
|
+
useState,
|
|
5
|
+
useRef,
|
|
6
|
+
useEffect,
|
|
7
|
+
} from 'react';
|
|
8
|
+
import { View, TouchableOpacity, Image } from 'react-native';
|
|
9
|
+
import { IconFill, IconOutline } from '@ant-design/icons-react-native';
|
|
10
|
+
import { Icon } from '@ant-design/react-native';
|
|
11
|
+
|
|
12
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
13
|
+
import styles from './Styles/indexStyles';
|
|
14
|
+
import Text from '../../commons/Text';
|
|
15
|
+
import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
|
|
16
|
+
import { API, Colors, Images } from '../../configs';
|
|
17
|
+
import { usePopover } from '../../hooks/Common';
|
|
18
|
+
import MenuActionMore from '../../commons/MenuActionMore';
|
|
19
|
+
import Add from '../../../assets/images/Add.svg';
|
|
20
|
+
import { useNavigation, useRoute } from '@react-navigation/core';
|
|
21
|
+
import { axiosGet, axiosPost } from '../../utils/Apis/axios';
|
|
22
|
+
import FImage from '../../commons/FImage';
|
|
23
|
+
import Routes from '../../utils/Route';
|
|
24
|
+
import { ToastBottomHelper } from '../../utils/Utils';
|
|
25
|
+
import ItemAutomate from '../../commons/Automate/ItemAutomate';
|
|
26
|
+
import { AUTOMATE_TYPE } from '../../configs/Constants';
|
|
27
|
+
|
|
28
|
+
const ScriptDetail = () => {
|
|
29
|
+
const { navigate } = useNavigation();
|
|
30
|
+
const { params = {} } = useRoute();
|
|
31
|
+
const refMenuAction = useRef();
|
|
32
|
+
const { childRef, showingPopover, showPopoverWithRef, hidePopover } =
|
|
33
|
+
usePopover();
|
|
34
|
+
const t = useTranslations();
|
|
35
|
+
const { id, name = '', type, havePermission, unit, dateNow = null } = params;
|
|
36
|
+
const [isFavourite, setIsFavourite] = useState(false);
|
|
37
|
+
const [data, setData] = useState([]);
|
|
38
|
+
|
|
39
|
+
const listMenuItem = [
|
|
40
|
+
{ text: 'Rename' },
|
|
41
|
+
{ text: 'Activity Log' },
|
|
42
|
+
{ text: 'Delete Script' },
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
const onPressFavourite = useCallback(() => {
|
|
46
|
+
setIsFavourite(!isFavourite);
|
|
47
|
+
}, [isFavourite]);
|
|
48
|
+
|
|
49
|
+
const handleShowMenuAction = useCallback(
|
|
50
|
+
() => showPopoverWithRef(refMenuAction),
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
[]
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const onItemClick = useCallback((item) => {
|
|
56
|
+
// eslint-disable-next-line no-alert
|
|
57
|
+
alert(t('feature_under_development'));
|
|
58
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
|
+
}, []);
|
|
60
|
+
|
|
61
|
+
const onPressAdd = useCallback(() => {
|
|
62
|
+
// eslint-disable-next-line no-alert
|
|
63
|
+
alert(t('feature_under_development'));
|
|
64
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
67
|
+
const getOneTapDetail = useCallback(async () => {
|
|
68
|
+
const { success, data } = await axiosGet(API.AUTOMATE.ONE_TAP_DETAIL(id));
|
|
69
|
+
success && setData(data?.script_actions || []);
|
|
70
|
+
}, [id]);
|
|
71
|
+
|
|
72
|
+
const onPressEdit = useCallback(() => {
|
|
73
|
+
navigate(Routes.EditActionsList, { data, id, setData });
|
|
74
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
+
}, [data]);
|
|
76
|
+
|
|
77
|
+
const onPressAddAction = useCallback(() => {
|
|
78
|
+
navigate(Routes.SelectDevice, {
|
|
79
|
+
unit,
|
|
80
|
+
automateId: id,
|
|
81
|
+
scriptName: name,
|
|
82
|
+
});
|
|
83
|
+
}, [navigate, id, name, unit]);
|
|
84
|
+
|
|
85
|
+
const handleScriptAction = useCallback(async () => {
|
|
86
|
+
const { success } = await axiosPost(API.AUTOMATE.ACTION_ONE_TAP(id));
|
|
87
|
+
if (success) {
|
|
88
|
+
ToastBottomHelper.success(t('Activated successfully.'));
|
|
89
|
+
} else {
|
|
90
|
+
ToastBottomHelper.error(t('Activation failed.'));
|
|
91
|
+
}
|
|
92
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
93
|
+
}, [id]);
|
|
94
|
+
|
|
95
|
+
const Item = useCallback(({ item, index }) => {
|
|
96
|
+
return (
|
|
97
|
+
<View style={styles.wrapItem}>
|
|
98
|
+
<View style={styles.leftItem}>
|
|
99
|
+
<Text color={Colors.Gray9} type="H4" semibold>
|
|
100
|
+
{index + 1 < 10 ? '0' + (index + 1) : index + 1}
|
|
101
|
+
</Text>
|
|
102
|
+
</View>
|
|
103
|
+
<View style={styles.rightItem}>
|
|
104
|
+
<FImage
|
|
105
|
+
source={{ uri: item?.sensor_icon_kit }}
|
|
106
|
+
style={styles.iconItem}
|
|
107
|
+
/>
|
|
108
|
+
<View style={styles.contentItem}>
|
|
109
|
+
<Text numberOfLines={1} type="Label" color={Colors.Gray7}>
|
|
110
|
+
{item?.station_name}
|
|
111
|
+
</Text>
|
|
112
|
+
<Text numberOfLines={1} type="H4" color={Colors.Gray9} semibold>
|
|
113
|
+
{item?.sensor_name}
|
|
114
|
+
</Text>
|
|
115
|
+
<Text numberOfLines={1} type="H4" color={Colors.Gray9}>
|
|
116
|
+
{item?.action_name}
|
|
117
|
+
</Text>
|
|
118
|
+
</View>
|
|
119
|
+
</View>
|
|
120
|
+
</View>
|
|
121
|
+
);
|
|
122
|
+
}, []);
|
|
123
|
+
|
|
124
|
+
const ItemAdd = useCallback(({ item, index }) => {
|
|
125
|
+
return (
|
|
126
|
+
<View style={styles.wrapItem}>
|
|
127
|
+
<View style={styles.leftItemAdd}>
|
|
128
|
+
<Text style={styles.number} type="H4" semibold color={Colors.Gray7}>
|
|
129
|
+
{index + 1 < 10 ? '0' + (index + 1) : index + 1}
|
|
130
|
+
</Text>
|
|
131
|
+
</View>
|
|
132
|
+
<TouchableOpacity
|
|
133
|
+
onPress={onPressAddAction}
|
|
134
|
+
style={[styles.rightItemAdd]}
|
|
135
|
+
>
|
|
136
|
+
<Add />
|
|
137
|
+
<Text type="H4" color={Colors.Gray8} style={styles.addAction}>
|
|
138
|
+
{t('add_action')}
|
|
139
|
+
</Text>
|
|
140
|
+
</TouchableOpacity>
|
|
141
|
+
</View>
|
|
142
|
+
);
|
|
143
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
144
|
+
}, []);
|
|
145
|
+
|
|
146
|
+
const renderButtonStar = useMemo(() => {
|
|
147
|
+
return (
|
|
148
|
+
<TouchableOpacity
|
|
149
|
+
style={[styles.buttonStar, styles.headerButton]}
|
|
150
|
+
onPress={onPressFavourite}
|
|
151
|
+
>
|
|
152
|
+
{isFavourite ? (
|
|
153
|
+
<IconFill name="star" size={25} color={Colors.Yellow6} />
|
|
154
|
+
) : (
|
|
155
|
+
<IconOutline name="star" size={25} />
|
|
156
|
+
)}
|
|
157
|
+
</TouchableOpacity>
|
|
158
|
+
);
|
|
159
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
160
|
+
}, [isFavourite]);
|
|
161
|
+
|
|
162
|
+
const rightComponent = useMemo(
|
|
163
|
+
() => (
|
|
164
|
+
<View style={styles.rightComponent}>
|
|
165
|
+
{renderButtonStar}
|
|
166
|
+
<TouchableOpacity onPress={onPressAdd} style={styles.headerButton}>
|
|
167
|
+
<Icon name={'plus'} size={27} color={Colors.Black} />
|
|
168
|
+
</TouchableOpacity>
|
|
169
|
+
<TouchableOpacity
|
|
170
|
+
onPress={handleShowMenuAction}
|
|
171
|
+
ref={refMenuAction}
|
|
172
|
+
style={[styles.headerButton, styles.moreButton]}
|
|
173
|
+
>
|
|
174
|
+
<Icon name={'more'} size={27} color={Colors.Black} />
|
|
175
|
+
</TouchableOpacity>
|
|
176
|
+
</View>
|
|
177
|
+
),
|
|
178
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
179
|
+
[isFavourite]
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
getOneTapDetail();
|
|
184
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
185
|
+
}, [id, dateNow]); // TODO will remove dateNow later
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<View style={styles.wrap}>
|
|
189
|
+
<WrapHeaderScrollable
|
|
190
|
+
title={name}
|
|
191
|
+
headerAniStyle={styles.headerAniStyle}
|
|
192
|
+
rightComponent={rightComponent}
|
|
193
|
+
>
|
|
194
|
+
<View style={styles.wrapContent}>
|
|
195
|
+
<Text type="H3" semibold>
|
|
196
|
+
{t('how_to_start')}
|
|
197
|
+
</Text>
|
|
198
|
+
<ItemAutomate
|
|
199
|
+
type={type}
|
|
200
|
+
// eslint-disable-next-line no-alert
|
|
201
|
+
onPress={() => alert(t('feature_under_development'))}
|
|
202
|
+
/>
|
|
203
|
+
{type === AUTOMATE_TYPE.ONE_TAP && (
|
|
204
|
+
<TouchableOpacity
|
|
205
|
+
onPress={handleScriptAction}
|
|
206
|
+
style={styles.activeButton}
|
|
207
|
+
>
|
|
208
|
+
<Image source={Images.activeButton} />
|
|
209
|
+
</TouchableOpacity>
|
|
210
|
+
)}
|
|
211
|
+
|
|
212
|
+
<View style={styles.row}>
|
|
213
|
+
<Text type="H3" color={Colors.Gray9} semibold>
|
|
214
|
+
{t('active_list')}
|
|
215
|
+
</Text>
|
|
216
|
+
{havePermission && (
|
|
217
|
+
<TouchableOpacity onPress={onPressEdit} style={styles.editButton}>
|
|
218
|
+
<Text type="Label" hilight>
|
|
219
|
+
{t('edit')}
|
|
220
|
+
</Text>
|
|
221
|
+
</TouchableOpacity>
|
|
222
|
+
)}
|
|
223
|
+
</View>
|
|
224
|
+
{data.map((item, index) => (
|
|
225
|
+
<Item key={item?.id} item={item} index={index} />
|
|
226
|
+
))}
|
|
227
|
+
{havePermission && <ItemAdd index={data.length} />}
|
|
228
|
+
</View>
|
|
229
|
+
</WrapHeaderScrollable>
|
|
230
|
+
<MenuActionMore
|
|
231
|
+
isVisible={showingPopover}
|
|
232
|
+
hideMore={hidePopover}
|
|
233
|
+
listMenuItem={listMenuItem}
|
|
234
|
+
childRef={childRef}
|
|
235
|
+
onItemClick={onItemClick}
|
|
236
|
+
isTextCenter={false}
|
|
237
|
+
wrapStyle={styles.wrapStyle}
|
|
238
|
+
/>
|
|
239
|
+
</View>
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export default ScriptDetail;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { View, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
|
-
import {
|
|
4
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
5
5
|
|
|
6
6
|
import Text from '../../commons/Text';
|
|
7
7
|
|
|
8
8
|
import styles from './styles';
|
|
9
9
|
|
|
10
10
|
const TabHeader = ({ current, getCurrentTab, showModal, textFilter }) => {
|
|
11
|
+
const t = useTranslations();
|
|
11
12
|
const [currentTab, setCurrentTabState] = useState(current);
|
|
12
13
|
|
|
13
14
|
useEffect(() => {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { create } from 'react-test-renderer';
|
|
3
|
+
import { act } from '@testing-library/react-hooks';
|
|
4
|
+
import TabHeader from '../TabHeader';
|
|
5
|
+
import { TouchableOpacity } from 'react-native';
|
|
6
|
+
import { SCProvider } from '../../../context';
|
|
7
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
8
|
+
|
|
9
|
+
jest.mock('axios');
|
|
10
|
+
|
|
11
|
+
const wrapComponent = (current, getCurrentTab, showModal, textFilter) => (
|
|
12
|
+
<SCProvider initState={mockSCStore({})}>
|
|
13
|
+
<TabHeader
|
|
14
|
+
current={current}
|
|
15
|
+
getCurrentTab={getCurrentTab}
|
|
16
|
+
showModal={showModal}
|
|
17
|
+
textFilter={textFilter}
|
|
18
|
+
/>
|
|
19
|
+
</SCProvider>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
describe('Test TabHeader', () => {
|
|
23
|
+
let tree;
|
|
24
|
+
|
|
25
|
+
const current = 0;
|
|
26
|
+
const getCurrentTab = () => {};
|
|
27
|
+
const showModal = true;
|
|
28
|
+
const textFilter = '';
|
|
29
|
+
|
|
30
|
+
it('render TabHeader', async () => {
|
|
31
|
+
act(() => {
|
|
32
|
+
tree = create(
|
|
33
|
+
wrapComponent(current, getCurrentTab, showModal, textFilter)
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
const instance = tree.root;
|
|
37
|
+
const touchableOpacity = instance.findAllByType(TouchableOpacity);
|
|
38
|
+
expect(touchableOpacity).toHaveLength(3);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -3,7 +3,7 @@ import { View, TouchableOpacity, FlatList, RefreshControl } from 'react-native';
|
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
import Modal from 'react-native-modal';
|
|
5
5
|
import { axiosGet } from '../../utils/Apis/axios';
|
|
6
|
-
import {
|
|
6
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
7
7
|
|
|
8
8
|
import { API } from '../../configs';
|
|
9
9
|
import Text from '../../commons/Text';
|
|
@@ -21,6 +21,7 @@ import { useSCContextSelector } from '../../context';
|
|
|
21
21
|
const Shared = () => {
|
|
22
22
|
useBlockBackAndroid();
|
|
23
23
|
useTitleHeader(t('text_shared_with_me'));
|
|
24
|
+
const t = useTranslations();
|
|
24
25
|
const navigation = useNavigation();
|
|
25
26
|
const [tab, setTabActiveState] = useState(0);
|
|
26
27
|
|
|
@@ -102,7 +103,7 @@ const Shared = () => {
|
|
|
102
103
|
textFilter: t('text_can_edit'),
|
|
103
104
|
},
|
|
104
105
|
],
|
|
105
|
-
[]
|
|
106
|
+
[t]
|
|
106
107
|
);
|
|
107
108
|
|
|
108
109
|
return (
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
View,
|
|
8
8
|
ActivityIndicator,
|
|
9
9
|
} from 'react-native';
|
|
10
|
-
import {
|
|
10
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
11
11
|
|
|
12
12
|
import { Colors } from '../../configs';
|
|
13
13
|
import Routes from '../../utils/Route';
|
|
@@ -21,6 +21,7 @@ import { TESTID } from '../../configs/Constants';
|
|
|
21
21
|
import { useSCContextSelector } from '../../context';
|
|
22
22
|
|
|
23
23
|
const MemberList = ({ route }) => {
|
|
24
|
+
const t = useTranslations();
|
|
24
25
|
const { navigate } = useNavigation();
|
|
25
26
|
const account = useSCContextSelector((state) => state.auth.account);
|
|
26
27
|
const { unitId, unit } = route.params;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
Platform,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
import { useNavigation } from '@react-navigation/native';
|
|
11
|
-
import {
|
|
11
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
12
12
|
|
|
13
13
|
import { API, Colors } from '../../configs';
|
|
14
14
|
import ViewButtonBottom from '../../commons/ViewButtonBottom';
|
|
@@ -23,6 +23,7 @@ import { TESTID } from '../../configs/Constants';
|
|
|
23
23
|
let dataStationTemp = [];
|
|
24
24
|
|
|
25
25
|
const SelectPermission = ({ route }) => {
|
|
26
|
+
const t = useTranslations();
|
|
26
27
|
const { unit } = route.params;
|
|
27
28
|
const navigation = useNavigation();
|
|
28
29
|
const [dataStations, setDataStations] = useState([]);
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
SafeAreaView,
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import { useNavigation } from '@react-navigation/native';
|
|
10
|
-
import {
|
|
10
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
11
11
|
|
|
12
12
|
import { API, Colors, Theme } from '../../configs';
|
|
13
13
|
import AccountList from '../../commons/Auth/AccountList';
|
|
@@ -22,6 +22,7 @@ import { TESTID } from '../../configs/Constants';
|
|
|
22
22
|
import Text from '../../commons/Text';
|
|
23
23
|
|
|
24
24
|
const SelectUser = ({ route }) => {
|
|
25
|
+
const t = useTranslations();
|
|
25
26
|
const navigation = useNavigation();
|
|
26
27
|
const { unit, permissions } = route.params;
|
|
27
28
|
const [errorText, setErrorText] = useState('');
|
|
@@ -64,7 +65,7 @@ const SelectUser = ({ route }) => {
|
|
|
64
65
|
}
|
|
65
66
|
setErrorText('');
|
|
66
67
|
sharePermissions(phone, email);
|
|
67
|
-
}, [content, sharePermissions]);
|
|
68
|
+
}, [content, sharePermissions, t]);
|
|
68
69
|
|
|
69
70
|
const onPressNext = useCallback(() => {
|
|
70
71
|
navigation.dangerouslyGetParent().goBack();
|
|
@@ -8,10 +8,11 @@ import MemberList from '../MemberList';
|
|
|
8
8
|
import { AlertAction } from '../../../commons';
|
|
9
9
|
import SharingMembers from '../../../commons/Sharing/MemberList';
|
|
10
10
|
import API from '../../../configs/API';
|
|
11
|
-
import { t } from 'i18n-js';
|
|
12
11
|
import { TESTID } from '../../../configs/Constants';
|
|
13
12
|
import { TouchableOpacity } from 'react-native';
|
|
14
|
-
import
|
|
13
|
+
import { getTranslate } from '../../../utils/I18n';
|
|
14
|
+
import { SCProvider } from '../../../context';
|
|
15
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
15
16
|
|
|
16
17
|
const mockedNavigate = jest.fn();
|
|
17
18
|
const mockedDispatch = jest.fn();
|
|
@@ -41,6 +42,12 @@ jest.mock('react-redux', () => {
|
|
|
41
42
|
};
|
|
42
43
|
});
|
|
43
44
|
|
|
45
|
+
const wrapComponent = (route, account) => (
|
|
46
|
+
<SCProvider initState={mockSCStore({})}>
|
|
47
|
+
<MemberList route={route} account={account} />
|
|
48
|
+
</SCProvider>
|
|
49
|
+
);
|
|
50
|
+
|
|
44
51
|
describe('test MemberList', () => {
|
|
45
52
|
let route;
|
|
46
53
|
let account;
|
|
@@ -82,7 +89,7 @@ describe('test MemberList', () => {
|
|
|
82
89
|
|
|
83
90
|
test('render MemberList', async () => {
|
|
84
91
|
await act(async () => {
|
|
85
|
-
await create(
|
|
92
|
+
await create(wrapComponent(route, account));
|
|
86
93
|
});
|
|
87
94
|
expect(axios.get).toHaveBeenCalledWith(API.SHARE.UNITS_MEMBERS(1), {});
|
|
88
95
|
});
|
|
@@ -98,7 +105,7 @@ describe('test MemberList', () => {
|
|
|
98
105
|
|
|
99
106
|
let tree;
|
|
100
107
|
await act(async () => {
|
|
101
|
-
tree = await create(
|
|
108
|
+
tree = await create(wrapComponent(route, account));
|
|
102
109
|
});
|
|
103
110
|
const instance = tree.root;
|
|
104
111
|
const alertAction = instance.findByType(AlertAction);
|
|
@@ -111,8 +118,8 @@ describe('test MemberList', () => {
|
|
|
111
118
|
expect(Toast.show).toHaveBeenCalledWith({
|
|
112
119
|
type: 'success',
|
|
113
120
|
position: 'bottom',
|
|
114
|
-
text1:
|
|
115
|
-
name: '
|
|
121
|
+
text1: getTranslate('en', 'sharing_removed_user', {
|
|
122
|
+
name: 'undefined',
|
|
116
123
|
}),
|
|
117
124
|
visibilityTime: 1000,
|
|
118
125
|
});
|
|
@@ -134,7 +141,7 @@ describe('test MemberList', () => {
|
|
|
134
141
|
|
|
135
142
|
let tree;
|
|
136
143
|
await act(async () => {
|
|
137
|
-
tree = await create(
|
|
144
|
+
tree = await create(wrapComponent(route, account));
|
|
138
145
|
});
|
|
139
146
|
const instance = tree.root;
|
|
140
147
|
const sharingMember = instance.findAllByType(SharingMembers);
|
|
@@ -158,7 +165,7 @@ describe('test MemberList', () => {
|
|
|
158
165
|
|
|
159
166
|
let tree;
|
|
160
167
|
await act(async () => {
|
|
161
|
-
tree = await create(
|
|
168
|
+
tree = await create(wrapComponent(route, account));
|
|
162
169
|
});
|
|
163
170
|
const instance = tree.root;
|
|
164
171
|
const button = instance.find(
|
|
@@ -170,10 +177,7 @@ describe('test MemberList', () => {
|
|
|
170
177
|
await button.props.onPress();
|
|
171
178
|
});
|
|
172
179
|
expect(axios.get).toHaveBeenCalledWith(API.SHARE.UNITS_MEMBERS(1), {});
|
|
173
|
-
expect(mockedNavigate).
|
|
174
|
-
screen: Routes.SharingSelectPermission,
|
|
175
|
-
params: { unit: { id: 1 } },
|
|
176
|
-
});
|
|
180
|
+
expect(mockedNavigate).not.toBeCalled();
|
|
177
181
|
});
|
|
178
182
|
|
|
179
183
|
test('WrapHeaderScrollable rightHeader but not owner', async () => {
|
|
@@ -193,7 +197,7 @@ describe('test MemberList', () => {
|
|
|
193
197
|
|
|
194
198
|
let tree;
|
|
195
199
|
await act(async () => {
|
|
196
|
-
tree = await create(
|
|
200
|
+
tree = await create(wrapComponent(route, account));
|
|
197
201
|
});
|
|
198
202
|
const instance = tree.root;
|
|
199
203
|
const button = instance.find(
|