@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
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { View, Text } from 'react-native';
|
|
3
|
+
import styles from './ConnectingGatewayStyles';
|
|
4
|
+
import { useNavigation } from '@react-navigation/native';
|
|
5
|
+
import Routes from '../../utils/Route';
|
|
6
|
+
import Button from '../../commons/Button';
|
|
7
|
+
|
|
8
|
+
const SelectDeviceType = ({ route }) => {
|
|
9
|
+
const { unitId, stationId } = route?.params || {};
|
|
10
|
+
const navigation = useNavigation();
|
|
11
|
+
|
|
12
|
+
const onPressModbus = useCallback(() => {
|
|
13
|
+
navigation.navigate(Routes.SelectModbusGateway, {
|
|
14
|
+
unitId,
|
|
15
|
+
stationId,
|
|
16
|
+
type: 'modbus',
|
|
17
|
+
});
|
|
18
|
+
}, [navigation, unitId, stationId]);
|
|
19
|
+
|
|
20
|
+
const onPressZigbee = useCallback(() => {
|
|
21
|
+
navigation.navigate(Routes.SelectZigbeeGateway, {
|
|
22
|
+
unitId,
|
|
23
|
+
stationId,
|
|
24
|
+
type: 'zigbee',
|
|
25
|
+
});
|
|
26
|
+
}, [navigation, stationId, unitId]);
|
|
27
|
+
|
|
28
|
+
const onPressGateway = useCallback(() => {
|
|
29
|
+
navigation.navigate(Routes.ScanGatewayQR, {
|
|
30
|
+
unitId,
|
|
31
|
+
stationId,
|
|
32
|
+
});
|
|
33
|
+
}, [navigation, stationId, unitId]);
|
|
34
|
+
const onPressWifiDevice = useCallback(() => {
|
|
35
|
+
navigation.navigate(Routes.ScanWifiDeviceQR, {
|
|
36
|
+
unitId,
|
|
37
|
+
stationId,
|
|
38
|
+
});
|
|
39
|
+
}, [navigation, stationId, unitId]);
|
|
40
|
+
// Todo Bang this screen will be re-do by other soon
|
|
41
|
+
return (
|
|
42
|
+
<View style={styles.wrap}>
|
|
43
|
+
<Text>Select device type</Text>
|
|
44
|
+
<Button title={'Modbus'} onPress={onPressModbus} />
|
|
45
|
+
<Button title={'Zigbee'} onPress={onPressZigbee} />
|
|
46
|
+
<Button title={'Gateway'} onPress={onPressGateway} />
|
|
47
|
+
<Button title={'Wifi Device'} onPress={onPressWifiDevice} />
|
|
48
|
+
</View>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default SelectDeviceType;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import SelectUnit from '../../commons/SelectUnit';
|
|
3
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
|
+
import { useNavigation } from '@react-navigation/native';
|
|
5
|
+
import Routes from '../../utils/Route';
|
|
6
|
+
|
|
7
|
+
const SelectDeviceUnit = ({ route }) => {
|
|
8
|
+
const t = useTranslations();
|
|
9
|
+
const { navigate } = useNavigation();
|
|
10
|
+
const onPressNext = useCallback(
|
|
11
|
+
(unit) => {
|
|
12
|
+
navigate(Routes.SelectDeviceSubUnit, {
|
|
13
|
+
unitId: unit?.id,
|
|
14
|
+
unitName: unit?.name,
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
[navigate]
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<SelectUnit
|
|
22
|
+
title={t('add_new_device')}
|
|
23
|
+
subTitle={t('first_select_a_unit')}
|
|
24
|
+
onPressNext={onPressNext}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default SelectDeviceUnit;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useNavigation } from '@react-navigation/native';
|
|
3
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
|
+
import SelectGateway from '../../commons/SelectGateway';
|
|
5
|
+
import Routes from '../../utils/Route';
|
|
6
|
+
|
|
7
|
+
const SelectModbusGateway = ({ route }) => {
|
|
8
|
+
const t = useTranslations();
|
|
9
|
+
const navigation = useNavigation();
|
|
10
|
+
const { unitId, stationId } = route?.params || {};
|
|
11
|
+
|
|
12
|
+
const onPressNext = useCallback(
|
|
13
|
+
(gateway) => {
|
|
14
|
+
navigation.navigate(Routes.ScanModbusQR, {
|
|
15
|
+
unitId,
|
|
16
|
+
stationId,
|
|
17
|
+
chipId: gateway.id,
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
[navigation, unitId, stationId]
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<SelectGateway
|
|
25
|
+
onPressNext={onPressNext}
|
|
26
|
+
title={t('text_select_a_gateway')}
|
|
27
|
+
subTitle={t('text_select_a_gateway')}
|
|
28
|
+
unitId={unitId}
|
|
29
|
+
type="modbus"
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default SelectModbusGateway;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useNavigation } from '@react-navigation/native';
|
|
3
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
|
+
import SelectGateway from '../../commons/SelectGateway';
|
|
5
|
+
import Routes from '../../utils/Route';
|
|
6
|
+
|
|
7
|
+
const SelectZigbeeGateway = ({ route }) => {
|
|
8
|
+
const t = useTranslations();
|
|
9
|
+
const navigation = useNavigation();
|
|
10
|
+
const { unitId, stationId } = route?.params || {};
|
|
11
|
+
|
|
12
|
+
const onPressNext = useCallback(
|
|
13
|
+
(gateway) => {
|
|
14
|
+
navigation.navigate(Routes.ConnectingZigbeeDevice, {
|
|
15
|
+
unitId,
|
|
16
|
+
stationId,
|
|
17
|
+
chipId: gateway.id,
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
[navigation, unitId, stationId]
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<SelectGateway
|
|
25
|
+
onPressNext={onPressNext}
|
|
26
|
+
title={t('text_select_a_gateway')}
|
|
27
|
+
subTitle={t('text_select_a_gateway')}
|
|
28
|
+
unitId={unitId}
|
|
29
|
+
type="zigbee"
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default SelectZigbeeGateway;
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import WifiManager from 'react-native-wifi-reborn';
|
|
3
|
+
import { ToastBottomHelper } from '../../utils/Utils';
|
|
4
|
+
import {
|
|
5
|
+
Alert,
|
|
6
|
+
Platform,
|
|
7
|
+
ScrollView,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
View,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import _ from 'lodash';
|
|
12
|
+
import dgram from 'react-native-udp';
|
|
13
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
14
|
+
import { HeaderCustom } from '../../commons/Header';
|
|
15
|
+
import Text from '../../commons/Text';
|
|
16
|
+
import WifiIcon from '../../../assets/images/wifi.svg';
|
|
17
|
+
import ButtonPopup from '../../commons/ButtonPopup';
|
|
18
|
+
import AccessibilityLabel from '../../configs/AccessibilityLabel';
|
|
19
|
+
import { Colors } from '../../configs';
|
|
20
|
+
import TextInputPassword from '../../commons/Form/TextInputPassword';
|
|
21
|
+
import styles from './ShareWifiPasswordStyles';
|
|
22
|
+
import { useNavigation } from '@react-navigation/native';
|
|
23
|
+
import Routes from '../../utils/Route';
|
|
24
|
+
|
|
25
|
+
const WifiItem = ({ item, setIsShowPopupPassword, setSelectedWifi }) => {
|
|
26
|
+
const showPopupPassword = useCallback(
|
|
27
|
+
(ssid) => {
|
|
28
|
+
setIsShowPopupPassword(true);
|
|
29
|
+
setSelectedWifi(ssid);
|
|
30
|
+
},
|
|
31
|
+
[setIsShowPopupPassword, setSelectedWifi]
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<TouchableOpacity
|
|
36
|
+
style={styles.listItem}
|
|
37
|
+
onPress={() => showPopupPassword(item.ssid)}
|
|
38
|
+
accessibilityLabel={`${AccessibilityLabel.SELECT_WIFI}${item.ssid}`}
|
|
39
|
+
>
|
|
40
|
+
<Text type="H4" style={styles.textItem}>
|
|
41
|
+
{item.ssid}
|
|
42
|
+
</Text>
|
|
43
|
+
<View style={styles.wifiIcon}>
|
|
44
|
+
<WifiIcon />
|
|
45
|
+
</View>
|
|
46
|
+
</TouchableOpacity>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const ShareWifiPassword = ({ route }) => {
|
|
51
|
+
const { prefix, unitId, stationId } = route?.params || {};
|
|
52
|
+
const t = useTranslations();
|
|
53
|
+
const navigation = useNavigation();
|
|
54
|
+
|
|
55
|
+
const [wifiList, setWifiList] = useState([]);
|
|
56
|
+
const [isShowPopupPassword, setIsShowPopupPassword] = useState(false);
|
|
57
|
+
const [selectedWifi, setSelectedWifi] = useState('');
|
|
58
|
+
const [selectedWifiPassword, setSelectedWifiPassword] = useState('');
|
|
59
|
+
const [currentState, setCurrentState] = useState(t('loading_wifi_list'));
|
|
60
|
+
|
|
61
|
+
const hidePopupPassword = useCallback(() => {
|
|
62
|
+
setIsShowPopupPassword(false);
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
const shareWifiToDevice = useCallback(
|
|
66
|
+
(socket, i) => {
|
|
67
|
+
const timeoutSendConnect = setTimeout(async () => {
|
|
68
|
+
i--;
|
|
69
|
+
socket.send(
|
|
70
|
+
JSON.stringify({
|
|
71
|
+
type: 'connect',
|
|
72
|
+
data: { wifi: { ssid: selectedWifi, pass: selectedWifiPassword } },
|
|
73
|
+
}),
|
|
74
|
+
undefined,
|
|
75
|
+
undefined,
|
|
76
|
+
54321,
|
|
77
|
+
'192.168.27.1',
|
|
78
|
+
undefined
|
|
79
|
+
);
|
|
80
|
+
if (i > 0) {
|
|
81
|
+
shareWifiToDevice(socket, i);
|
|
82
|
+
clearTimeout(timeoutSendConnect);
|
|
83
|
+
}
|
|
84
|
+
}, 1000);
|
|
85
|
+
},
|
|
86
|
+
[selectedWifiPassword, selectedWifi]
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const handleSocketOnMsg = useCallback(
|
|
90
|
+
(currentSsid, msg) => {
|
|
91
|
+
const data = JSON.parse(msg.toString());
|
|
92
|
+
if (!Object.prototype.hasOwnProperty.call(data, 'gateway')) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
const gatewayInfo = data.gateway;
|
|
96
|
+
const checkWifiInterval = setInterval(async () => {
|
|
97
|
+
let ssid;
|
|
98
|
+
try {
|
|
99
|
+
ssid = await WifiManager.getCurrentWifiSSID();
|
|
100
|
+
} catch (e) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (ssid !== currentSsid) {
|
|
105
|
+
clearInterval(checkWifiInterval);
|
|
106
|
+
navigation.navigate(Routes.ConnectingWifiDevice, {
|
|
107
|
+
unitId,
|
|
108
|
+
stationId,
|
|
109
|
+
gateway: gatewayInfo,
|
|
110
|
+
selectedWifi: {
|
|
111
|
+
ssid: selectedWifi,
|
|
112
|
+
password: selectedWifiPassword,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}, 1000);
|
|
117
|
+
|
|
118
|
+
return true;
|
|
119
|
+
},
|
|
120
|
+
[navigation, selectedWifi, selectedWifiPassword, stationId, unitId]
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const onPasswordReady = useCallback(async () => {
|
|
124
|
+
const socket = dgram.createSocket({ type: 'udp4' });
|
|
125
|
+
socket.bind(54321);
|
|
126
|
+
let currentSsid;
|
|
127
|
+
try {
|
|
128
|
+
currentSsid = await WifiManager.getCurrentWifiSSID();
|
|
129
|
+
} catch (e) {
|
|
130
|
+
Alert.alert(t('cannot_get_current_wifi_ssid'));
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
socket.on('message', (msg, rinfo) => {
|
|
135
|
+
if (handleSocketOnMsg(currentSsid, msg)) {
|
|
136
|
+
socket.close();
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
socket.on('error', () => {
|
|
140
|
+
ToastBottomHelper.error(t('server_error'));
|
|
141
|
+
// todo Bang handle error
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
setCurrentState(t('sharing_wifi_password_to_device'));
|
|
145
|
+
setIsShowPopupPassword(false);
|
|
146
|
+
shareWifiToDevice(socket, 3);
|
|
147
|
+
}, [handleSocketOnMsg, shareWifiToDevice, t]);
|
|
148
|
+
|
|
149
|
+
const connectToDeviceWifi = useCallback(async () => {
|
|
150
|
+
const wifiPrefix = `eoh.${prefix.toLowerCase()}.`;
|
|
151
|
+
const buttons = [
|
|
152
|
+
{
|
|
153
|
+
text: t('cancel'),
|
|
154
|
+
onPress: navigation.goBack,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
text: t('retry'),
|
|
158
|
+
onPress: connectToDeviceWifi,
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
|
|
162
|
+
if (Platform.OS === 'android') {
|
|
163
|
+
let phoneWifiList;
|
|
164
|
+
try {
|
|
165
|
+
phoneWifiList = await WifiManager.reScanAndLoadWifiList();
|
|
166
|
+
} catch (e) {
|
|
167
|
+
Alert.alert(t('cannot_fetch_wifi_list'));
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const wifi = _.find(phoneWifiList, function (x) {
|
|
171
|
+
return x.SSID.indexOf(`eoh.${prefix.toLowerCase()}.`) === 0;
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
if (!wifi) {
|
|
175
|
+
Alert.alert(
|
|
176
|
+
t('fail_to_discover_device_wifi'),
|
|
177
|
+
t('try to turn on device or try again'),
|
|
178
|
+
buttons
|
|
179
|
+
);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
await WifiManager.connectToProtectedSSID(wifi.SSID, 'Eoh@2021', false);
|
|
185
|
+
} catch (e) {
|
|
186
|
+
Alert.alert(
|
|
187
|
+
t('cannot_connect_to_device_wifi'),
|
|
188
|
+
t('try to turn on device or try again'),
|
|
189
|
+
buttons
|
|
190
|
+
);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
try {
|
|
195
|
+
await WifiManager.connectToProtectedSSIDPrefix(
|
|
196
|
+
wifiPrefix,
|
|
197
|
+
'Eoh@2021',
|
|
198
|
+
false
|
|
199
|
+
);
|
|
200
|
+
} catch (e) {
|
|
201
|
+
Alert.alert(
|
|
202
|
+
t('cannot_connect_to_device_wifi'),
|
|
203
|
+
t('try to turn on device or try again'),
|
|
204
|
+
buttons
|
|
205
|
+
);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
let intervalSend = null;
|
|
211
|
+
const socket = dgram.createSocket({ type: 'udp4' });
|
|
212
|
+
socket.bind(54321);
|
|
213
|
+
|
|
214
|
+
socket.on('message', (msg, rinfo) => {
|
|
215
|
+
const data = JSON.parse(msg.toString());
|
|
216
|
+
if (Object.prototype.hasOwnProperty.call(data, 'wifi')) {
|
|
217
|
+
setWifiList(data.wifi);
|
|
218
|
+
setCurrentState(t('select_wifi'));
|
|
219
|
+
clearInterval(intervalSend);
|
|
220
|
+
socket.close();
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
socket.on('error', () => {
|
|
225
|
+
ToastBottomHelper.error(t('fail_trigger_scan_wifi_on_device'));
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
intervalSend = setInterval(() => {
|
|
229
|
+
socket.send(
|
|
230
|
+
JSON.stringify({ type: 'scan', data: { wifi: '' } }),
|
|
231
|
+
undefined,
|
|
232
|
+
undefined,
|
|
233
|
+
54321,
|
|
234
|
+
'192.168.27.1',
|
|
235
|
+
undefined
|
|
236
|
+
);
|
|
237
|
+
}, 5000); // workaround, todo Bang continue research
|
|
238
|
+
}, [navigation.goBack, prefix, t]);
|
|
239
|
+
|
|
240
|
+
useEffect(() => {
|
|
241
|
+
connectToDeviceWifi();
|
|
242
|
+
}, [connectToDeviceWifi]);
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
<View style={styles.screen}>
|
|
246
|
+
<HeaderCustom
|
|
247
|
+
onGoBack={navigation.goBack}
|
|
248
|
+
title={t('connect_home_wifi')}
|
|
249
|
+
isShowSeparator
|
|
250
|
+
/>
|
|
251
|
+
<View>
|
|
252
|
+
<Text style={styles.title} semibold type="H3">
|
|
253
|
+
{t('set_network')}
|
|
254
|
+
</Text>
|
|
255
|
+
<Text style={styles.subTitle} type="Body">
|
|
256
|
+
{currentState}
|
|
257
|
+
</Text>
|
|
258
|
+
|
|
259
|
+
<ScrollView
|
|
260
|
+
style={styles.listContainer}
|
|
261
|
+
scrollIndicatorInsets={{ right: 1 }}
|
|
262
|
+
>
|
|
263
|
+
{!!wifiList?.length &&
|
|
264
|
+
wifiList.map((item, index) => {
|
|
265
|
+
return (
|
|
266
|
+
<WifiItem
|
|
267
|
+
key={index}
|
|
268
|
+
item={item}
|
|
269
|
+
setSelectedWifi={setSelectedWifi}
|
|
270
|
+
setIsShowPopupPassword={setIsShowPopupPassword}
|
|
271
|
+
/>
|
|
272
|
+
);
|
|
273
|
+
})}
|
|
274
|
+
</ScrollView>
|
|
275
|
+
</View>
|
|
276
|
+
|
|
277
|
+
<ButtonPopup
|
|
278
|
+
accessibilityLabel={AccessibilityLabel.GATEWAY_WIFI_LIST.BUTTON_POPUP}
|
|
279
|
+
visible={isShowPopupPassword}
|
|
280
|
+
mainTitle={t('connect')}
|
|
281
|
+
onPressMain={onPasswordReady}
|
|
282
|
+
secondaryTitle={t('cancel')}
|
|
283
|
+
typeSecondary={'cancel'}
|
|
284
|
+
onPressSecondary={hidePopupPassword}
|
|
285
|
+
hideClose
|
|
286
|
+
>
|
|
287
|
+
<>
|
|
288
|
+
<Text>{t('enter_wifi_password')}</Text>
|
|
289
|
+
<TextInputPassword
|
|
290
|
+
secureTextEntry
|
|
291
|
+
placeholder={t('password')}
|
|
292
|
+
onChange={setSelectedWifiPassword}
|
|
293
|
+
value={selectedWifiPassword}
|
|
294
|
+
textInputStyle={styles.input}
|
|
295
|
+
selectionColor={Colors.Primary}
|
|
296
|
+
/>
|
|
297
|
+
</>
|
|
298
|
+
</ButtonPopup>
|
|
299
|
+
</View>
|
|
300
|
+
);
|
|
301
|
+
};
|
|
302
|
+
export default ShareWifiPassword;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Colors } from '../../configs';
|
|
3
|
+
|
|
4
|
+
export default StyleSheet.create({
|
|
5
|
+
screen: {
|
|
6
|
+
flex: 1,
|
|
7
|
+
backgroundColor: Colors.Gray2,
|
|
8
|
+
},
|
|
9
|
+
title: {
|
|
10
|
+
marginVertical: 16,
|
|
11
|
+
marginLeft: 16,
|
|
12
|
+
},
|
|
13
|
+
subTitle: {
|
|
14
|
+
marginBottom: 16,
|
|
15
|
+
marginLeft: 16,
|
|
16
|
+
},
|
|
17
|
+
listContainer: {
|
|
18
|
+
borderWidth: 1,
|
|
19
|
+
backgroundColor: Colors.White,
|
|
20
|
+
borderRadius: 20,
|
|
21
|
+
borderColor: Colors.Gray4,
|
|
22
|
+
},
|
|
23
|
+
listItem: {
|
|
24
|
+
borderBottomColor: Colors.Gray4,
|
|
25
|
+
flex: 1,
|
|
26
|
+
flexDirection: 'row',
|
|
27
|
+
justifyContent: 'space-between',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
},
|
|
30
|
+
textItem: {
|
|
31
|
+
paddingVertical: 16,
|
|
32
|
+
paddingLeft: 16,
|
|
33
|
+
},
|
|
34
|
+
wifiIcon: {
|
|
35
|
+
paddingRight: 16,
|
|
36
|
+
},
|
|
37
|
+
input: {
|
|
38
|
+
height: 40,
|
|
39
|
+
marginVertical: 12,
|
|
40
|
+
borderWidth: 1,
|
|
41
|
+
padding: 10,
|
|
42
|
+
borderColor: Colors.Gray5,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -4,7 +4,7 @@ import MockAdapter from 'axios-mock-adapter';
|
|
|
4
4
|
|
|
5
5
|
import AddNewGateway from '../index';
|
|
6
6
|
import GroupCheckBox from '../../../commons/GroupCheckBox';
|
|
7
|
-
import {
|
|
7
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
8
8
|
import { ViewButtonBottom } from '../../../commons';
|
|
9
9
|
import { TextInput } from 'react-native';
|
|
10
10
|
import { getTranslate } from '../../../utils/I18n';
|
|
@@ -54,7 +54,7 @@ describe('Test AddNewGateway', () => {
|
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
const getText = (instance, id) => {
|
|
57
|
-
return instance.find((el) => el.props.
|
|
57
|
+
return instance.find((el) => el.props.accessibilityLabel === id);
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
test('create', async () => {
|
|
@@ -62,8 +62,11 @@ describe('Test AddNewGateway', () => {
|
|
|
62
62
|
tree = await create(wrapComponent(route));
|
|
63
63
|
});
|
|
64
64
|
const instance = tree.root;
|
|
65
|
-
const textAdd = getText(instance,
|
|
66
|
-
const textThen = getText(
|
|
65
|
+
const textAdd = getText(instance, AccessibilityLabel.ADD_NEW_GATEWAY_ADD);
|
|
66
|
+
const textThen = getText(
|
|
67
|
+
instance,
|
|
68
|
+
AccessibilityLabel.ADD_NEW_GATEWAY_THEN_SELECT
|
|
69
|
+
);
|
|
67
70
|
expect(textAdd.props.children).toEqual(
|
|
68
71
|
getTranslate('en', 'add_new_gateway')
|
|
69
72
|
);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { act, create } from 'react-test-renderer';
|
|
3
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
+
import ConnectingModbusDevice from '../ConnectingModbusDevice';
|
|
5
|
+
import { SCProvider } from '../../../context';
|
|
6
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
+
import api from '../../../utils/Apis/axios';
|
|
8
|
+
import Processing from '../../../commons/Processing';
|
|
9
|
+
|
|
10
|
+
const wrapComponent = (route) => (
|
|
11
|
+
<SCProvider initState={mockSCStore({})}>
|
|
12
|
+
<ConnectingModbusDevice route={route} />
|
|
13
|
+
</SCProvider>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
const mock = new MockAdapter(api.axiosInstance);
|
|
17
|
+
|
|
18
|
+
jest.mock('react', () => {
|
|
19
|
+
return { ...jest.requireActual('react'), memo: (x) => x };
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const mockedNavigate = jest.fn();
|
|
23
|
+
const mockedGoBack = jest.fn();
|
|
24
|
+
|
|
25
|
+
jest.mock('@react-navigation/native', () => {
|
|
26
|
+
return {
|
|
27
|
+
...jest.requireActual('@react-navigation/native'),
|
|
28
|
+
useNavigation: () => ({
|
|
29
|
+
navigate: mockedNavigate,
|
|
30
|
+
goBack: mockedGoBack,
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('Test connecting modbus device', () => {
|
|
36
|
+
let tree;
|
|
37
|
+
let route;
|
|
38
|
+
|
|
39
|
+
afterEach(() => {
|
|
40
|
+
mockedNavigate.mockClear();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
route = {
|
|
45
|
+
params: {
|
|
46
|
+
unitId: 1,
|
|
47
|
+
stationId: 2,
|
|
48
|
+
chipId: 3,
|
|
49
|
+
qrData: {},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('rendering', async () => {
|
|
55
|
+
await act(async () => {
|
|
56
|
+
tree = await create(wrapComponent(route));
|
|
57
|
+
});
|
|
58
|
+
const instance = tree.root;
|
|
59
|
+
expect(instance.findAllByType(Processing)).toHaveLength(1);
|
|
60
|
+
|
|
61
|
+
expect(mock.history.post).toHaveLength(1);
|
|
62
|
+
});
|
|
63
|
+
});
|
package/src/screens/AddNewGateway/__test__/{SelectGateway.test.js → ConnectingWifiDevice.test.js}
RENAMED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { act, create } from 'react-test-renderer';
|
|
3
|
-
|
|
4
|
-
import
|
|
3
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
+
import ConnectingWifiDevice from '../ConnectingWifiDevice';
|
|
5
5
|
import { SCProvider } from '../../../context';
|
|
6
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
-
import
|
|
7
|
+
import api from '../../../utils/Apis/axios';
|
|
8
|
+
import Processing from '../../../commons/Processing';
|
|
8
9
|
|
|
9
10
|
const wrapComponent = (route) => (
|
|
10
11
|
<SCProvider initState={mockSCStore({})}>
|
|
11
|
-
<
|
|
12
|
+
<ConnectingWifiDevice route={route} />
|
|
12
13
|
</SCProvider>
|
|
13
14
|
);
|
|
14
15
|
|
|
16
|
+
const mock = new MockAdapter(api.axiosInstance);
|
|
17
|
+
|
|
15
18
|
jest.mock('react', () => {
|
|
16
19
|
return { ...jest.requireActual('react'), memo: (x) => x };
|
|
17
20
|
});
|
|
@@ -26,11 +29,10 @@ jest.mock('@react-navigation/native', () => {
|
|
|
26
29
|
navigate: mockedNavigate,
|
|
27
30
|
goBack: mockedGoBack,
|
|
28
31
|
}),
|
|
29
|
-
useIsFocused: () => true,
|
|
30
32
|
};
|
|
31
33
|
});
|
|
32
34
|
|
|
33
|
-
describe('Test
|
|
35
|
+
describe('Test connecting wifi device', () => {
|
|
34
36
|
let tree;
|
|
35
37
|
let route;
|
|
36
38
|
|
|
@@ -41,17 +43,20 @@ describe('Test AddNewGatewaySelectGateway', () => {
|
|
|
41
43
|
beforeEach(() => {
|
|
42
44
|
route = {
|
|
43
45
|
params: {
|
|
44
|
-
|
|
46
|
+
unitId: 1,
|
|
47
|
+
stationId: 2,
|
|
48
|
+
gateway: {},
|
|
49
|
+
selectedWifi: {},
|
|
45
50
|
},
|
|
46
51
|
};
|
|
47
52
|
});
|
|
48
53
|
|
|
49
|
-
test('
|
|
54
|
+
test('rendering', async () => {
|
|
50
55
|
await act(async () => {
|
|
51
56
|
tree = await create(wrapComponent(route));
|
|
52
57
|
});
|
|
53
58
|
const instance = tree.root;
|
|
54
|
-
|
|
55
|
-
expect(
|
|
59
|
+
expect(instance.findAllByType(Processing)).toHaveLength(1);
|
|
60
|
+
expect(mock.history.post).toHaveLength(1);
|
|
56
61
|
});
|
|
57
62
|
});
|