@eohjsc/react-native-smart-city 0.3.30 → 0.3.33
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/Images/DevMode/close.png +0 -0
- package/src/Images/DevMode/close@2x.png +0 -0
- package/src/Images/DevMode/close@3x.png +0 -0
- package/src/Images/DevMode/plus.png +0 -0
- package/src/Images/DevMode/plus@2x.png +0 -0
- package/src/Images/DevMode/plus@3x.png +0 -0
- package/src/Images/DevMode/remove_circle.png +0 -0
- package/src/Images/DevMode/remove_circle@2x.png +0 -0
- package/src/Images/DevMode/remove_circle@3x.png +0 -0
- package/src/commons/Action/ItemQuickAction.js +20 -4
- package/src/commons/Action/__test__/ItemQuickAction.test.js +35 -11
- package/src/commons/ActionGroup/ColorPickerTemplate.js +36 -17
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +6 -6
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +23 -15
- 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 +38 -45
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLockStyle.js +1 -0
- 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 +9 -10
- package/src/commons/ActionGroup/OnOffTemplate/index.js +30 -12
- package/src/commons/ActionGroup/OneBigButtonTemplate.js +5 -5
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +51 -28
- package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -2
- 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 +21 -7
- package/src/commons/ActionGroup/ThreeButtonTemplate.js +50 -60
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +135 -133
- 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 +7 -5
- package/src/commons/ActionGroup/index.js +35 -10
- package/src/commons/ActionTemplate/OnOffButtonAction.js +14 -5
- package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +23 -2
- package/src/commons/ActionTemplate/__test__/index.test.js +2 -0
- package/src/commons/ActionTemplate/index.js +1 -0
- 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 +22 -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/DevMode/CardDevMode.js +42 -0
- package/src/commons/DevMode/EmptyComponent.js +18 -0
- package/src/commons/DevMode/Item.js +21 -0
- package/src/commons/DevMode/Styles/CardStyles.js +40 -0
- package/src/commons/DevMode/Styles/EmptyComponentStyles.js +15 -0
- package/src/commons/DevMode/Styles/ItemStyles.js +27 -0
- package/src/commons/DevMode/Styles/TextWithLabelStyles.js +36 -0
- package/src/commons/DevMode/TextWithLabel.js +30 -0
- package/src/commons/DevMode/index.js +5 -1
- package/src/commons/Device/ConnectedViewHeader.js +2 -2
- package/src/commons/Device/DeviceAlertStatus.js +3 -3
- package/src/commons/Device/DisconnectedView.js +2 -2
- package/src/commons/Device/Emergency/EmergencyButton.js +2 -2
- package/src/commons/Device/Emergency/EmergencyDetail.js +1 -1
- 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/PMSensor/PMSensorIndicatior.js +1 -1
- package/src/commons/Device/RainningSensor/CurrentRainSensor.js +1 -1
- package/src/commons/Device/SensorConnectedStatus.js +5 -2
- package/src/commons/Device/WindDirection/Compass/index.js +6 -3
- package/src/commons/Device/WindSpeed/Anemometer/index.js +1 -1
- 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/Header/HeaderCustom.js +8 -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 +5 -4
- package/src/commons/NavBar/index.js +2 -3
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +12 -6
- 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 +6 -4
- 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/Tabbar/__test__/index.test.js +97 -0
- 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 +12 -14
- package/src/configs/AccessibilityLabel.js +611 -0
- package/src/configs/Colors.js +4 -0
- package/src/configs/Constants.js +1 -604
- package/src/configs/Images.js +3 -0
- package/src/context/actionType.ts +19 -3
- package/src/context/mockStore.ts +18 -3
- package/src/context/reducer.ts +66 -9
- package/src/hoc/__test__/withRemoteControl.test.js +24 -0
- package/src/hoc/withRemoteControl.js +1 -0
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +55 -0
- package/src/hooks/Common/index.js +2 -2
- package/src/hooks/Common/useDevicesStatus.js +19 -15
- 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/hooks/__test__/useInitDeepLink.test.js +28 -0
- package/src/hooks/useReceiveNotifications.js +2 -4
- 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 +28 -4
- 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 +16 -7
- 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 +27 -0
- 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/DetailHistoryChart.js +7 -5
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +6 -6
- package/src/screens/Device/components/SensorDisplayItem.js +51 -26
- package/src/screens/Device/detail.js +31 -23
- 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 +30 -13
- 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 +43 -38
- package/src/screens/ScriptDetail/index.js +26 -16
- 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 → DeviceItem.js} +16 -22
- package/src/screens/Sharing/Components/Styles/{SensorItemStyles.js → DeviceItemStyles.js} +0 -0
- package/src/screens/Sharing/Components/__test__/{SensorItem.test.js → DeviceItem.test.js} +10 -8
- package/src/screens/Sharing/Components/index.js +2 -2
- package/src/screens/Sharing/InfoMemberUnit.js +7 -6
- package/src/screens/Sharing/MemberList.js +4 -4
- package/src/screens/Sharing/SelectPermission.js +72 -72
- package/src/screens/Sharing/SelectUser.js +9 -5
- package/src/screens/Sharing/Styles/SelectPermissionStyles.js +2 -2
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +3 -2
- package/src/screens/Sharing/__test__/SelectPermission.test.js +12 -12
- 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 +152 -0
- package/src/screens/Template/GatewayList.js +51 -0
- package/src/screens/Template/Information.js +41 -0
- package/src/screens/Template/Styles/EditTemplateStyle.js +109 -0
- package/src/screens/Template/Styles/GatewayStyles.js +46 -0
- package/src/screens/Template/Styles/InformationStyles.js +16 -0
- package/src/screens/Template/Styles/detailStyles.js +35 -0
- package/src/screens/Template/Styles/indexStyles.js +2 -33
- package/src/screens/Template/__test__/EditTemplate.test.js +89 -0
- package/src/screens/Template/__test__/GatewayList.test.js +26 -0
- package/src/screens/Template/__test__/Information.test.js +16 -0
- package/src/screens/Template/__test__/detail.test.js +68 -0
- package/src/screens/Template/__test__/index.test.js +26 -1
- package/src/screens/Template/detail.js +154 -0
- package/src/screens/Template/index.js +38 -32
- 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/SmartAccount.js +1 -1
- package/src/screens/Unit/SmartAccountItem.js +3 -3
- package/src/screens/Unit/Station/__test__/index.test.js +19 -3
- 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 +90 -55
- 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__/SmartAccount.test.js +42 -25
- 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 +20 -10
- package/src/utils/I18n/translations/vi.json +17 -9
- package/src/utils/Route/index.js +22 -10
- package/src/utils/Utils.js +6 -7
- 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,213 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useCallback, useState } from 'react';
|
|
2
|
-
import { SafeAreaView, View, TouchableOpacity } from 'react-native';
|
|
3
|
-
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
|
-
import Routes from '../../utils/Route';
|
|
5
|
-
import { useNavigation } from '@react-navigation/native';
|
|
6
|
-
import ImageSuccessfully from '../../Images/Common/SuccessfullyConnected.svg';
|
|
7
|
-
|
|
8
|
-
import Text from '../Text';
|
|
9
|
-
import { axiosPatch, axiosPost } from '../../utils/Apis/axios';
|
|
10
|
-
import { API, Colors } from '../../configs';
|
|
11
|
-
import styles from './styles';
|
|
12
|
-
import DeviceItem from './DeviceItem/DeviceItem';
|
|
13
|
-
import Connecting from '../Connecting';
|
|
14
|
-
import { useSCContextSelector } from '../../context';
|
|
15
|
-
|
|
16
|
-
const ConnectingSuccess = ({
|
|
17
|
-
unit,
|
|
18
|
-
sensor,
|
|
19
|
-
station,
|
|
20
|
-
unit_name,
|
|
21
|
-
newName,
|
|
22
|
-
setNewName,
|
|
23
|
-
isSelection,
|
|
24
|
-
handleSelectionChange,
|
|
25
|
-
}) => {
|
|
26
|
-
const t = useTranslations();
|
|
27
|
-
return (
|
|
28
|
-
<View style={styles.ConnectingSuccess}>
|
|
29
|
-
<ImageSuccessfully />
|
|
30
|
-
<Text bold style={styles.connectingText}>
|
|
31
|
-
{t('successfully_connected')}
|
|
32
|
-
</Text>
|
|
33
|
-
<Text size={14} style={styles.textHome}>
|
|
34
|
-
{`${unit?.name || unit_name} ${
|
|
35
|
-
station?.name !== undefined ? '- ' + station?.name : ''
|
|
36
|
-
}`}
|
|
37
|
-
</Text>
|
|
38
|
-
<DeviceItem
|
|
39
|
-
icon={sensor?.icon_kit}
|
|
40
|
-
name={newName}
|
|
41
|
-
setNewName={setNewName}
|
|
42
|
-
handleSelectionChange={handleSelectionChange}
|
|
43
|
-
isSelection={isSelection}
|
|
44
|
-
/>
|
|
45
|
-
</View>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const ConnectingProcess = ({ route }) => {
|
|
50
|
-
const { navigate, goBack } = useNavigation();
|
|
51
|
-
const t = useTranslations();
|
|
52
|
-
|
|
53
|
-
const {
|
|
54
|
-
scan_sensor_data,
|
|
55
|
-
gateway,
|
|
56
|
-
station,
|
|
57
|
-
unit,
|
|
58
|
-
unit_id,
|
|
59
|
-
unit_name,
|
|
60
|
-
devicePrefixName,
|
|
61
|
-
wifi_ssid,
|
|
62
|
-
wifi_pass,
|
|
63
|
-
} = route.params || {};
|
|
64
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
65
|
-
const [sensor, setSensor] = useState(null);
|
|
66
|
-
const user = useSCContextSelector((state) => state?.auth?.account?.user);
|
|
67
|
-
const [newName, setNewName] = useState('');
|
|
68
|
-
const [isSelection, setIsSelection] = useState(true);
|
|
69
|
-
|
|
70
|
-
const connectingDevice = useCallback(async () => {
|
|
71
|
-
setIsLoading(true);
|
|
72
|
-
switch (devicePrefixName) {
|
|
73
|
-
case 'SENSOR': {
|
|
74
|
-
const body = { imei: scan_sensor_data?.imei, chip: gateway?.id };
|
|
75
|
-
const { success, data } = await axiosPost(
|
|
76
|
-
API.SUB_UNIT.SENSOR_SCAN(station.id),
|
|
77
|
-
body
|
|
78
|
-
);
|
|
79
|
-
if (success) {
|
|
80
|
-
setSensor(data);
|
|
81
|
-
setNewName(data?.name);
|
|
82
|
-
} else {
|
|
83
|
-
goBack();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
case 'ROBOT': {
|
|
89
|
-
const { success, data } = await axiosPost(API.UNIT.CHIP_SCAN(unit.id), {
|
|
90
|
-
imei: gateway?.imei,
|
|
91
|
-
qr_code: scan_sensor_data?.imei,
|
|
92
|
-
name: gateway?.model,
|
|
93
|
-
station: station?.id,
|
|
94
|
-
wifi_ssid: wifi_ssid,
|
|
95
|
-
wifi_pass: wifi_pass,
|
|
96
|
-
phone: user?.phone_number,
|
|
97
|
-
});
|
|
98
|
-
if (success) {
|
|
99
|
-
setSensor(data);
|
|
100
|
-
setNewName(data?.name);
|
|
101
|
-
} else {
|
|
102
|
-
goBack();
|
|
103
|
-
}
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
case 'LITE': {
|
|
107
|
-
const { success, data } = await axiosPost(
|
|
108
|
-
API.UNIT.ADD_GATEWAY(unit_id),
|
|
109
|
-
{
|
|
110
|
-
imei: gateway?.imei,
|
|
111
|
-
chip_name: gateway?.model,
|
|
112
|
-
}
|
|
113
|
-
);
|
|
114
|
-
if (success) {
|
|
115
|
-
setSensor(data);
|
|
116
|
-
setNewName(data?.name || gateway?.model);
|
|
117
|
-
} else {
|
|
118
|
-
goBack();
|
|
119
|
-
}
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
setIsLoading(false);
|
|
124
|
-
}, [
|
|
125
|
-
devicePrefixName,
|
|
126
|
-
scan_sensor_data?.imei,
|
|
127
|
-
gateway?.id,
|
|
128
|
-
gateway?.imei,
|
|
129
|
-
gateway?.model,
|
|
130
|
-
station,
|
|
131
|
-
goBack,
|
|
132
|
-
unit,
|
|
133
|
-
wifi_ssid,
|
|
134
|
-
wifi_pass,
|
|
135
|
-
user?.phone_number,
|
|
136
|
-
unit_id,
|
|
137
|
-
]);
|
|
138
|
-
|
|
139
|
-
const handleDone = useCallback(async () => {
|
|
140
|
-
switch (devicePrefixName) {
|
|
141
|
-
case 'SENSOR': {
|
|
142
|
-
await axiosPatch(API.SENSOR.SENSOR_DETAIL(sensor?.id), {
|
|
143
|
-
name: newName,
|
|
144
|
-
});
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
case 'ROBOT':
|
|
148
|
-
case 'LITE': {
|
|
149
|
-
await axiosPatch(API.CHIP.CHIP_DETAIL(sensor?.id), {
|
|
150
|
-
name: newName,
|
|
151
|
-
});
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
navigate(Routes.UnitStack, {
|
|
156
|
-
screen: Routes.UnitDetail,
|
|
157
|
-
params: {
|
|
158
|
-
unitId: unit?.id || unit_id,
|
|
159
|
-
unitData: unit,
|
|
160
|
-
routeName: 'DashboardStack',
|
|
161
|
-
stationId: station?.id,
|
|
162
|
-
},
|
|
163
|
-
});
|
|
164
|
-
}, [
|
|
165
|
-
devicePrefixName,
|
|
166
|
-
navigate,
|
|
167
|
-
newName,
|
|
168
|
-
sensor?.id,
|
|
169
|
-
station?.id,
|
|
170
|
-
unit,
|
|
171
|
-
unit_id,
|
|
172
|
-
]);
|
|
173
|
-
|
|
174
|
-
const handleSelectionChange = useCallback(() => {
|
|
175
|
-
setIsSelection(false);
|
|
176
|
-
}, []);
|
|
177
|
-
|
|
178
|
-
useEffect(() => {
|
|
179
|
-
connectingDevice();
|
|
180
|
-
}, [connectingDevice]);
|
|
181
|
-
|
|
182
|
-
return (
|
|
183
|
-
<SafeAreaView style={styles.wrap}>
|
|
184
|
-
<View style={styles.boxText}>
|
|
185
|
-
<Text bold style={styles.connectingText}>
|
|
186
|
-
{t('connect_device')}
|
|
187
|
-
</Text>
|
|
188
|
-
{!!isLoading && <Connecting isLoading={isLoading} />}
|
|
189
|
-
{!isLoading && (
|
|
190
|
-
<ConnectingSuccess
|
|
191
|
-
unit={unit}
|
|
192
|
-
sensor={sensor}
|
|
193
|
-
station={station}
|
|
194
|
-
unit_name={unit_name}
|
|
195
|
-
newName={newName}
|
|
196
|
-
setNewName={setNewName}
|
|
197
|
-
isSelection={isSelection}
|
|
198
|
-
handleSelectionChange={handleSelectionChange}
|
|
199
|
-
/>
|
|
200
|
-
)}
|
|
201
|
-
</View>
|
|
202
|
-
{!isLoading && (
|
|
203
|
-
<TouchableOpacity style={styles.buttonDone} onPress={handleDone}>
|
|
204
|
-
<Text color={Colors.Primary} type={'H4'}>
|
|
205
|
-
{t('done')}
|
|
206
|
-
</Text>
|
|
207
|
-
</TouchableOpacity>
|
|
208
|
-
)}
|
|
209
|
-
</SafeAreaView>
|
|
210
|
-
);
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
export default ConnectingProcess;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { Colors } from '../../configs';
|
|
3
|
-
import {
|
|
4
|
-
getStatusBarHeight,
|
|
5
|
-
getBottomSpace,
|
|
6
|
-
} from 'react-native-iphone-x-helper';
|
|
7
|
-
|
|
8
|
-
export default StyleSheet.create({
|
|
9
|
-
wrap: {
|
|
10
|
-
paddingTop: getStatusBarHeight(true),
|
|
11
|
-
backgroundColor: Colors.White,
|
|
12
|
-
width: '100%',
|
|
13
|
-
height: '100%',
|
|
14
|
-
justifyContent: 'space-between',
|
|
15
|
-
},
|
|
16
|
-
connectingText: {
|
|
17
|
-
marginLeft: 30,
|
|
18
|
-
marginTop: 16,
|
|
19
|
-
fontSize: 20,
|
|
20
|
-
color: Colors.Gray9,
|
|
21
|
-
},
|
|
22
|
-
animatedEllipsis: {
|
|
23
|
-
fontSize: 25,
|
|
24
|
-
color: Colors.Gray9,
|
|
25
|
-
marginTop: 14,
|
|
26
|
-
},
|
|
27
|
-
warningText: {
|
|
28
|
-
marginHorizontal: 30,
|
|
29
|
-
marginTop: 16,
|
|
30
|
-
fontSize: 14,
|
|
31
|
-
color: Colors.Gray8,
|
|
32
|
-
},
|
|
33
|
-
boxText: {
|
|
34
|
-
flex: 1,
|
|
35
|
-
},
|
|
36
|
-
progressBar: {
|
|
37
|
-
flexDirection: 'column',
|
|
38
|
-
marginTop: 180,
|
|
39
|
-
marginHorizontal: 30,
|
|
40
|
-
},
|
|
41
|
-
connecting: {
|
|
42
|
-
flexDirection: 'row',
|
|
43
|
-
justifyContent: 'center',
|
|
44
|
-
marginBottom: 10,
|
|
45
|
-
},
|
|
46
|
-
percentLoad: {
|
|
47
|
-
flexDirection: 'row',
|
|
48
|
-
justifyContent: 'center',
|
|
49
|
-
alignItems: 'center',
|
|
50
|
-
},
|
|
51
|
-
textPercentLoad: {
|
|
52
|
-
marginLeft: 10,
|
|
53
|
-
},
|
|
54
|
-
ConnectingSuccess: {
|
|
55
|
-
marginTop: 180,
|
|
56
|
-
justifyContent: 'center',
|
|
57
|
-
alignItems: 'center',
|
|
58
|
-
},
|
|
59
|
-
textHome: {
|
|
60
|
-
paddingTop: 16,
|
|
61
|
-
paddingBottom: 8,
|
|
62
|
-
},
|
|
63
|
-
buttonDone: {
|
|
64
|
-
width: '100%',
|
|
65
|
-
justifyContent: 'center',
|
|
66
|
-
alignItems: 'center',
|
|
67
|
-
paddingBottom: getBottomSpace() + 24,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { useContext, useCallback } from 'react';
|
|
2
|
-
import { SCContext, useSCContextSelector } from '../../context';
|
|
3
|
-
import { Action } from '../../context/actionType';
|
|
4
|
-
import {
|
|
5
|
-
googleHomeConnect,
|
|
6
|
-
googleHomeDisconnect,
|
|
7
|
-
} from '../../iot/RemoteControl/GoogleHome';
|
|
8
|
-
import { axiosPost } from '../../utils/Apis/axios';
|
|
9
|
-
import { API } from '../../configs';
|
|
10
|
-
|
|
11
|
-
const useGGHomeConnection = () => {
|
|
12
|
-
const { setAction } = useContext(SCContext);
|
|
13
|
-
const { connections } = useSCContextSelector((state) => state.iot.googlehome);
|
|
14
|
-
const { listDevice } = useSCContextSelector((state) => state);
|
|
15
|
-
|
|
16
|
-
const onEstablished = useCallback(
|
|
17
|
-
async (newConnections, options) => {
|
|
18
|
-
setAction(Action.SET_GOOGLE_HOME_CONNECTIONS, newConnections);
|
|
19
|
-
|
|
20
|
-
const isConnected = options.some(
|
|
21
|
-
(option) => !!newConnections[option.chip_id]
|
|
22
|
-
);
|
|
23
|
-
let chipId = options[0].chip_id;
|
|
24
|
-
if (!isConnected) {
|
|
25
|
-
setAction(Action.LIST_DEVICE_TYPES, {
|
|
26
|
-
chipId: chipId,
|
|
27
|
-
sentEmail: true,
|
|
28
|
-
});
|
|
29
|
-
await axiosPost(API.GOOGLE_HOME.CHECK_SEND_EMAIL(), {
|
|
30
|
-
chip_id: chipId,
|
|
31
|
-
is_connected: false,
|
|
32
|
-
});
|
|
33
|
-
} else if (isConnected && listDevice[chipId]?.sentEmail) {
|
|
34
|
-
setAction(Action.LIST_DEVICE_TYPES, {
|
|
35
|
-
chipId: chipId,
|
|
36
|
-
sentEmail: false,
|
|
37
|
-
});
|
|
38
|
-
await axiosPost(API.GOOGLE_HOME.CHECK_SEND_EMAIL(), {
|
|
39
|
-
chip_id: chipId,
|
|
40
|
-
is_connected: true,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
[setAction, listDevice]
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const onDisconnected = useCallback(
|
|
48
|
-
async (option) => {
|
|
49
|
-
setAction(Action.CHANGE_GOOGLE_HOME_CONN_STATE, { option, data: 0 });
|
|
50
|
-
},
|
|
51
|
-
[setAction]
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const onReconnected = useCallback(
|
|
55
|
-
async (option, connection) => {
|
|
56
|
-
setAction(Action.CHANGE_GOOGLE_HOME_CONN_STATE, {
|
|
57
|
-
option,
|
|
58
|
-
data: connection,
|
|
59
|
-
});
|
|
60
|
-
},
|
|
61
|
-
[setAction]
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const connectGoogleHome = useCallback(
|
|
65
|
-
async (options) => {
|
|
66
|
-
await googleHomeConnect(
|
|
67
|
-
connections,
|
|
68
|
-
options,
|
|
69
|
-
onEstablished,
|
|
70
|
-
onDisconnected,
|
|
71
|
-
onReconnected
|
|
72
|
-
);
|
|
73
|
-
},
|
|
74
|
-
[connections, onEstablished, onDisconnected, onReconnected]
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
const disconnectGoogleHome = useCallback(
|
|
78
|
-
async (options) => {
|
|
79
|
-
await googleHomeDisconnect(connections, options);
|
|
80
|
-
setAction(Action.SET_GOOGLE_HOME_CONNECTIONS, {});
|
|
81
|
-
},
|
|
82
|
-
[setAction, connections]
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
connectGoogleHome,
|
|
87
|
-
disconnectGoogleHome,
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export default useGGHomeConnection;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// import {
|
|
2
|
-
// SEND_COMMAND_OVER_BLUETOOTH_FAIL,
|
|
3
|
-
// sendCommandOverBluetooth,
|
|
4
|
-
// } from './Bluetooth';
|
|
5
|
-
// import { sendCommandOverInternet } from './Internet';
|
|
6
|
-
// import { sendCommandOverGoogleHome } from './GoogleHome';
|
|
7
|
-
// import { ToastBottomHelper } from '../../utils/Utils';
|
|
8
|
-
// import t from '../../hooks/Common/useTranslations';
|
|
9
|
-
// import { sendCommandOverLGThinq } from './LG';
|
|
10
|
-
|
|
11
|
-
// export const sendRemoteCommand = async (
|
|
12
|
-
// sensor,
|
|
13
|
-
// action,
|
|
14
|
-
// data,
|
|
15
|
-
// userId = null,
|
|
16
|
-
// actionName
|
|
17
|
-
// ) => {
|
|
18
|
-
// // No action, raise not authorized
|
|
19
|
-
// let result = false;
|
|
20
|
-
// if (!action) {
|
|
21
|
-
// ToastBottomHelper.error(
|
|
22
|
-
// t('your_account_has_not_been_authorized_to_control')
|
|
23
|
-
// );
|
|
24
|
-
// return result;
|
|
25
|
-
// }
|
|
26
|
-
// if (action.command_prefer_over_bluetooth) {
|
|
27
|
-
// try {
|
|
28
|
-
// result = await sendCommandOverBluetooth(sensor, action, data, userId);
|
|
29
|
-
// } catch (err) {
|
|
30
|
-
// if (err === SEND_COMMAND_OVER_BLUETOOTH_FAIL) {
|
|
31
|
-
// result = await sendCommandOverInternet(
|
|
32
|
-
// sensor,
|
|
33
|
-
// action,
|
|
34
|
-
// data,
|
|
35
|
-
// 'bluetooth',
|
|
36
|
-
// actionName
|
|
37
|
-
// );
|
|
38
|
-
// } else {
|
|
39
|
-
// throw err;
|
|
40
|
-
// }
|
|
41
|
-
// }
|
|
42
|
-
// }
|
|
43
|
-
// if (action.command_prefer_over_internet) {
|
|
44
|
-
// result = await sendCommandOverInternet(sensor, action, data, 'internet');
|
|
45
|
-
// }
|
|
46
|
-
|
|
47
|
-
// if (action.command_prefer_over_googlehome) {
|
|
48
|
-
// result = await sendCommandOverGoogleHome(sensor, action, data);
|
|
49
|
-
// }
|
|
50
|
-
|
|
51
|
-
// if (action.command_prefer_over_lg) {
|
|
52
|
-
// result = await sendCommandOverLGThinq(sensor, action, data);
|
|
53
|
-
// }
|
|
54
|
-
// return result;
|
|
55
|
-
// };
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import React, { memo, useCallback } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
|
-
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
|
-
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
5
|
-
|
|
6
|
-
import { Colors } from '../../configs';
|
|
7
|
-
import Text from '../../commons/Text';
|
|
8
|
-
import _TextInput from '../../commons/Form/TextInput';
|
|
9
|
-
import { AlertAction } from '../../commons';
|
|
10
|
-
import SvgDoor from '../../../assets/images/Device/door.svg';
|
|
11
|
-
|
|
12
|
-
import { useConnectDevices } from './hooks/ConnectDevices';
|
|
13
|
-
import { useStateAlertRename } from './hooks/useStateAlertRename';
|
|
14
|
-
import { TESTID } from '../../configs/Constants';
|
|
15
|
-
|
|
16
|
-
const ConnectDevices = memo(({ route }) => {
|
|
17
|
-
const t = useTranslations();
|
|
18
|
-
const { new_sensor, station_id, unit_id, unit_name } = route.params;
|
|
19
|
-
const {
|
|
20
|
-
onPressDone,
|
|
21
|
-
onChangeTemporaryDeviceName,
|
|
22
|
-
temporaryDeviceName,
|
|
23
|
-
deviceName,
|
|
24
|
-
setDeviceName,
|
|
25
|
-
} = useConnectDevices(new_sensor, station_id, unit_id);
|
|
26
|
-
const { stateAlertRename, onShowRenameAlert, hideAlertAction } =
|
|
27
|
-
useStateAlertRename();
|
|
28
|
-
|
|
29
|
-
const onPressRename = useCallback(() => {
|
|
30
|
-
setDeviceName(temporaryDeviceName);
|
|
31
|
-
hideAlertAction();
|
|
32
|
-
}, [hideAlertAction, setDeviceName, temporaryDeviceName]);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<View style={styles.container}>
|
|
36
|
-
<View style={styles.content}>
|
|
37
|
-
<IconOutline name="check-circle" size={28} color={Colors.Green6} />
|
|
38
|
-
<Text
|
|
39
|
-
testID={TESTID.CONNECTED_DEVICE_SUCCESS}
|
|
40
|
-
semibold
|
|
41
|
-
color={Colors.Black}
|
|
42
|
-
size={20}
|
|
43
|
-
style={styles.textStatus}
|
|
44
|
-
>
|
|
45
|
-
{t('successfully_connected')}
|
|
46
|
-
</Text>
|
|
47
|
-
<Text
|
|
48
|
-
testID={TESTID.CONNECTED_DEVICE_UNIT_NAME}
|
|
49
|
-
size={14}
|
|
50
|
-
color={Colors.Gray9}
|
|
51
|
-
style={styles.textStation}
|
|
52
|
-
>
|
|
53
|
-
{unit_name}
|
|
54
|
-
</Text>
|
|
55
|
-
|
|
56
|
-
<View style={styles.boxDevice}>
|
|
57
|
-
<SvgDoor />
|
|
58
|
-
<Text
|
|
59
|
-
testID={TESTID.CONNECTED_DEVICE_DEVICE_NAME}
|
|
60
|
-
size={16}
|
|
61
|
-
color={Colors.Gray9}
|
|
62
|
-
style={styles.textDeviceName}
|
|
63
|
-
>
|
|
64
|
-
{deviceName}
|
|
65
|
-
</Text>
|
|
66
|
-
</View>
|
|
67
|
-
|
|
68
|
-
<TouchableOpacity
|
|
69
|
-
testID={TESTID.CONNECTED_DEVICE_BUTTON_RENAME_DEVICE}
|
|
70
|
-
style={styles.textRename}
|
|
71
|
-
onPress={onShowRenameAlert}
|
|
72
|
-
>
|
|
73
|
-
<Text
|
|
74
|
-
testID={TESTID.CONNECTED_DEVICE_RENAME_DEVICE}
|
|
75
|
-
size={14}
|
|
76
|
-
color={Colors.Orange}
|
|
77
|
-
>
|
|
78
|
-
{t('rename_your_device')}
|
|
79
|
-
</Text>
|
|
80
|
-
</TouchableOpacity>
|
|
81
|
-
</View>
|
|
82
|
-
<TouchableOpacity style={styles.btnDone} onPress={onPressDone}>
|
|
83
|
-
<Text
|
|
84
|
-
testID={TESTID.CONNECTED_DEVICE_DONE}
|
|
85
|
-
semibold
|
|
86
|
-
size={16}
|
|
87
|
-
color={Colors.Primary}
|
|
88
|
-
>
|
|
89
|
-
{t('done')}
|
|
90
|
-
</Text>
|
|
91
|
-
</TouchableOpacity>
|
|
92
|
-
<AlertAction
|
|
93
|
-
visible={stateAlertRename.visible}
|
|
94
|
-
hideModal={hideAlertAction}
|
|
95
|
-
title={stateAlertRename.title}
|
|
96
|
-
message={stateAlertRename.message}
|
|
97
|
-
leftButtonTitle={stateAlertRename.leftButton}
|
|
98
|
-
leftButtonClick={hideAlertAction}
|
|
99
|
-
rightButtonTitle={stateAlertRename.rightButton}
|
|
100
|
-
rightButtonClick={onPressRename}
|
|
101
|
-
>
|
|
102
|
-
<View style={styles.wrapRename}>
|
|
103
|
-
<_TextInput
|
|
104
|
-
value={temporaryDeviceName}
|
|
105
|
-
onChange={onChangeTemporaryDeviceName}
|
|
106
|
-
textInputStyle={styles.roomName}
|
|
107
|
-
wrapStyle={styles.textInput}
|
|
108
|
-
selectionColor={Colors.Primary}
|
|
109
|
-
/>
|
|
110
|
-
</View>
|
|
111
|
-
</AlertAction>
|
|
112
|
-
</View>
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
export default ConnectDevices;
|
|
117
|
-
|
|
118
|
-
const styles = StyleSheet.create({
|
|
119
|
-
container: {
|
|
120
|
-
flex: 1,
|
|
121
|
-
backgroundColor: Colors.Gray19,
|
|
122
|
-
justifyContent: 'center',
|
|
123
|
-
alignItems: 'center',
|
|
124
|
-
},
|
|
125
|
-
boxDevice: {
|
|
126
|
-
padding: 16,
|
|
127
|
-
flexDirection: 'row',
|
|
128
|
-
borderWidth: 1,
|
|
129
|
-
borderRadius: 10,
|
|
130
|
-
borderColor: Colors.Gray4,
|
|
131
|
-
backgroundColor: Colors.White,
|
|
132
|
-
alignItems: 'center',
|
|
133
|
-
shadowColor: Colors.Shadow,
|
|
134
|
-
shadowOffset: {
|
|
135
|
-
width: 0,
|
|
136
|
-
height: 8,
|
|
137
|
-
},
|
|
138
|
-
shadowOpacity: 1,
|
|
139
|
-
shadowRadius: 12,
|
|
140
|
-
elevation: 2,
|
|
141
|
-
},
|
|
142
|
-
content: {
|
|
143
|
-
flex: 1,
|
|
144
|
-
backgroundColor: Colors.Gray19,
|
|
145
|
-
justifyContent: 'center',
|
|
146
|
-
alignItems: 'center',
|
|
147
|
-
},
|
|
148
|
-
btnDone: {
|
|
149
|
-
height: 48,
|
|
150
|
-
width: '100%',
|
|
151
|
-
alignItems: 'center',
|
|
152
|
-
},
|
|
153
|
-
textStatus: {
|
|
154
|
-
lineHeight: 28,
|
|
155
|
-
marginTop: 8,
|
|
156
|
-
marginBottom: 16,
|
|
157
|
-
},
|
|
158
|
-
textStation: {
|
|
159
|
-
lineHeight: 22,
|
|
160
|
-
marginBottom: 8,
|
|
161
|
-
},
|
|
162
|
-
textDeviceName: {
|
|
163
|
-
marginLeft: 8,
|
|
164
|
-
},
|
|
165
|
-
textRename: {
|
|
166
|
-
marginTop: 16,
|
|
167
|
-
},
|
|
168
|
-
textInput: {
|
|
169
|
-
marginTop: 0,
|
|
170
|
-
},
|
|
171
|
-
roomName: {
|
|
172
|
-
borderWidth: 0,
|
|
173
|
-
borderBottomWidth: 1,
|
|
174
|
-
borderBottomColor: Colors.Primary,
|
|
175
|
-
paddingLeft: 0,
|
|
176
|
-
fontSize: 16,
|
|
177
|
-
lineHeight: 24,
|
|
178
|
-
margin: 0,
|
|
179
|
-
padding: 0,
|
|
180
|
-
},
|
|
181
|
-
wrapRename: {
|
|
182
|
-
marginHorizontal: 16,
|
|
183
|
-
},
|
|
184
|
-
});
|