@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
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState
|
|
2
|
-
import {
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { useNavigation } from '@react-navigation/native';
|
|
3
3
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
|
-
import { SafeAreaView, ScrollView, TouchableOpacity, View } from 'react-native';
|
|
5
|
-
|
|
6
|
-
import { API } from '../../configs';
|
|
7
|
-
import { Section, RadioCircle, ViewButtonBottom } from '../../commons';
|
|
8
|
-
import { axiosGet } from '../../utils/Apis/axios';
|
|
9
|
-
import Text from '../../commons/Text';
|
|
10
4
|
import Routes from '../../utils/Route';
|
|
11
|
-
import
|
|
12
|
-
import styles from './SelectSubUnitStyles';
|
|
13
|
-
import Button from '../../commons/Button';
|
|
14
|
-
import { SCConfig } from '../../configs/SCConfig';
|
|
5
|
+
import SelectSubUnit from '../../commons/SelectSubUnit';
|
|
15
6
|
|
|
16
7
|
const AddCommonSelectSubUnit = ({ route }) => {
|
|
17
8
|
const t = useTranslations();
|
|
18
9
|
const navigation = useNavigation();
|
|
19
|
-
const isFocused = useIsFocused();
|
|
20
10
|
const {
|
|
21
11
|
addType,
|
|
22
12
|
unit_id,
|
|
@@ -26,34 +16,15 @@ const AddCommonSelectSubUnit = ({ route }) => {
|
|
|
26
16
|
smart_account_id_from_backend,
|
|
27
17
|
username,
|
|
28
18
|
brand,
|
|
29
|
-
|
|
30
|
-
gateway,
|
|
31
|
-
devicePrefixName,
|
|
32
|
-
wifi_ssid,
|
|
33
|
-
wifi_pass,
|
|
34
|
-
} = route.params;
|
|
35
|
-
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
36
|
-
const [unit, setUnit] = useState([]);
|
|
19
|
+
} = route?.params || {};
|
|
37
20
|
const [title, setTitle] = useState('');
|
|
38
21
|
const [subTitle, setSubTitle] = useState('');
|
|
39
|
-
const [nameSubUnit, setNameSubUnit] = useState('');
|
|
40
22
|
|
|
41
23
|
useEffect(() => {
|
|
42
24
|
switch (addType) {
|
|
43
|
-
case 'AddNewGateway':
|
|
44
|
-
setTitle(t('add_new_gateway'));
|
|
45
|
-
setSubTitle(t('select_a_sub_unit'));
|
|
46
|
-
break;
|
|
47
25
|
case 'AddHassiDevice':
|
|
48
26
|
setTitle(t('select_a_sub_unit'));
|
|
49
27
|
break;
|
|
50
|
-
case 'AddVconnexDevice':
|
|
51
|
-
setTitle(t('select_a_sub_unit'));
|
|
52
|
-
break;
|
|
53
|
-
case 'AddDeviceNewFlow':
|
|
54
|
-
setTitle(t('text_select_sub_unit'));
|
|
55
|
-
setSubTitle(t('select_a_sub_unit_want_add_device'));
|
|
56
|
-
break;
|
|
57
28
|
default:
|
|
58
29
|
setTitle(t('add_new_gateway'));
|
|
59
30
|
setSubTitle(t('select_a_sub_unit'));
|
|
@@ -61,166 +32,48 @@ const AddCommonSelectSubUnit = ({ route }) => {
|
|
|
61
32
|
}
|
|
62
33
|
}, [title, subTitle, addType, t]);
|
|
63
34
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
smart_account_id: smart_account_id,
|
|
99
|
-
unit_id: unit_id,
|
|
100
|
-
smart_account_id_from_backend: smart_account_id_from_backend,
|
|
101
|
-
username,
|
|
102
|
-
brand,
|
|
103
|
-
});
|
|
104
|
-
break;
|
|
105
|
-
case 'AddVconnexDevice':
|
|
106
|
-
navigation.navigate(Routes.Browser, {
|
|
107
|
-
link: API.IOT.VCONNEX.AUTHORIZE(
|
|
108
|
-
SCConfig.VCONNEX_CLIENT_ID,
|
|
109
|
-
SCConfig.VCONNEX_REDIRECT_URI_APP,
|
|
110
|
-
unit.user_id,
|
|
111
|
-
unit_id,
|
|
112
|
-
subUnits[selectedIndex]?.id
|
|
113
|
-
),
|
|
114
|
-
});
|
|
115
|
-
break;
|
|
116
|
-
case 'AddDeviceNewFlow':
|
|
117
|
-
navigation.navigate(Routes.ConnectingProcess, {
|
|
118
|
-
station: subUnits[selectedIndex],
|
|
119
|
-
unit: unit,
|
|
120
|
-
scan_sensor_data: scan_sensor_data,
|
|
121
|
-
gateway: gateway,
|
|
122
|
-
devicePrefixName: devicePrefixName,
|
|
123
|
-
wifi_ssid: wifi_ssid,
|
|
124
|
-
wifi_pass: wifi_pass,
|
|
125
|
-
});
|
|
126
|
-
break;
|
|
127
|
-
default:
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
}, [
|
|
131
|
-
addType,
|
|
132
|
-
navigation,
|
|
133
|
-
subUnits,
|
|
134
|
-
selectedIndex,
|
|
135
|
-
unit,
|
|
136
|
-
route.params,
|
|
137
|
-
nameSubUnit,
|
|
138
|
-
sensor_data,
|
|
139
|
-
listSelectDevice,
|
|
140
|
-
smart_account_id,
|
|
141
|
-
unit_id,
|
|
142
|
-
smart_account_id_from_backend,
|
|
143
|
-
username,
|
|
144
|
-
brand,
|
|
145
|
-
scan_sensor_data,
|
|
146
|
-
gateway,
|
|
147
|
-
devicePrefixName,
|
|
148
|
-
wifi_ssid,
|
|
149
|
-
wifi_pass,
|
|
150
|
-
]);
|
|
151
|
-
|
|
152
|
-
const handleSelectIndex = (index) => {
|
|
153
|
-
setNameSubUnit(subUnits[index].name);
|
|
154
|
-
if (index !== selectedIndex) {
|
|
155
|
-
setSelectedIndex(index);
|
|
156
|
-
} else {
|
|
157
|
-
setSelectedIndex(-1);
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
const addSubUnit = useCallback(() => {
|
|
161
|
-
navigation.navigate(Routes.AddSubUnitStack, {
|
|
162
|
-
screen: Routes.AddSubUnit,
|
|
163
|
-
params: { unit, ...route.params, addType: 'AddHassiDevice' },
|
|
164
|
-
});
|
|
165
|
-
}, [navigation, unit, route.params]);
|
|
35
|
+
const onPressNext = useCallback(
|
|
36
|
+
(unit, subUnit) => {
|
|
37
|
+
switch (addType) {
|
|
38
|
+
case 'AddHassiDevice':
|
|
39
|
+
navigation.navigate(Routes.SmartAccountConnecting, {
|
|
40
|
+
listSensorIds: route.params.listSensorIds,
|
|
41
|
+
stationId: subUnit?.id,
|
|
42
|
+
nameSubUnit: subUnit?.name,
|
|
43
|
+
sensor_data: sensor_data,
|
|
44
|
+
listSelectDevice: listSelectDevice,
|
|
45
|
+
smart_account_id: smart_account_id,
|
|
46
|
+
unit_id: unit_id,
|
|
47
|
+
smart_account_id_from_backend: smart_account_id_from_backend,
|
|
48
|
+
username,
|
|
49
|
+
brand,
|
|
50
|
+
});
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
[
|
|
57
|
+
addType,
|
|
58
|
+
navigation,
|
|
59
|
+
route.params,
|
|
60
|
+
sensor_data,
|
|
61
|
+
listSelectDevice,
|
|
62
|
+
smart_account_id,
|
|
63
|
+
unit_id,
|
|
64
|
+
smart_account_id_from_backend,
|
|
65
|
+
username,
|
|
66
|
+
brand,
|
|
67
|
+
]
|
|
68
|
+
);
|
|
166
69
|
|
|
167
70
|
return (
|
|
168
|
-
<
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
<ScrollView
|
|
175
|
-
style={styles.scrollContainer}
|
|
176
|
-
showsVerticalScrollIndicator={false}
|
|
177
|
-
scrollIndicatorInsets={{ right: 1 }}
|
|
178
|
-
>
|
|
179
|
-
<Section type={'border'}>
|
|
180
|
-
{subUnits.map((item, index) => (
|
|
181
|
-
<TouchableOpacity
|
|
182
|
-
key={index}
|
|
183
|
-
style={styles.rowContainer}
|
|
184
|
-
onPress={() => handleSelectIndex(index)}
|
|
185
|
-
>
|
|
186
|
-
<RadioCircle
|
|
187
|
-
active={selectedIndex === index}
|
|
188
|
-
testID={TESTID.SELECT_SUBUNIT_RADIO_BUTTON}
|
|
189
|
-
/>
|
|
190
|
-
<TouchableOpacity
|
|
191
|
-
style={styles.row}
|
|
192
|
-
onPress={() => handleSelectIndex(index)}
|
|
193
|
-
testID={TESTID.SELECT_SUBUNIT_SELECT}
|
|
194
|
-
>
|
|
195
|
-
<Text style={styles.text} testID={TESTID.SELECT_SUBUNIT_NAME}>
|
|
196
|
-
{item.name}
|
|
197
|
-
</Text>
|
|
198
|
-
</TouchableOpacity>
|
|
199
|
-
</TouchableOpacity>
|
|
200
|
-
))}
|
|
201
|
-
</Section>
|
|
202
|
-
<View style={styles.buttonAdd}>
|
|
203
|
-
<Button
|
|
204
|
-
type="primaryBorder"
|
|
205
|
-
title={`${t('add_new_sub_unit')} +`}
|
|
206
|
-
onPress={addSubUnit}
|
|
207
|
-
width="auto"
|
|
208
|
-
height={32}
|
|
209
|
-
textType="setupBorder"
|
|
210
|
-
textSemiBold={false}
|
|
211
|
-
/>
|
|
212
|
-
</View>
|
|
213
|
-
</ScrollView>
|
|
214
|
-
<ViewButtonBottom
|
|
215
|
-
leftTitle={t('cancel')}
|
|
216
|
-
onLeftClick={() => navigation.goBack()}
|
|
217
|
-
rightTitle={t('next')}
|
|
218
|
-
rightDisabled={selectedIndex === -1}
|
|
219
|
-
onRightClick={onPressNext}
|
|
220
|
-
testIDPrefix={TESTID.PREFIX.SELECT_UNIT}
|
|
221
|
-
/>
|
|
222
|
-
</View>
|
|
223
|
-
</SafeAreaView>
|
|
71
|
+
<SelectSubUnit
|
|
72
|
+
subTitle={subTitle}
|
|
73
|
+
title={title}
|
|
74
|
+
unitId={unit_id}
|
|
75
|
+
onPressNext={onPressNext}
|
|
76
|
+
/>
|
|
224
77
|
);
|
|
225
78
|
};
|
|
226
79
|
|
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
import { useNavigation } from '@react-navigation/native';
|
|
2
2
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
3
3
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
SafeAreaView,
|
|
6
|
-
ScrollView,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
TouchableOpacity,
|
|
9
|
-
View,
|
|
10
|
-
StatusBar,
|
|
11
|
-
Platform,
|
|
12
|
-
} from 'react-native';
|
|
13
|
-
|
|
14
|
-
import { API, Colors } from '../../configs';
|
|
15
|
-
import { Section, RadioCircle, ViewButtonBottom } from '../../commons';
|
|
16
|
-
import { axiosGet } from '../../utils/Apis/axios';
|
|
17
|
-
import Text from '../../commons/Text';
|
|
18
4
|
import Routes from '../../utils/Route';
|
|
19
|
-
import
|
|
5
|
+
import SelectUnit from '../../commons/SelectUnit';
|
|
20
6
|
|
|
21
7
|
const AddCommonSelectUnit = ({ route }) => {
|
|
22
8
|
const t = useTranslations();
|
|
23
9
|
const navigation = useNavigation();
|
|
24
|
-
const { addType
|
|
25
|
-
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
26
|
-
const [units, setUnits] = useState([]);
|
|
10
|
+
const { addType } = route?.params || {};
|
|
27
11
|
const [title, setTitle] = useState('');
|
|
28
12
|
const [subTitle, setSubTitle] = useState('');
|
|
29
13
|
|
|
@@ -48,13 +32,6 @@ const AddCommonSelectUnit = ({ route }) => {
|
|
|
48
32
|
case 'AddHassioDevice':
|
|
49
33
|
setTitle(t('text_select_a_unit'));
|
|
50
34
|
break;
|
|
51
|
-
case 'AddVconnexDevice':
|
|
52
|
-
setTitle(t('text_select_a_unit'));
|
|
53
|
-
break;
|
|
54
|
-
case 'AddDeviceNewFlow':
|
|
55
|
-
setTitle(t('text_select_a_unit'));
|
|
56
|
-
setSubTitle(t('text_select_a_unit_have_device'));
|
|
57
|
-
break;
|
|
58
35
|
default:
|
|
59
36
|
setTitle(t('add_new_sub_unit'));
|
|
60
37
|
setSubTitle(t('add_new_subunit_select_unit'));
|
|
@@ -62,189 +39,59 @@ const AddCommonSelectUnit = ({ route }) => {
|
|
|
62
39
|
}
|
|
63
40
|
}, [title, subTitle, addType, t]);
|
|
64
41
|
|
|
65
|
-
|
|
66
|
-
(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
42
|
+
const onPressNext = useCallback(
|
|
43
|
+
(unit) => {
|
|
44
|
+
switch (addType) {
|
|
45
|
+
case 'AddSubUnit':
|
|
46
|
+
navigation.navigate(Routes.AddSubUnit, {
|
|
47
|
+
unit,
|
|
48
|
+
});
|
|
49
|
+
break;
|
|
50
|
+
case 'AddDevice':
|
|
51
|
+
navigation.navigate(Routes.AddNewDevice, {
|
|
52
|
+
unit_id: unit?.id,
|
|
53
|
+
});
|
|
54
|
+
break;
|
|
55
|
+
case 'AddMember':
|
|
56
|
+
navigation.navigate(Routes.SharingSelectPermission, {
|
|
57
|
+
unit,
|
|
58
|
+
});
|
|
59
|
+
break;
|
|
60
|
+
case 'AddLGDevice':
|
|
61
|
+
navigation.navigate(Routes.AddLGDevice, {
|
|
62
|
+
code: route.params.code,
|
|
63
|
+
backend_url: route.params.backend_url
|
|
64
|
+
.replace(/%2F/g, '/')
|
|
65
|
+
.replace(/%3A/g, ':'),
|
|
66
|
+
unit_id: unit?.id,
|
|
67
|
+
});
|
|
68
|
+
break;
|
|
69
|
+
case 'AddHassioDevice':
|
|
70
|
+
navigation.navigate(Routes.SmartAccountConnecting, {
|
|
71
|
+
username: route.params.username,
|
|
72
|
+
password: route.params.password,
|
|
73
|
+
brand: route.params.brand,
|
|
74
|
+
unit_id: unit?.id,
|
|
75
|
+
});
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
break;
|
|
74
79
|
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
navigation.navigate(Routes.AddNewDevice, {
|
|
87
|
-
unit_id: units[selectedIndex].id,
|
|
88
|
-
});
|
|
89
|
-
break;
|
|
90
|
-
case 'AddMember':
|
|
91
|
-
navigation.navigate(Routes.SharingSelectPermission, {
|
|
92
|
-
unit: units[selectedIndex],
|
|
93
|
-
});
|
|
94
|
-
break;
|
|
95
|
-
case 'AddLGDevice':
|
|
96
|
-
navigation.navigate(Routes.AddLGDevice, {
|
|
97
|
-
code: route.params.code,
|
|
98
|
-
backend_url: route.params.backend_url
|
|
99
|
-
.replace(/%2F/g, '/')
|
|
100
|
-
.replace(/%3A/g, ':'),
|
|
101
|
-
unit_id: units[selectedIndex].id,
|
|
102
|
-
});
|
|
103
|
-
break;
|
|
104
|
-
case 'AddHassioDevice':
|
|
105
|
-
navigation.navigate(Routes.SmartAccountConnecting, {
|
|
106
|
-
username: route.params.username,
|
|
107
|
-
password: route.params.password,
|
|
108
|
-
brand: route.params.brand,
|
|
109
|
-
unit_id: units[selectedIndex].id,
|
|
110
|
-
});
|
|
111
|
-
break;
|
|
112
|
-
case 'AddVconnexDevice':
|
|
113
|
-
navigation.navigate(Routes.AddDeviceStack, {
|
|
114
|
-
screen: Routes.AddCommonSelectSubUnit,
|
|
115
|
-
params: {
|
|
116
|
-
unit_id: units[selectedIndex].id,
|
|
117
|
-
addType: 'AddVconnexDevice',
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
break;
|
|
121
|
-
case 'AddDeviceNewFlow':
|
|
122
|
-
navigation.navigate(Routes.AddGatewaySelectGateway, {
|
|
123
|
-
unit_id: units[selectedIndex].id,
|
|
124
|
-
addType: 'AddDeviceNewFlow',
|
|
125
|
-
scan_sensor_data,
|
|
126
|
-
});
|
|
127
|
-
break;
|
|
128
|
-
default:
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
}, [
|
|
132
|
-
addType,
|
|
133
|
-
navigation,
|
|
134
|
-
units,
|
|
135
|
-
selectedIndex,
|
|
136
|
-
route.params.code,
|
|
137
|
-
route.params.backend_url,
|
|
138
|
-
route.params.username,
|
|
139
|
-
route.params.password,
|
|
140
|
-
route.params.brand,
|
|
141
|
-
scan_sensor_data,
|
|
142
|
-
]);
|
|
143
|
-
|
|
144
|
-
const handleSelectIndex = (index) => {
|
|
145
|
-
if (index !== selectedIndex) {
|
|
146
|
-
setSelectedIndex(index);
|
|
147
|
-
} else {
|
|
148
|
-
setSelectedIndex(-1);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
80
|
+
},
|
|
81
|
+
[
|
|
82
|
+
addType,
|
|
83
|
+
navigation,
|
|
84
|
+
route.params.code,
|
|
85
|
+
route.params.backend_url,
|
|
86
|
+
route.params.username,
|
|
87
|
+
route.params.password,
|
|
88
|
+
route.params.brand,
|
|
89
|
+
]
|
|
90
|
+
);
|
|
151
91
|
|
|
152
92
|
return (
|
|
153
|
-
<
|
|
154
|
-
<Text semibold style={styles.title}>
|
|
155
|
-
{title}
|
|
156
|
-
</Text>
|
|
157
|
-
<Text style={styles.subtitle}>{subTitle}</Text>
|
|
158
|
-
<View style={styles.contentContainer}>
|
|
159
|
-
<ScrollView
|
|
160
|
-
style={styles.scrollContainer}
|
|
161
|
-
showsVerticalScrollIndicator={false}
|
|
162
|
-
scrollIndicatorInsets={{ right: 1 }}
|
|
163
|
-
>
|
|
164
|
-
<Section type={'border'}>
|
|
165
|
-
{units.map((item, index) => (
|
|
166
|
-
<TouchableOpacity
|
|
167
|
-
key={index}
|
|
168
|
-
style={styles.rowContainer}
|
|
169
|
-
onPress={() => handleSelectIndex(index)}
|
|
170
|
-
>
|
|
171
|
-
<RadioCircle
|
|
172
|
-
active={selectedIndex === index}
|
|
173
|
-
testID={TESTID.SELECT_UNIT_RADIO_BUTTON}
|
|
174
|
-
/>
|
|
175
|
-
<TouchableOpacity
|
|
176
|
-
style={styles.row}
|
|
177
|
-
onPress={() => handleSelectIndex(index)}
|
|
178
|
-
testID={TESTID.SELECT_UNIT_SELECT}
|
|
179
|
-
>
|
|
180
|
-
<Text style={styles.text} testID={TESTID.SELECT_UNIT_NAME}>
|
|
181
|
-
{item.name}
|
|
182
|
-
</Text>
|
|
183
|
-
</TouchableOpacity>
|
|
184
|
-
</TouchableOpacity>
|
|
185
|
-
))}
|
|
186
|
-
</Section>
|
|
187
|
-
</ScrollView>
|
|
188
|
-
<ViewButtonBottom
|
|
189
|
-
leftTitle={t('cancel')}
|
|
190
|
-
onLeftClick={() => navigation.goBack()}
|
|
191
|
-
rightTitle={t('next')}
|
|
192
|
-
rightDisabled={selectedIndex === -1}
|
|
193
|
-
onRightClick={onPressNext}
|
|
194
|
-
testIDPrefix={TESTID.PREFIX.SELECT_UNIT}
|
|
195
|
-
/>
|
|
196
|
-
</View>
|
|
197
|
-
</SafeAreaView>
|
|
93
|
+
<SelectUnit title={title} subTitle={subTitle} onPressNext={onPressNext} />
|
|
198
94
|
);
|
|
199
95
|
};
|
|
200
96
|
|
|
201
|
-
const styles = StyleSheet.create({
|
|
202
|
-
container: {
|
|
203
|
-
flex: 1,
|
|
204
|
-
backgroundColor: Colors.Gray2,
|
|
205
|
-
paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0,
|
|
206
|
-
},
|
|
207
|
-
contentContainer: {
|
|
208
|
-
flex: 1,
|
|
209
|
-
justifyContent: 'space-between',
|
|
210
|
-
},
|
|
211
|
-
scrollContainer: {
|
|
212
|
-
width: '100%',
|
|
213
|
-
flex: 1,
|
|
214
|
-
},
|
|
215
|
-
title: {
|
|
216
|
-
color: Colors.Gray9,
|
|
217
|
-
fontSize: 20,
|
|
218
|
-
lineHeight: 28,
|
|
219
|
-
marginTop: 8,
|
|
220
|
-
marginBottom: 4,
|
|
221
|
-
marginLeft: 16,
|
|
222
|
-
},
|
|
223
|
-
subtitle: {
|
|
224
|
-
color: Colors.Gray8,
|
|
225
|
-
fontSize: 14,
|
|
226
|
-
lineHeight: 22,
|
|
227
|
-
marginLeft: 16,
|
|
228
|
-
marginBottom: 16,
|
|
229
|
-
},
|
|
230
|
-
row: {
|
|
231
|
-
flex: 1,
|
|
232
|
-
paddingVertical: 16,
|
|
233
|
-
borderBottomColor: Colors.Gray4,
|
|
234
|
-
borderBottomWidth: 1,
|
|
235
|
-
marginRight: 24,
|
|
236
|
-
marginLeft: 16,
|
|
237
|
-
},
|
|
238
|
-
rowContainer: {
|
|
239
|
-
flexDirection: 'row',
|
|
240
|
-
alignItems: 'center',
|
|
241
|
-
paddingLeft: 16,
|
|
242
|
-
},
|
|
243
|
-
text: {
|
|
244
|
-
fontSize: 16,
|
|
245
|
-
lineHeight: 24,
|
|
246
|
-
color: Colors.Gray9,
|
|
247
|
-
},
|
|
248
|
-
});
|
|
249
|
-
|
|
250
97
|
export default AddCommonSelectUnit;
|
|
@@ -8,7 +8,7 @@ import { ViewButtonBottom } from '../../../commons';
|
|
|
8
8
|
import { SCProvider } from '../../../context';
|
|
9
9
|
import { mockSCStore } from '../../../context/mockStore';
|
|
10
10
|
import Text from '../../../commons/Text';
|
|
11
|
-
import {
|
|
11
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
12
12
|
import api from '../../../utils/Apis/axios';
|
|
13
13
|
import { API } from '../../../configs';
|
|
14
14
|
|
|
@@ -39,21 +39,9 @@ describe('Test SelectSubUnit', () => {
|
|
|
39
39
|
mockedGoBack.mockClear();
|
|
40
40
|
});
|
|
41
41
|
let tree;
|
|
42
|
-
test('test ViewButtonBottom leftClick', async () => {
|
|
43
|
-
const route = { params: { addType: 'AddNewGateway' } };
|
|
44
|
-
await act(async () => {
|
|
45
|
-
tree = renderer.create(wrapComponent(route));
|
|
46
|
-
});
|
|
47
|
-
const instance = tree.root;
|
|
48
|
-
const viewButtonBottom = instance.findByType(ViewButtonBottom);
|
|
49
|
-
act(() => {
|
|
50
|
-
viewButtonBottom.props.onLeftClick();
|
|
51
|
-
});
|
|
52
|
-
expect(mockedGoBack).toHaveBeenCalled();
|
|
53
|
-
});
|
|
54
42
|
|
|
55
43
|
test('test ViewButtonBottom onRightClick', async () => {
|
|
56
|
-
const route = { params: { addType: '
|
|
44
|
+
const route = { params: { addType: 'AddHassiDevice' } };
|
|
57
45
|
await act(async () => {
|
|
58
46
|
tree = renderer.create(wrapComponent(route));
|
|
59
47
|
});
|
|
@@ -65,23 +53,18 @@ describe('Test SelectSubUnit', () => {
|
|
|
65
53
|
expect(mockedNavigate).toHaveBeenCalled();
|
|
66
54
|
});
|
|
67
55
|
});
|
|
56
|
+
|
|
68
57
|
describe('Test SelectSubUnit container', () => {
|
|
69
58
|
beforeEach(() => {
|
|
70
59
|
mockedNavigate.mockClear();
|
|
71
60
|
mockedGoBack.mockClear();
|
|
72
61
|
});
|
|
73
62
|
let tree;
|
|
74
|
-
const list_type = [
|
|
75
|
-
'AddNewGateway',
|
|
76
|
-
'AddHassiDevice',
|
|
77
|
-
'AddVconnexDevice',
|
|
78
|
-
'AddDeviceNewFlow',
|
|
79
|
-
];
|
|
63
|
+
const list_type = ['AddHassiDevice'];
|
|
80
64
|
const result = [
|
|
81
|
-
'Select a sub-unit that you want to add this gateway',
|
|
82
65
|
'',
|
|
83
66
|
'',
|
|
84
|
-
'
|
|
67
|
+
'Select a sub-unit that you want to add this device in',
|
|
85
68
|
];
|
|
86
69
|
|
|
87
70
|
list_type.forEach(function (type, i) {
|
|
@@ -115,8 +98,8 @@ describe('Test SelectSubUnit container', () => {
|
|
|
115
98
|
|
|
116
99
|
const next = instance.find(
|
|
117
100
|
(item) =>
|
|
118
|
-
item.props.
|
|
119
|
-
`${
|
|
101
|
+
item.props.accessibilityLabel ===
|
|
102
|
+
`${AccessibilityLabel.PREFIX.SELECT_UNIT}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
|
|
120
103
|
);
|
|
121
104
|
|
|
122
105
|
await act(async () => {
|
|
@@ -124,21 +107,12 @@ describe('Test SelectSubUnit container', () => {
|
|
|
124
107
|
});
|
|
125
108
|
|
|
126
109
|
switch (type) {
|
|
127
|
-
case 'AddNewGateway':
|
|
128
|
-
expect(mockedNavigate).toBeCalledWith('ScanChipQR', {
|
|
129
|
-
addType: 'AddNewGateway',
|
|
130
|
-
station: undefined,
|
|
131
|
-
isNewFlow: false,
|
|
132
|
-
unit_name: undefined,
|
|
133
|
-
});
|
|
134
|
-
break;
|
|
135
110
|
case 'AddHassiDevice':
|
|
136
111
|
expect(mockedNavigate).toBeCalledWith('SmartAccountConnecting', {
|
|
137
112
|
unit_id: undefined,
|
|
138
113
|
brand: undefined,
|
|
139
114
|
listSelectDevice: undefined,
|
|
140
115
|
listSensorIds: undefined,
|
|
141
|
-
nameSubUnit: '',
|
|
142
116
|
sensor_data: undefined,
|
|
143
117
|
smart_account_id: undefined,
|
|
144
118
|
smart_account_id_from_backend: undefined,
|
|
@@ -146,23 +120,6 @@ describe('Test SelectSubUnit container', () => {
|
|
|
146
120
|
username: undefined,
|
|
147
121
|
});
|
|
148
122
|
break;
|
|
149
|
-
case 'AddVconnexDevice':
|
|
150
|
-
expect(mockedNavigate).toBeCalledWith('Browser', {
|
|
151
|
-
// eslint-disable-next-line max-len
|
|
152
|
-
link: 'https://partner-api.vconnex.vn/oauth/authorize?client_id=&redirect_uri=&response_type=code&scope=SYNCH&scope=CONTROL&scope=QUERY&state=undefined@undefined@undefined',
|
|
153
|
-
});
|
|
154
|
-
break;
|
|
155
|
-
case 'AddDeviceNewFlow':
|
|
156
|
-
expect(mockedNavigate).toBeCalledWith('ConnectingProcess', {
|
|
157
|
-
devicePrefixName: undefined,
|
|
158
|
-
gateway: undefined,
|
|
159
|
-
scan_sensor_data: undefined,
|
|
160
|
-
station: undefined,
|
|
161
|
-
unit: [],
|
|
162
|
-
wifi_pass: undefined,
|
|
163
|
-
wifi_ssid: undefined,
|
|
164
|
-
});
|
|
165
|
-
break;
|
|
166
123
|
default:
|
|
167
124
|
break;
|
|
168
125
|
}
|