@eohjsc/react-native-smart-city 0.3.31 → 0.3.32
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/package.json +7 -5
- package/src/commons/Action/ItemQuickAction.js +2 -3
- package/src/commons/Action/__test__/ItemQuickAction.test.js +17 -9
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +6 -6
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +4 -4
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +5 -2
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +10 -4
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +4 -4
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +12 -6
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +8 -4
- package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +4 -6
- package/src/commons/ActionGroup/OneBigButtonTemplate.js +1 -1
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +10 -4
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +25 -9
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/ControlPlay.test.js +13 -7
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/RectangleButton.test.js +9 -5
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/SmartTiviActionTemplate.test.js +25 -9
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +16 -6
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +10 -4
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/RectangleButton.js +7 -3
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate.js +5 -5
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +4 -4
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +7 -7
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +3 -3
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +9 -5
- package/src/commons/ActionGroup/__test__/index.test.js +5 -3
- package/src/commons/AlertAction/index.js +2 -2
- package/src/commons/Auth/AccountItem.js +9 -3
- package/src/commons/Auth/__test__/AccountItem.test.js +6 -3
- package/src/commons/Automate/ItemAutomate.js +13 -3
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/BottomButtonView/index.js +4 -5
- package/src/commons/Button/index.js +0 -2
- package/src/commons/ButtonPopup/index.js +3 -3
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +3 -2
- package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +4 -2
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +6 -3
- package/src/commons/Dashboard/MyUnit/index.js +5 -3
- package/src/commons/Device/ConnectedViewHeader.js +2 -2
- package/src/commons/Device/DeviceAlertStatus.js +2 -2
- package/src/commons/Device/DisconnectedView.js +2 -2
- package/src/commons/Device/Emergency/EmergencyButton.js +2 -2
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +3 -2
- package/src/commons/Device/FlatListItems.js +2 -2
- package/src/commons/Device/ItemAddNew/index.js +7 -12
- package/src/commons/Device/ItemDevice.js +16 -11
- package/src/commons/Device/SensorConnectedStatus.js +5 -2
- package/src/commons/Device/WindDirection/Compass/index.js +5 -2
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +8 -4
- package/src/commons/Device/__test__/FlatListItems.test.js +3 -2
- package/src/commons/Device/__test__/SensorConnectedStatus.test.js +4 -2
- package/src/commons/Explore/ActivityIndicator/index.js +5 -2
- package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +3 -3
- package/src/commons/Explore/SearchBox/index.js +2 -2
- package/src/commons/FieldTemplate/ChooseUserField/ChoosePopup.js +4 -4
- package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +11 -8
- package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -2
- package/src/commons/FieldTemplate/PasscodeField/index.js +2 -2
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +12 -7
- package/src/commons/Form/TextInput.js +2 -2
- package/src/commons/Form/TextInputPassword.js +2 -2
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +5 -3
- package/src/commons/GroupCheckBox/index.js +2 -2
- package/src/commons/HeaderAni/index.js +2 -3
- package/src/commons/MediaPlayerDetail/index.js +2 -2
- package/src/commons/MenuActionList/index.js +2 -2
- package/src/commons/MenuActionMore/index.js +2 -3
- package/src/commons/NavBar/index.js +2 -3
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +11 -5
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +7 -3
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +4 -2
- package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +11 -8
- package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +9 -5
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +5 -3
- package/src/commons/Popover/index.js +2 -13
- package/src/commons/PreventAccess/__test__/PreventAccess.test.js +5 -3
- package/src/commons/PreventAccess/index.js +3 -3
- package/src/commons/{Connecting → Processing}/__test__/Connecting.test.js +5 -4
- package/src/commons/Processing/index.js +93 -0
- package/src/commons/{Connecting → Processing}/styles.js +9 -1
- package/src/commons/SelectGateway/index.js +105 -0
- package/src/commons/SelectGateway/styles.js +55 -0
- package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +106 -0
- package/src/commons/SelectSubUnit/index.js +124 -0
- package/src/commons/SelectSubUnit/styles.js +55 -0
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +120 -0
- package/src/commons/SelectUnit/index.js +106 -0
- package/src/commons/SelectUnit/styles.js +54 -0
- package/src/commons/Sharing/WrapHeaderScrollable.js +2 -2
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +4 -4
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +25 -10
- package/src/commons/SubUnit/OneTap/index.js +9 -4
- package/src/commons/SubUnit/ShortDetail.js +11 -29
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +15 -10
- package/src/commons/SummaryItem/index.js +2 -2
- package/src/commons/Unit/HeaderUnit/index.js +4 -5
- package/src/commons/Unit/SharedUnit.js +10 -8
- package/src/commons/Unit/__test__/HeaderUnit.test.js +13 -5
- package/src/commons/Unit/__test__/SharedUnit.test.js +30 -11
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +13 -8
- package/src/commons/UnitSummary/AirQuality/index.js +7 -3
- package/src/commons/UnitSummary/TotalPowerBox.js +2 -2
- package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -2
- package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +3 -2
- package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +4 -2
- package/src/commons/ViewButtonBottom/index.js +4 -4
- package/src/commons/WheelDateTimePicker/index.js +5 -3
- package/src/commons/WrapParallaxScrollView/index.js +2 -1
- package/src/configs/API.js +6 -14
- package/src/configs/AccessibilityLabel.js +608 -0
- package/src/configs/Constants.js +1 -604
- package/src/context/actionType.ts +7 -3
- package/src/context/mockStore.ts +6 -3
- package/src/context/reducer.ts +23 -8
- package/src/hoc/withRemoteControl.js +1 -0
- package/src/hooks/Common/index.js +2 -2
- package/src/hooks/Common/{useGGHomeDeviceConnected.js → useHomeAssistantDeviceConnected.js} +3 -3
- package/src/hooks/Common/usePopover.js +6 -1
- package/src/hooks/IoT/__test__/{useGGHomeConnection.test.js → useHomeAssistantConnection.test.js} +18 -18
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +17 -12
- package/src/hooks/IoT/index.js +2 -2
- package/src/hooks/IoT/useHomeAssistantConnection.js +91 -0
- package/src/hooks/IoT/useRemoteControl.js +6 -6
- package/src/iot/RemoteControl/{GoogleHome.js → HomeAssistant.js} +21 -17
- package/src/iot/RemoteControl/LG.js +2 -1
- package/src/iot/RemoteControl/__test__/{GoogleHome.test.js → HomeAssistant.test.js} +30 -30
- package/src/navigations/AddDeviceStack.js +0 -14
- package/src/navigations/AddGatewayStack.js +51 -21
- package/src/navigations/Main.js +2 -2
- package/src/navigations/SmartIrStack.js +3 -3
- package/src/navigations/UnitStack.js +1 -1
- package/src/screens/AQIGuide/__test__/AQIGuide.test.js +5 -3
- package/src/screens/AQIGuide/index.js +5 -3
- package/src/screens/ActivityLog/FilterPopup.js +2 -2
- package/src/screens/ActivityLog/__test__/FilterPopup.test.js +2 -2
- package/src/screens/ActivityLog/__test__/index.test.js +3 -2
- package/src/screens/ActivityLog/index.js +3 -3
- package/src/screens/AddCommon/SelectSubUnit.js +44 -191
- package/src/screens/AddCommon/SelectUnit.js +51 -204
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +7 -50
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +28 -26
- package/src/screens/AddLocationMaps/__test__/index.test.js +13 -7
- package/src/screens/AddLocationMaps/index.js +3 -3
- package/src/screens/AddNewAction/Device/index.js +2 -2
- package/src/screens/AddNewAction/SelectAction.js +6 -6
- package/src/screens/AddNewAction/SelectSensorDevices.js +3 -3
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +2 -2
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +8 -3
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +11 -7
- package/src/screens/AddNewAutoSmart/index.js +9 -12
- package/src/screens/AddNewDevice/ConnectingDevices.js +1 -1
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +7 -4
- package/src/screens/AddNewDevice/index.js +4 -4
- package/src/screens/AddNewGateway/ConnectingDevice.js +40 -0
- package/src/screens/AddNewGateway/ConnectingModbusDevice.js +61 -0
- package/src/screens/AddNewGateway/ConnectingWifiDevice.js +70 -0
- package/src/screens/AddNewGateway/ConnectingZigbeeDevice.js +60 -0
- package/src/screens/AddNewGateway/PlugAndPlay/FirstWarning.js +21 -8
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +23 -4
- package/src/screens/AddNewGateway/RenameNewDevices.js +141 -0
- package/src/screens/AddNewGateway/RenameNewDevicesStyles.js +75 -0
- package/src/screens/AddNewGateway/ScanGatewayQR.js +57 -0
- package/src/screens/AddNewGateway/ScanModbusQR.js +53 -0
- package/src/screens/AddNewGateway/ScanWifiDeviceQR.js +55 -0
- package/src/screens/AddNewGateway/SelectDeviceSubUnit.js +31 -0
- package/src/screens/AddNewGateway/SelectDeviceType.js +52 -0
- package/src/screens/AddNewGateway/SelectDeviceUnit.js +29 -0
- package/src/screens/AddNewGateway/SelectModbusGateway.js +34 -0
- package/src/screens/AddNewGateway/SelectZigbeeGateway.js +34 -0
- package/src/screens/AddNewGateway/ShareWifiPassword.js +302 -0
- package/src/screens/AddNewGateway/ShareWifiPasswordStyles.js +44 -0
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -4
- package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +63 -0
- package/src/screens/AddNewGateway/__test__/{SelectGateway.test.js → ConnectingWifiDevice.test.js} +15 -10
- package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +62 -0
- package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +191 -0
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +73 -0
- package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +75 -0
- package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +73 -0
- package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +47 -0
- package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +89 -0
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +48 -0
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +77 -0
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +77 -0
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +294 -0
- package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +1 -1
- package/src/screens/AddNewGateway/index.js +4 -4
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +5 -4
- package/src/screens/AddNewOneTap/index.js +4 -4
- package/src/screens/Automate/__test__/index.test.js +2 -2
- package/src/screens/Automate/index.js +6 -2
- package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +3 -2
- package/src/screens/ConfirmUnitDeletion/index.js +3 -3
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +5 -5
- package/src/screens/Device/EditDevice/index.js +3 -3
- package/src/screens/Device/__test__/detail.test.js +38 -22
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +6 -6
- package/src/screens/Device/components/SensorDisplayItem.js +2 -2
- package/src/screens/Device/detail.js +28 -22
- package/src/screens/Device/hooks/useEvaluateValue.js +0 -2
- package/src/screens/DeviceInfo/__test__/index.test.js +8 -4
- package/src/screens/DeviceInfo/index.js +10 -6
- package/src/screens/Drawer/index.js +21 -9
- package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +8 -4
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -1
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +5 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +9 -5
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +7 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -3
- package/src/screens/EmergencySetting/__test__/DropDownItem.test.js +3 -2
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +6 -3
- package/src/screens/EnterPassword/index.js +5 -3
- package/src/screens/GuestInfo/__test__/index.test.js +18 -12
- package/src/screens/GuestInfo/components/AccessScheduleItem.js +2 -2
- package/src/screens/GuestInfo/components/AccessScheduleSheet.js +3 -3
- package/src/screens/GuestInfo/components/HeaderGuestInfo.js +2 -2
- package/src/screens/GuestInfo/components/RecurringDetail.js +4 -4
- package/src/screens/GuestInfo/components/TemporaryDetail.js +3 -3
- package/src/screens/GuestInfo/index.js +1 -1
- package/src/screens/HanetCamera/Detail.js +10 -4
- package/src/screens/HanetCamera/ManageAccess.js +4 -4
- package/src/screens/HanetCamera/MemberInfo.js +1 -1
- package/src/screens/HanetCamera/__test__/Detail.test.js +5 -3
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +10 -4
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +4 -2
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
- package/src/screens/ManageAccess/index.js +1 -1
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +4 -4
- package/src/screens/MoveToAnotherSubUnit/index.js +2 -2
- package/src/screens/PlayBackCamera/__test__/index.test.js +9 -6
- package/src/screens/PlayBackCamera/index.js +6 -6
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/index.js +10 -3
- package/src/screens/ScriptDetail/__test__/index.test.js +8 -4
- package/src/screens/ScriptDetail/index.js +7 -6
- package/src/screens/SelectUnit/__test__/index.test.js +4 -3
- package/src/screens/SelectUnit/index.js +3 -3
- package/src/screens/SetSchedule/index.js +1 -1
- package/src/screens/Sharing/Components/SensorItem.js +2 -2
- package/src/screens/Sharing/Components/__test__/SensorItem.test.js +4 -2
- package/src/screens/Sharing/InfoMemberUnit.js +7 -6
- package/src/screens/Sharing/MemberList.js +4 -4
- package/src/screens/Sharing/SelectPermission.js +9 -4
- package/src/screens/Sharing/SelectUser.js +9 -5
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +3 -2
- package/src/screens/Sharing/__test__/SelectUser.test.js +7 -4
- package/src/screens/SideMenuDetail/__test__/index.test.js +11 -7
- package/src/screens/SideMenuDetail/index.js +2 -2
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +4 -2
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +5 -5
- package/src/screens/SmartIr/__test__/SmartIr.test.js +14 -6
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +4 -2
- package/src/screens/SmartIr/components/{SelectDeviceType.js → SelectIrDeviceType.js} +2 -2
- package/src/screens/SmartIr/index.js +1 -1
- package/src/screens/SubUnit/AddSubUnit.js +7 -3
- package/src/screens/SubUnit/Detail.js +6 -6
- package/src/screens/SubUnit/EditSubUnit.js +10 -6
- package/src/screens/SubUnit/ManageSubUnit.js +2 -2
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +6 -3
- package/src/screens/SubUnit/__test__/Detail.test.js +5 -3
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +9 -5
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +3 -2
- package/src/screens/SyncLGDevice/AddLGDevice.js +4 -4
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -4
- package/src/screens/TDSGuide/__test__/TDSGuide.test.js +4 -2
- package/src/screens/TDSGuide/index.js +2 -2
- package/src/screens/Template/EditTemplate.js +2 -1
- package/src/screens/Template/__test__/detail.test.js +9 -1
- package/src/screens/Template/index.js +0 -1
- package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +3 -2
- package/src/screens/UVIndexGuide/index.js +2 -2
- package/src/screens/Unit/AddMenu.js +6 -20
- package/src/screens/Unit/ChooseLocation.js +1 -1
- package/src/screens/Unit/Detail.js +10 -10
- package/src/screens/Unit/ManageUnit.js +21 -15
- package/src/screens/Unit/MyAllUnit/index.js +1 -1
- package/src/screens/Unit/SelectAddToFavorites.js +7 -8
- package/src/screens/Unit/SelectAddress.js +4 -4
- package/src/screens/Unit/SmartAccountItem.js +3 -3
- package/src/screens/Unit/Station/__test__/index.test.js +1 -1
- package/src/screens/Unit/Station/index.js +2 -2
- package/src/screens/Unit/Summaries.js +2 -2
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +6 -6
- package/src/screens/Unit/__test__/Detail.test.js +17 -12
- package/src/screens/Unit/__test__/ManageUnit.test.js +40 -18
- package/src/screens/Unit/__test__/SelectAddress.test.js +15 -8
- package/src/screens/Unit/__test__/SmartAccountItem.test.js +4 -3
- package/src/screens/Unit/components/AutomateScript/index.js +5 -2
- package/src/screens/Unit/components/ListMyAllUnit/index.js +1 -1
- package/src/screens/Unit/components/MyAllUnit/__test__/Header.test.js +9 -5
- package/src/screens/Unit/components/MyAllUnit/index.js +1 -1
- package/src/screens/Unit/components/MyUnitDevice/index.js +8 -5
- package/src/screens/Unit/components/SharedUnit/index.js +12 -6
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +24 -9
- package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +25 -11
- package/src/screens/UnitSummary/__test__/index.test.js +4 -2
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +4 -2
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +4 -2
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +5 -4
- package/src/screens/UnitSummary/components/RunningDevices/index.js +6 -3
- package/src/screens/UnitSummary/components/TotalPowerBox/index.js +2 -2
- package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/__test__/TotalPowerBox.test.js +3 -2
- package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +4 -2
- package/src/screens/UnitSummary/index.js +10 -8
- package/src/screens/WaterQualityGuide/__test__/index.test.js +17 -12
- package/src/screens/WaterQualityGuide/index.js +26 -10
- package/src/utils/Apis/axios.js +1 -0
- package/src/utils/I18n/translations/en.json +9 -9
- package/src/utils/I18n/translations/vi.json +8 -8
- package/src/utils/Route/index.js +16 -10
- package/src/commons/Connecting/index.js +0 -67
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +0 -28
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +0 -41
- package/src/commons/ConnectingProcess/__test__/Connecting.test.js +0 -163
- package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +0 -19
- package/src/commons/ConnectingProcess/index.js +0 -213
- package/src/commons/ConnectingProcess/styles.js +0 -69
- package/src/hooks/IoT/useGGHomeConnection.js +0 -91
- package/src/iot/RemoteControl/index.js +0 -55
- package/src/screens/AddNewDevice/ConnectDevices.js +0 -184
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +0 -131
- package/src/screens/AddNewGateway/ConnectedGateway.js +0 -139
- package/src/screens/AddNewGateway/ConnectingGateway.js +0 -137
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +0 -214
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +0 -319
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +0 -75
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +0 -130
- package/src/screens/AddNewGateway/SelectGateway.js +0 -133
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +0 -207
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +0 -71
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +0 -96
- package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +0 -120
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +0 -115
- package/src/screens/ScanChipQR/hooks/index.js +0 -120
- package/src/screens/ScanChipQR/index.js +0 -29
- package/src/screens/ScanSensorQR/__test__/ScanSensorQR.test.js +0 -111
- package/src/screens/ScanSensorQR/hooks/index.js +0 -40
- package/src/screens/ScanSensorQR/index.js +0 -39
|
@@ -5,7 +5,7 @@ import MockAdapter from 'axios-mock-adapter';
|
|
|
5
5
|
|
|
6
6
|
import AddCommonSelectUnit from '../SelectUnit';
|
|
7
7
|
import Text from '../../../commons/Text';
|
|
8
|
-
import {
|
|
8
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
9
9
|
import { SCProvider } from '../../../context';
|
|
10
10
|
import { mockSCStore } from '../../../context/mockStore';
|
|
11
11
|
import api from '../../../utils/Apis/axios';
|
|
@@ -37,14 +37,7 @@ describe('Test SelectUnit container', () => {
|
|
|
37
37
|
mockedGoBack.mockClear();
|
|
38
38
|
});
|
|
39
39
|
let tree;
|
|
40
|
-
const list_type = [
|
|
41
|
-
'AddSubUnit',
|
|
42
|
-
'AddDevice',
|
|
43
|
-
'AddMember',
|
|
44
|
-
'AddLGDevice',
|
|
45
|
-
'',
|
|
46
|
-
'AddDeviceNewFlow',
|
|
47
|
-
];
|
|
40
|
+
const list_type = ['AddSubUnit', 'AddDevice', 'AddMember', 'AddLGDevice', ''];
|
|
48
41
|
const result = [
|
|
49
42
|
'Add new sub-unit',
|
|
50
43
|
'Add new device',
|
|
@@ -95,7 +88,10 @@ describe('Test SelectUnit container', () => {
|
|
|
95
88
|
|
|
96
89
|
const instance = tree.root;
|
|
97
90
|
const selectUnit = instance.findAll(
|
|
98
|
-
(item) =>
|
|
91
|
+
(item) =>
|
|
92
|
+
item.props.accessibilityLabel?.indexOf(
|
|
93
|
+
AccessibilityLabel.SELECT_UNIT_SELECT
|
|
94
|
+
) === 0
|
|
99
95
|
);
|
|
100
96
|
await act(async () => {
|
|
101
97
|
selectUnit[0].props.onPress();
|
|
@@ -103,8 +99,8 @@ describe('Test SelectUnit container', () => {
|
|
|
103
99
|
|
|
104
100
|
const next = instance.find(
|
|
105
101
|
(item) =>
|
|
106
|
-
item.props.
|
|
107
|
-
`${
|
|
102
|
+
item.props.accessibilityLabel ===
|
|
103
|
+
`${AccessibilityLabel.PREFIX.SELECT_UNIT}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
|
|
108
104
|
);
|
|
109
105
|
|
|
110
106
|
await act(async () => {
|
|
@@ -132,13 +128,6 @@ describe('Test SelectUnit container', () => {
|
|
|
132
128
|
unit_id: 1,
|
|
133
129
|
});
|
|
134
130
|
break;
|
|
135
|
-
case 'AddDeviceNewFlow':
|
|
136
|
-
expect(mockedNavigate).toBeCalledWith('AddGatewaySelectGateway', {
|
|
137
|
-
unit_id: 1,
|
|
138
|
-
addType: 'AddDeviceNewFlow',
|
|
139
|
-
scan_sensor_data: undefined,
|
|
140
|
-
});
|
|
141
|
-
break;
|
|
142
131
|
default:
|
|
143
132
|
break;
|
|
144
133
|
}
|
|
@@ -167,17 +156,25 @@ describe('test single SelectUnit', () => {
|
|
|
167
156
|
const instance = tree.root;
|
|
168
157
|
const unitName = instance.findAll(
|
|
169
158
|
(item) =>
|
|
170
|
-
item.props.
|
|
159
|
+
item.props.accessibilityLabel?.indexOf(
|
|
160
|
+
AccessibilityLabel.SELECT_UNIT_NAME
|
|
161
|
+
) === 0 && item.type === Text
|
|
171
162
|
);
|
|
172
163
|
const radioButton = instance.findAll(
|
|
173
|
-
(item) =>
|
|
164
|
+
(item) =>
|
|
165
|
+
item.props.accessibilityLabel?.indexOf(
|
|
166
|
+
AccessibilityLabel.SELECT_UNIT_RADIO_BUTTON
|
|
167
|
+
) === 0
|
|
174
168
|
);
|
|
175
169
|
expect(unitName[0].props.children).toBe('Unit 1');
|
|
176
170
|
expect(unitName[1].props.children).toBe('Unit 2');
|
|
177
171
|
expect(radioButton[0].props.active).toBeFalsy();
|
|
178
172
|
expect(radioButton[1].props.active).toBeFalsy();
|
|
179
173
|
const selectUnit = instance.findAll(
|
|
180
|
-
(item) =>
|
|
174
|
+
(item) =>
|
|
175
|
+
item.props.accessibilityLabel?.indexOf(
|
|
176
|
+
AccessibilityLabel.SELECT_UNIT_SELECT
|
|
177
|
+
) === 0
|
|
181
178
|
);
|
|
182
179
|
await act(async () => {
|
|
183
180
|
selectUnit[0].props.onPress();
|
|
@@ -196,10 +193,15 @@ describe('test single SelectUnit', () => {
|
|
|
196
193
|
const instance = tree.root;
|
|
197
194
|
const unitName = instance.findAll(
|
|
198
195
|
(item) =>
|
|
199
|
-
item.props.
|
|
196
|
+
item.props.accessibilityLabel?.indexOf(
|
|
197
|
+
AccessibilityLabel.SELECT_UNIT_NAME
|
|
198
|
+
) === 0 && item.type === Text
|
|
200
199
|
);
|
|
201
200
|
const radioButton = instance.findAll(
|
|
202
|
-
(item) =>
|
|
201
|
+
(item) =>
|
|
202
|
+
item.props.accessibilityLabel?.indexOf(
|
|
203
|
+
AccessibilityLabel.SELECT_UNIT_RADIO_BUTTON
|
|
204
|
+
) === 0
|
|
203
205
|
);
|
|
204
206
|
expect(unitName).toHaveLength(2);
|
|
205
207
|
expect(radioButton).toHaveLength(2);
|
|
@@ -214,8 +216,8 @@ describe('test single SelectUnit', () => {
|
|
|
214
216
|
const instance = tree.root;
|
|
215
217
|
const goBack = instance.find(
|
|
216
218
|
(item) =>
|
|
217
|
-
item.props.
|
|
218
|
-
`${
|
|
219
|
+
item.props.accessibilityLabel ===
|
|
220
|
+
`${AccessibilityLabel.PREFIX.SELECT_UNIT}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_LEFT_BUTTON}`
|
|
219
221
|
);
|
|
220
222
|
|
|
221
223
|
await act(async () => {
|
|
@@ -9,7 +9,7 @@ import { SCProvider } from '../../../context';
|
|
|
9
9
|
import { mockSCStore } from '../../../context/mockStore';
|
|
10
10
|
import AddLocationMaps from '../index';
|
|
11
11
|
import { API } from '../../../configs';
|
|
12
|
-
import {
|
|
12
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
13
13
|
import api from '../../../utils/Apis/axios';
|
|
14
14
|
import {
|
|
15
15
|
GEOLOCATION_ERROR,
|
|
@@ -108,7 +108,8 @@ describe('Test SelectAddress', () => {
|
|
|
108
108
|
});
|
|
109
109
|
const instance = tree.root;
|
|
110
110
|
const button = instance.find(
|
|
111
|
-
(el) =>
|
|
111
|
+
(el) =>
|
|
112
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
|
|
112
113
|
);
|
|
113
114
|
|
|
114
115
|
const response = {
|
|
@@ -141,7 +142,8 @@ describe('Test SelectAddress', () => {
|
|
|
141
142
|
});
|
|
142
143
|
const instance = tree.root;
|
|
143
144
|
const button = instance.find(
|
|
144
|
-
(el) =>
|
|
145
|
+
(el) =>
|
|
146
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
|
|
145
147
|
);
|
|
146
148
|
|
|
147
149
|
global.navigator.geolocation = {
|
|
@@ -165,7 +167,8 @@ describe('Test SelectAddress', () => {
|
|
|
165
167
|
});
|
|
166
168
|
const instance = tree.root;
|
|
167
169
|
const button = instance.find(
|
|
168
|
-
(el) =>
|
|
170
|
+
(el) =>
|
|
171
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
|
|
169
172
|
);
|
|
170
173
|
|
|
171
174
|
global.navigator.geolocation = {
|
|
@@ -210,7 +213,8 @@ describe('Test SelectAddress', () => {
|
|
|
210
213
|
});
|
|
211
214
|
const instance = tree.root;
|
|
212
215
|
const button = instance.find(
|
|
213
|
-
(el) =>
|
|
216
|
+
(el) =>
|
|
217
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
|
|
214
218
|
);
|
|
215
219
|
|
|
216
220
|
global.navigator.geolocation = {
|
|
@@ -231,7 +235,8 @@ describe('Test SelectAddress', () => {
|
|
|
231
235
|
});
|
|
232
236
|
const instance = tree.root;
|
|
233
237
|
const button = instance.find(
|
|
234
|
-
(el) =>
|
|
238
|
+
(el) =>
|
|
239
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
|
|
235
240
|
);
|
|
236
241
|
|
|
237
242
|
global.navigator.geolocation = {
|
|
@@ -255,7 +260,8 @@ describe('Test SelectAddress', () => {
|
|
|
255
260
|
});
|
|
256
261
|
const instance = tree.root;
|
|
257
262
|
const button = instance.find(
|
|
258
|
-
(el) =>
|
|
263
|
+
(el) =>
|
|
264
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_CHOOSE_ON_MAP
|
|
259
265
|
);
|
|
260
266
|
await act(async () => {
|
|
261
267
|
await button.props.onPress();
|
|
@@ -13,7 +13,7 @@ import RowLocation from '../../commons/SearchLocation/RowLocation';
|
|
|
13
13
|
import { axiosGet } from '../../utils/Apis/axios';
|
|
14
14
|
import { API, Colors, SCConfig } from '../../configs';
|
|
15
15
|
import {
|
|
16
|
-
|
|
16
|
+
AccessibilityLabel,
|
|
17
17
|
MAP_INITIAL_REGION,
|
|
18
18
|
EOH_LOCATION,
|
|
19
19
|
} from '../../configs/Constants';
|
|
@@ -203,7 +203,7 @@ const AddLocationMaps = memo(() => {
|
|
|
203
203
|
<TouchableOpacity
|
|
204
204
|
onPress={getCurrentPosition}
|
|
205
205
|
style={styles.button}
|
|
206
|
-
|
|
206
|
+
accessibilityLabel={AccessibilityLabel.BUTTON_YOUR_LOCATION}
|
|
207
207
|
>
|
|
208
208
|
<IconOutline name="aim" size={27} color={Colors.Primary} />
|
|
209
209
|
<Text
|
|
@@ -219,7 +219,7 @@ const AddLocationMaps = memo(() => {
|
|
|
219
219
|
<TouchableOpacity
|
|
220
220
|
onPress={chooseOnMap}
|
|
221
221
|
style={styles.button}
|
|
222
|
-
|
|
222
|
+
accessibilityLabel={AccessibilityLabel.BUTTON_CHOOSE_ON_MAP}
|
|
223
223
|
>
|
|
224
224
|
<IconFill
|
|
225
225
|
name="environment"
|
|
@@ -3,7 +3,7 @@ import { TouchableWithoutFeedback, View } from 'react-native';
|
|
|
3
3
|
import { Colors } from '../../../configs';
|
|
4
4
|
import Text from '../../../commons/Text';
|
|
5
5
|
import IconComponent from '../../../commons/IconComponent';
|
|
6
|
-
import {
|
|
6
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
7
7
|
import styles from './DeviceStyles';
|
|
8
8
|
|
|
9
9
|
const Device = memo(({ svgMain, sensor, title, isSelectDevice, onPress }) => {
|
|
@@ -16,7 +16,7 @@ const Device = memo(({ svgMain, sensor, title, isSelectDevice, onPress }) => {
|
|
|
16
16
|
return (
|
|
17
17
|
<TouchableWithoutFeedback
|
|
18
18
|
onPress={onPressDevice}
|
|
19
|
-
accessibilityLabel={`${
|
|
19
|
+
accessibilityLabel={`${AccessibilityLabel.TOUCHABLE_ACTION_ADD_ITEM_FAVORITE}-${sensor.id}`}
|
|
20
20
|
>
|
|
21
21
|
<View style={[styles.container, isActive]}>
|
|
22
22
|
<View style={styles.boxIcon}>
|
|
@@ -15,7 +15,7 @@ import { API, Images } from '../../configs';
|
|
|
15
15
|
import {
|
|
16
16
|
CONDITION_TYPES,
|
|
17
17
|
STATE_VALUE_SENSOR_TYPES,
|
|
18
|
-
|
|
18
|
+
AccessibilityLabel,
|
|
19
19
|
} from '../../configs/Constants';
|
|
20
20
|
import Routes from '../../utils/Route';
|
|
21
21
|
import styles from './Styles/SelectActionStyles';
|
|
@@ -42,7 +42,7 @@ const SelectAction = memo(({ route }) => {
|
|
|
42
42
|
isCreateNewAction,
|
|
43
43
|
isMultiUnits,
|
|
44
44
|
oldType,
|
|
45
|
-
} = route
|
|
45
|
+
} = route?.params || {};
|
|
46
46
|
const [data, setData] = useState([]);
|
|
47
47
|
const [actions, setActions] = useState([]);
|
|
48
48
|
const [sensorData, setSensorData] = useState([]);
|
|
@@ -319,9 +319,9 @@ const SelectAction = memo(({ route }) => {
|
|
|
319
319
|
const isNumberValue = !stateConditionData;
|
|
320
320
|
|
|
321
321
|
if (isNumberValue) {
|
|
322
|
-
return `${item?.name} ${
|
|
323
|
-
item?.
|
|
324
|
-
} ${item?.
|
|
322
|
+
return `${item?.name} ${item.title || t('is_below') + ' (<)'} ${
|
|
323
|
+
item?.value
|
|
324
|
+
} ${item?.unit || ''}`;
|
|
325
325
|
}
|
|
326
326
|
return t(stateConditionData?.stateValue[item?.value]);
|
|
327
327
|
},
|
|
@@ -411,7 +411,7 @@ const SelectAction = memo(({ route }) => {
|
|
|
411
411
|
<RenderActionItem
|
|
412
412
|
data={data}
|
|
413
413
|
onSelectAction={handleOnSelectAction}
|
|
414
|
-
|
|
414
|
+
accessibilityLabel={AccessibilityLabel.ACTION_ITEM}
|
|
415
415
|
/>
|
|
416
416
|
)}
|
|
417
417
|
{data?.length === 0 && sensorData?.length === 0 && !isfetched && (
|
|
@@ -12,7 +12,7 @@ import BottomButtonView from '../../commons/BottomButtonView';
|
|
|
12
12
|
import { HeaderCustom } from '../../commons/Header';
|
|
13
13
|
import Routes from '../../utils/Route';
|
|
14
14
|
import styles from './Styles/SelectSensorDevicesStyles';
|
|
15
|
-
import { AUTOMATE_SELECT,
|
|
15
|
+
import { AUTOMATE_SELECT, AccessibilityLabel } from '../../configs/Constants';
|
|
16
16
|
import { popAction } from '../../navigations/utils';
|
|
17
17
|
import { Icon } from '@ant-design/react-native';
|
|
18
18
|
|
|
@@ -29,7 +29,7 @@ const SelectSensorDevices = memo(({ route }) => {
|
|
|
29
29
|
isCreateNewAction,
|
|
30
30
|
isMultiUnits,
|
|
31
31
|
oldType,
|
|
32
|
-
} = route
|
|
32
|
+
} = route?.params || {};
|
|
33
33
|
|
|
34
34
|
const [listStation, setListStation] = useState([]);
|
|
35
35
|
const [listMenuItem, setListMenuItem] = useState([]);
|
|
@@ -159,7 +159,7 @@ const SelectSensorDevices = memo(({ route }) => {
|
|
|
159
159
|
<TouchableOpacity
|
|
160
160
|
style={styles.buttonClose}
|
|
161
161
|
onPress={onPressClose}
|
|
162
|
-
|
|
162
|
+
accessibilityLabel={AccessibilityLabel.ICON_CLOSE}
|
|
163
163
|
>
|
|
164
164
|
<Icon name={'close'} size={24} color={Colors.Black} />
|
|
165
165
|
</TouchableOpacity>
|
|
@@ -6,7 +6,7 @@ import SelectAction from '../SelectAction';
|
|
|
6
6
|
import { SCProvider } from '../../../context';
|
|
7
7
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
8
|
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
9
|
-
import {
|
|
9
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
10
10
|
import api from '../../../utils/Apis/axios';
|
|
11
11
|
import { API } from '../../../configs';
|
|
12
12
|
|
|
@@ -172,7 +172,7 @@ describe('Test SelectAction', () => {
|
|
|
172
172
|
});
|
|
173
173
|
const instance = tree.root;
|
|
174
174
|
const renderActionItem = instance.find(
|
|
175
|
-
(el) => el.props.
|
|
175
|
+
(el) => el.props.accessibilityLabel === AccessibilityLabel.ACTION_ITEM
|
|
176
176
|
);
|
|
177
177
|
expect(renderActionItem.props.data.length).toBe(4);
|
|
178
178
|
});
|
|
@@ -9,7 +9,10 @@ import Device from '../Device';
|
|
|
9
9
|
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
10
10
|
import NavBar from '../../../commons/NavBar';
|
|
11
11
|
import API from '../../../configs/API';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
AUTOMATE_SELECT,
|
|
14
|
+
AccessibilityLabel,
|
|
15
|
+
} from '../../../configs/Constants';
|
|
13
16
|
import { TouchableOpacity } from 'react-native';
|
|
14
17
|
import Routes from '../../../utils/Route';
|
|
15
18
|
import api from '../../../utils/Apis/axios';
|
|
@@ -137,7 +140,8 @@ describe('Test SelectSensorDevices', () => {
|
|
|
137
140
|
const instance = tree.root;
|
|
138
141
|
const iconClose = instance.findAll(
|
|
139
142
|
(el) =>
|
|
140
|
-
el.props.
|
|
143
|
+
el.props.accessibilityLabel === AccessibilityLabel.ICON_CLOSE &&
|
|
144
|
+
el.type === TouchableOpacity
|
|
141
145
|
);
|
|
142
146
|
expect(iconClose).toHaveLength(1);
|
|
143
147
|
|
|
@@ -172,7 +176,8 @@ describe('Test SelectSensorDevices', () => {
|
|
|
172
176
|
const instance = tree.root;
|
|
173
177
|
const iconClose = instance.findAll(
|
|
174
178
|
(el) =>
|
|
175
|
-
el.props.
|
|
179
|
+
el.props.accessibilityLabel === AccessibilityLabel.ICON_CLOSE &&
|
|
180
|
+
el.type === TouchableOpacity
|
|
176
181
|
);
|
|
177
182
|
expect(iconClose).toHaveLength(1);
|
|
178
183
|
await act(async () => {
|
|
@@ -3,9 +3,10 @@ import { act, create } from 'react-test-renderer';
|
|
|
3
3
|
import AddNewAutoSmart from '..';
|
|
4
4
|
import { SCProvider } from '../../../context';
|
|
5
5
|
import { mockSCStore } from '../../../context/mockStore';
|
|
6
|
-
import { AUTOMATE_TYPE,
|
|
6
|
+
import { AUTOMATE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
|
|
7
7
|
import ItemAutomate from '../../../commons/Automate/ItemAutomate';
|
|
8
8
|
import Routes from '../../../utils/Route';
|
|
9
|
+
import { TouchableOpacity } from 'react-native';
|
|
9
10
|
|
|
10
11
|
const wrapComponent = (route) => (
|
|
11
12
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -51,16 +52,19 @@ describe('test AddNewAutoSmart', () => {
|
|
|
51
52
|
const items = instance.findAllByType(ItemAutomate);
|
|
52
53
|
expect(items).toHaveLength(3);
|
|
53
54
|
|
|
55
|
+
const touchItem = items[0].findByType(TouchableOpacity);
|
|
56
|
+
|
|
54
57
|
await act(async () => {
|
|
55
|
-
await
|
|
58
|
+
await touchItem.props.onPress();
|
|
56
59
|
});
|
|
57
60
|
|
|
58
61
|
const bottomButton = instance.find(
|
|
59
62
|
(item) =>
|
|
60
|
-
item.props.
|
|
61
|
-
`${
|
|
63
|
+
item.props.accessibilityLabel ===
|
|
64
|
+
`${AccessibilityLabel.PREFIX.BUTTON_ADD_AUTO_SMART}${AccessibilityLabel.BOTTOM_VIEW_MAIN}`
|
|
62
65
|
);
|
|
63
66
|
expect(bottomButton).toBeDefined();
|
|
67
|
+
|
|
64
68
|
await act(async () => {
|
|
65
69
|
await bottomButton.props.onPress();
|
|
66
70
|
});
|
|
@@ -87,14 +91,14 @@ describe('test AddNewAutoSmart', () => {
|
|
|
87
91
|
const items = instance.findAllByType(ItemAutomate);
|
|
88
92
|
|
|
89
93
|
await act(async () => {
|
|
90
|
-
await items[1].props.onPress();
|
|
94
|
+
await items[1].findByType(TouchableOpacity).props.onPress();
|
|
91
95
|
});
|
|
92
96
|
expect(items[1].props.isSelected).toBeTruthy();
|
|
93
97
|
|
|
94
98
|
const bottomButton = instance.find(
|
|
95
99
|
(item) =>
|
|
96
|
-
item.props.
|
|
97
|
-
`${
|
|
100
|
+
item.props.accessibilityLabel ===
|
|
101
|
+
`${AccessibilityLabel.PREFIX.BUTTON_ADD_AUTO_SMART}${AccessibilityLabel.BOTTOM_VIEW_MAIN}`
|
|
98
102
|
);
|
|
99
103
|
await act(async () => {
|
|
100
104
|
await bottomButton.props.onPress();
|
|
@@ -9,7 +9,7 @@ import ItemAutomate from '../../commons/Automate/ItemAutomate';
|
|
|
9
9
|
import {
|
|
10
10
|
AUTOMATE_SELECT,
|
|
11
11
|
AUTOMATE_TYPE,
|
|
12
|
-
|
|
12
|
+
AccessibilityLabel,
|
|
13
13
|
} from '../../configs/Constants';
|
|
14
14
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
15
15
|
import Routes from '../../utils/Route';
|
|
@@ -24,7 +24,7 @@ const AddNewAutoSmart = memo(({ route }) => {
|
|
|
24
24
|
isMultiUnits,
|
|
25
25
|
automate = {},
|
|
26
26
|
scriptName,
|
|
27
|
-
} = route
|
|
27
|
+
} = route?.params || {};
|
|
28
28
|
|
|
29
29
|
const typeAutoSmart = {
|
|
30
30
|
[AUTOMATE_TYPE.AUTOMATE]: [
|
|
@@ -122,14 +122,6 @@ const AddNewAutoSmart = memo(({ route }) => {
|
|
|
122
122
|
navigate,
|
|
123
123
|
]);
|
|
124
124
|
|
|
125
|
-
const handleSelectIndex = (index) => {
|
|
126
|
-
if (index !== selectedIndex) {
|
|
127
|
-
setSelectedIndex(index);
|
|
128
|
-
} else {
|
|
129
|
-
setSelectedIndex(-1);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
|
|
133
125
|
const onClose = useCallback(() => {
|
|
134
126
|
goBack();
|
|
135
127
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -151,13 +143,18 @@ const AddNewAutoSmart = memo(({ route }) => {
|
|
|
151
143
|
<ItemAutomate
|
|
152
144
|
type={item.type}
|
|
153
145
|
isSelected={selectedIndex === index}
|
|
154
|
-
|
|
146
|
+
key={item?.id?.toString()}
|
|
147
|
+
index={index}
|
|
148
|
+
selectedIndex={selectedIndex}
|
|
149
|
+
setSelectedIndex={setSelectedIndex}
|
|
155
150
|
/>
|
|
156
151
|
))}
|
|
157
152
|
</View>
|
|
158
153
|
</View>
|
|
159
154
|
<BottomButtonView
|
|
160
|
-
|
|
155
|
+
accessibilityLabelPrefix={
|
|
156
|
+
AccessibilityLabel.PREFIX.BUTTON_ADD_AUTO_SMART
|
|
157
|
+
}
|
|
161
158
|
onPressMain={handleOnContinue}
|
|
162
159
|
style={styles.bottomButton}
|
|
163
160
|
mainTitle={t('continue')}
|
|
@@ -12,7 +12,7 @@ import Routes from '../../utils/Route';
|
|
|
12
12
|
const ConnectingDevices = memo(({ route }) => {
|
|
13
13
|
const t = useTranslations();
|
|
14
14
|
const { navigate } = useNavigation();
|
|
15
|
-
const { new_sensor } = route
|
|
15
|
+
const { new_sensor } = route?.params || {};
|
|
16
16
|
|
|
17
17
|
useEffect(() => {
|
|
18
18
|
const checkSensorConnected = setInterval(async () => {
|
|
@@ -4,7 +4,7 @@ import MockAdapter from 'axios-mock-adapter';
|
|
|
4
4
|
|
|
5
5
|
import AddNewDevice from '../index';
|
|
6
6
|
import GroupCheckBox from '../../../commons/GroupCheckBox';
|
|
7
|
-
import {
|
|
7
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
8
8
|
import API from '../../../configs/API';
|
|
9
9
|
import { ViewButtonBottom } from '../../../commons';
|
|
10
10
|
import Routes from '../../../utils/Route';
|
|
@@ -57,7 +57,7 @@ describe('Test AddNewDevice', () => {
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
const getText = (instance, id) => {
|
|
60
|
-
return instance.find((el) => el.props.
|
|
60
|
+
return instance.find((el) => el.props.accessibilityLabel === id);
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
test('create', async () => {
|
|
@@ -65,8 +65,11 @@ describe('Test AddNewDevice', () => {
|
|
|
65
65
|
tree = await create(wrapComponent(route));
|
|
66
66
|
});
|
|
67
67
|
const instance = tree.root;
|
|
68
|
-
const textAdd = getText(instance,
|
|
69
|
-
const textThen = getText(
|
|
68
|
+
const textAdd = getText(instance, AccessibilityLabel.ADD_NEW_DEVICE_ADD);
|
|
69
|
+
const textThen = getText(
|
|
70
|
+
instance,
|
|
71
|
+
AccessibilityLabel.ADD_NEW_DEVICE_THEN_SELECT
|
|
72
|
+
);
|
|
70
73
|
expect(textAdd.props.children).toEqual(
|
|
71
74
|
getTranslate('en', 'add_new_device')
|
|
72
75
|
);
|
|
@@ -15,11 +15,11 @@ import Text from '../../commons/Text';
|
|
|
15
15
|
import GroupCheckBox from '../../commons/GroupCheckBox';
|
|
16
16
|
import { axiosGet } from '../../utils/Apis/axios';
|
|
17
17
|
import Routes from '../../utils/Route';
|
|
18
|
-
import {
|
|
18
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
19
19
|
|
|
20
20
|
const AddNewDevice = memo(({ route }) => {
|
|
21
21
|
const t = useTranslations();
|
|
22
|
-
const { unit_id } = route
|
|
22
|
+
const { unit_id } = route?.params || {};
|
|
23
23
|
const { navigate, goBack } = useNavigation();
|
|
24
24
|
const [unit, setUnit] = useState({ stations: [] });
|
|
25
25
|
const [stationId, setStationId] = useState(-1);
|
|
@@ -70,7 +70,7 @@ const AddNewDevice = memo(({ route }) => {
|
|
|
70
70
|
}
|
|
71
71
|
>
|
|
72
72
|
<Text
|
|
73
|
-
|
|
73
|
+
accessibilityLabel={AccessibilityLabel.ADD_NEW_DEVICE_ADD}
|
|
74
74
|
semibold
|
|
75
75
|
size={20}
|
|
76
76
|
color={Colors.Black}
|
|
@@ -79,7 +79,7 @@ const AddNewDevice = memo(({ route }) => {
|
|
|
79
79
|
{t('add_new_device')}
|
|
80
80
|
</Text>
|
|
81
81
|
<Text
|
|
82
|
-
|
|
82
|
+
accessibilityLabel={AccessibilityLabel.ADD_NEW_DEVICE_THEN_SELECT}
|
|
83
83
|
size={14}
|
|
84
84
|
color={Colors.Gray8}
|
|
85
85
|
style={styles.txtNote}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native';
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
3
|
+
import Processing from '../../commons/Processing';
|
|
4
|
+
import Routes from '../../utils/Route';
|
|
5
|
+
|
|
6
|
+
const ConnectingDevice = ({
|
|
7
|
+
title,
|
|
8
|
+
fail,
|
|
9
|
+
initState,
|
|
10
|
+
onReady,
|
|
11
|
+
unitId,
|
|
12
|
+
stationId,
|
|
13
|
+
chipId,
|
|
14
|
+
sensorId,
|
|
15
|
+
}) => {
|
|
16
|
+
const { navigate } = useNavigation();
|
|
17
|
+
|
|
18
|
+
const complete = useCallback(
|
|
19
|
+
(deviceInfo) => {
|
|
20
|
+
navigate(Routes.RenameNewDevices, {
|
|
21
|
+
unitId,
|
|
22
|
+
stationId,
|
|
23
|
+
chipId,
|
|
24
|
+
sensorId,
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
[chipId, navigate, sensorId, stationId, unitId]
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Processing
|
|
32
|
+
title={title}
|
|
33
|
+
initState={initState}
|
|
34
|
+
fail={fail}
|
|
35
|
+
complete={complete}
|
|
36
|
+
onReady={onReady}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
export default ConnectingDevice;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native';
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
3
|
+
import { Alert } from 'react-native';
|
|
4
|
+
import API from '../../configs/API';
|
|
5
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
6
|
+
import { axiosPost } from '../../utils/Apis/axios';
|
|
7
|
+
import ConnectingDevice from './ConnectingDevice';
|
|
8
|
+
|
|
9
|
+
const ConnectingModbusDevice = ({ route }) => {
|
|
10
|
+
const t = useTranslations();
|
|
11
|
+
const { unitId, stationId, chipId, qrData } = route?.params || {};
|
|
12
|
+
const [sensorId, setSensorId] = useState(null);
|
|
13
|
+
const { goBack } = useNavigation();
|
|
14
|
+
|
|
15
|
+
const addingModbusDeviceFail = useCallback(
|
|
16
|
+
(message) => {
|
|
17
|
+
Alert.alert(t('fail_add_modbus_device'), message, [
|
|
18
|
+
{
|
|
19
|
+
text: t('ok'),
|
|
20
|
+
onPress: goBack,
|
|
21
|
+
},
|
|
22
|
+
]);
|
|
23
|
+
},
|
|
24
|
+
[goBack, t]
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const onReady = useCallback(
|
|
28
|
+
async (channelName) => {
|
|
29
|
+
const { success, problem, data } = await axiosPost(
|
|
30
|
+
API.CHIP.SCAN_SENSOR(chipId),
|
|
31
|
+
{
|
|
32
|
+
imei: qrData.imei,
|
|
33
|
+
unit: unitId,
|
|
34
|
+
station: stationId,
|
|
35
|
+
channel_name: channelName,
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
if (!success) {
|
|
40
|
+
addingModbusDeviceFail(JSON.stringify(problem || data));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
setSensorId(data.id);
|
|
44
|
+
},
|
|
45
|
+
[chipId, addingModbusDeviceFail, qrData, stationId, unitId]
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<ConnectingDevice
|
|
50
|
+
title={t('connecting_modbus_device')}
|
|
51
|
+
initState={t('connecting_to_gateway')}
|
|
52
|
+
onReady={onReady}
|
|
53
|
+
fail={addingModbusDeviceFail}
|
|
54
|
+
unitId={unitId}
|
|
55
|
+
stationId={stationId}
|
|
56
|
+
chipId={chipId}
|
|
57
|
+
sensorId={sensorId}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
export default ConnectingModbusDevice;
|