@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,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
2
|
import { StyleSheet, View, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
|
-
import {
|
|
4
|
+
import { useHomeAssistantDeviceConnected } from '../../../../hooks/Common';
|
|
5
5
|
|
|
6
6
|
import ItemQuickAction from '../../../../commons/Action/ItemQuickAction';
|
|
7
7
|
import Text from '../../../../commons/Text';
|
|
@@ -11,7 +11,9 @@ import FImage from '../../../../commons/FImage';
|
|
|
11
11
|
import { DEVICE_TYPE } from '../../../../configs/Constants';
|
|
12
12
|
|
|
13
13
|
const MyUnitDevice = ({ device, unit }) => {
|
|
14
|
-
const [status, setStatus] = useState(
|
|
14
|
+
const [status, setStatus] = useState(
|
|
15
|
+
device?.is_managed_by_backend ? device.status : null
|
|
16
|
+
);
|
|
15
17
|
const { navigate } = useNavigation();
|
|
16
18
|
|
|
17
19
|
const goToSensorDisplay = useCallback(() => {
|
|
@@ -24,7 +26,8 @@ const MyUnitDevice = ({ device, unit }) => {
|
|
|
24
26
|
});
|
|
25
27
|
}, [navigate, device, unit]);
|
|
26
28
|
|
|
27
|
-
const { isConnecting:
|
|
29
|
+
const { isConnecting: isHomeAssistantConnecting } =
|
|
30
|
+
useHomeAssistantDeviceConnected(device);
|
|
28
31
|
|
|
29
32
|
const canRenderQuickAction = (() => {
|
|
30
33
|
if (
|
|
@@ -32,9 +35,9 @@ const MyUnitDevice = ({ device, unit }) => {
|
|
|
32
35
|
!device?.is_managed_by_backend &&
|
|
33
36
|
device?.device_type === DEVICE_TYPE.GOOGLE_HOME
|
|
34
37
|
) {
|
|
35
|
-
return !
|
|
38
|
+
return !isHomeAssistantConnecting;
|
|
36
39
|
}
|
|
37
|
-
return
|
|
40
|
+
return !!device?.action;
|
|
38
41
|
})();
|
|
39
42
|
|
|
40
43
|
return (
|
|
@@ -9,7 +9,7 @@ import Routes from '../../../../utils/Route';
|
|
|
9
9
|
import { axiosPost } from '../../../../utils/Apis/axios';
|
|
10
10
|
|
|
11
11
|
import styles from '../styles';
|
|
12
|
-
import {
|
|
12
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
13
13
|
|
|
14
14
|
const SharedUnit = ({
|
|
15
15
|
item,
|
|
@@ -67,7 +67,7 @@ const SharedUnit = ({
|
|
|
67
67
|
style={styles.row}
|
|
68
68
|
key={item.id.toString()}
|
|
69
69
|
onPress={() => goToDetail()}
|
|
70
|
-
|
|
70
|
+
accessibilityLabel={AccessibilityLabel.TOUCH_SHARED_UNIT}
|
|
71
71
|
>
|
|
72
72
|
<Image
|
|
73
73
|
source={{ uri: unit.icon }}
|
|
@@ -93,14 +93,16 @@ const SharedUnit = ({
|
|
|
93
93
|
size={20}
|
|
94
94
|
color={Colors.Blue10}
|
|
95
95
|
onPress={removePinSharedUnit}
|
|
96
|
-
|
|
96
|
+
accessibilityLabel={
|
|
97
|
+
AccessibilityLabel.ICON_REMOVE_PIN_SHARED_UNIT
|
|
98
|
+
}
|
|
97
99
|
/>
|
|
98
100
|
) : (
|
|
99
101
|
<IconOutline
|
|
100
102
|
name="pushpin"
|
|
101
103
|
size={20}
|
|
102
104
|
onPress={addPinSharedUnit}
|
|
103
|
-
|
|
105
|
+
accessibilityLabel={AccessibilityLabel.ICON_ADD_PIN_SHARED_UNIT}
|
|
104
106
|
/>
|
|
105
107
|
)}
|
|
106
108
|
{item.is_star ? (
|
|
@@ -109,14 +111,18 @@ const SharedUnit = ({
|
|
|
109
111
|
size={20}
|
|
110
112
|
color={Colors.Yellow6}
|
|
111
113
|
onPress={removeStarSharedUnit}
|
|
112
|
-
|
|
114
|
+
accessibilityLabel={
|
|
115
|
+
AccessibilityLabel.ICON_REMOVE_STAR_SHARED_UNIT
|
|
116
|
+
}
|
|
113
117
|
/>
|
|
114
118
|
) : (
|
|
115
119
|
<IconOutline
|
|
116
120
|
name="star"
|
|
117
121
|
size={20}
|
|
118
122
|
onPress={addStarSharedUnit}
|
|
119
|
-
|
|
123
|
+
accessibilityLabel={
|
|
124
|
+
AccessibilityLabel.ICON_ADD_STAR_SHARED_UNIT
|
|
125
|
+
}
|
|
120
126
|
/>
|
|
121
127
|
)}
|
|
122
128
|
</Fragment>
|
|
@@ -43,7 +43,7 @@ describe('Test MyUnitDevice', () => {
|
|
|
43
43
|
});
|
|
44
44
|
const instance = tree.root;
|
|
45
45
|
const Views = instance.findAllByType(View);
|
|
46
|
-
expect(Views).toHaveLength(
|
|
46
|
+
expect(Views).toHaveLength(11);
|
|
47
47
|
|
|
48
48
|
const touches = instance.findAllByType(TouchableOpacity);
|
|
49
49
|
expect(touches).toHaveLength(1);
|
|
@@ -60,6 +60,6 @@ describe('Test MyUnitDevice', () => {
|
|
|
60
60
|
});
|
|
61
61
|
const instance = tree.root;
|
|
62
62
|
const Views = instance.findAllByType(View);
|
|
63
|
-
expect(Views).toHaveLength(
|
|
63
|
+
expect(Views).toHaveLength(11);
|
|
64
64
|
});
|
|
65
65
|
});
|
|
@@ -4,7 +4,7 @@ import moment from 'moment';
|
|
|
4
4
|
import { useNavigation } from '@react-navigation/native';
|
|
5
5
|
import MockAdapter from 'axios-mock-adapter';
|
|
6
6
|
import SharedUnit from '../SharedUnit';
|
|
7
|
-
import {
|
|
7
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
8
8
|
import { API } from '../../../../configs';
|
|
9
9
|
import Routes from '../../../../utils/Route';
|
|
10
10
|
import { SCProvider } from '../../../../context';
|
|
@@ -64,7 +64,8 @@ describe('Test SharedUnit', () => {
|
|
|
64
64
|
});
|
|
65
65
|
const instance = tree.root;
|
|
66
66
|
const touchSharedUnit = instance.find(
|
|
67
|
-
(el) =>
|
|
67
|
+
(el) =>
|
|
68
|
+
el.props.accessibilityLabel === AccessibilityLabel.TOUCH_SHARED_UNIT
|
|
68
69
|
);
|
|
69
70
|
act(() => {
|
|
70
71
|
touchSharedUnit.props.onPress();
|
|
@@ -77,16 +78,22 @@ describe('Test SharedUnit', () => {
|
|
|
77
78
|
},
|
|
78
79
|
});
|
|
79
80
|
const iconRemovePinSharedUnit = instance.findAll(
|
|
80
|
-
(el) =>
|
|
81
|
+
(el) =>
|
|
82
|
+
el.props.accessibilityLabel ===
|
|
83
|
+
AccessibilityLabel.ICON_REMOVE_PIN_SHARED_UNIT
|
|
81
84
|
);
|
|
82
85
|
const iconAddPinSharedUnit = instance.find(
|
|
83
|
-
(el) =>
|
|
86
|
+
(el) =>
|
|
87
|
+
el.props.accessibilityLabel ===
|
|
88
|
+
AccessibilityLabel.ICON_ADD_PIN_SHARED_UNIT
|
|
84
89
|
);
|
|
85
90
|
act(() => {
|
|
86
91
|
iconAddPinSharedUnit.props.onPress();
|
|
87
92
|
});
|
|
88
93
|
const iconAddStarSharedUnit = instance.find(
|
|
89
|
-
(el) =>
|
|
94
|
+
(el) =>
|
|
95
|
+
el.props.accessibilityLabel ===
|
|
96
|
+
AccessibilityLabel.ICON_ADD_STAR_SHARED_UNIT
|
|
90
97
|
);
|
|
91
98
|
act(() => {
|
|
92
99
|
iconAddStarSharedUnit.props.onPress();
|
|
@@ -103,13 +110,17 @@ describe('Test SharedUnit', () => {
|
|
|
103
110
|
});
|
|
104
111
|
const instance = tree.root;
|
|
105
112
|
const iconRemovePinSharedUnit = instance.find(
|
|
106
|
-
(el) =>
|
|
113
|
+
(el) =>
|
|
114
|
+
el.props.accessibilityLabel ===
|
|
115
|
+
AccessibilityLabel.ICON_REMOVE_PIN_SHARED_UNIT
|
|
107
116
|
);
|
|
108
117
|
mock.onPost(API.UNIT.UNPIN_UNIT(3)).reply(200);
|
|
109
118
|
await iconRemovePinSharedUnit.props.onPress();
|
|
110
119
|
|
|
111
120
|
const iconRemoveStarSharedUnit = instance.find(
|
|
112
|
-
(el) =>
|
|
121
|
+
(el) =>
|
|
122
|
+
el.props.accessibilityLabel ===
|
|
123
|
+
AccessibilityLabel.ICON_REMOVE_STAR_SHARED_UNIT
|
|
113
124
|
);
|
|
114
125
|
mock.onPost(API.UNIT.UNSTAR_UNIT(3)).reply(200);
|
|
115
126
|
await iconRemoveStarSharedUnit.props.onPress();
|
|
@@ -125,13 +136,17 @@ describe('Test SharedUnit', () => {
|
|
|
125
136
|
});
|
|
126
137
|
const instance = tree.root;
|
|
127
138
|
const iconRemovePinSharedUnit = instance.find(
|
|
128
|
-
(el) =>
|
|
139
|
+
(el) =>
|
|
140
|
+
el.props.accessibilityLabel ===
|
|
141
|
+
AccessibilityLabel.ICON_REMOVE_PIN_SHARED_UNIT
|
|
129
142
|
);
|
|
130
143
|
mock.onPost(API.UNIT.UNPIN_UNIT(3)).reply(400);
|
|
131
144
|
await iconRemovePinSharedUnit.props.onPress();
|
|
132
145
|
|
|
133
146
|
const iconRemoveStarSharedUnit = instance.find(
|
|
134
|
-
(el) =>
|
|
147
|
+
(el) =>
|
|
148
|
+
el.props.accessibilityLabel ===
|
|
149
|
+
AccessibilityLabel.ICON_REMOVE_STAR_SHARED_UNIT
|
|
135
150
|
);
|
|
136
151
|
mock.onPost(API.UNIT.UNSTAR_UNIT(3)).reply(200);
|
|
137
152
|
await iconRemoveStarSharedUnit.props.onPress();
|
|
@@ -1,26 +1,40 @@
|
|
|
1
|
-
import { useEffect, useCallback } from 'react';
|
|
1
|
+
import { useEffect, useCallback, useContext } from 'react';
|
|
2
|
+
import { SCContext } from '../../../context';
|
|
3
|
+
import { Action } from '../../../context/actionType';
|
|
2
4
|
import { scanBluetoothDevices } from '../../../iot/RemoteControl/Bluetooth';
|
|
3
5
|
import { lgThinqConnect } from '../../../iot/RemoteControl/LG';
|
|
4
|
-
import {
|
|
6
|
+
import { useHomeAssistantConnection } from '../../../hooks/IoT';
|
|
5
7
|
import { useSCContextSelector } from '../../../context';
|
|
6
8
|
|
|
7
9
|
export const useUnitConnectRemoteDevices = (unit) => {
|
|
8
10
|
const isNetworkConnected = useSCContextSelector(
|
|
9
11
|
(state) => state.app.isNetworkConnected
|
|
10
12
|
);
|
|
13
|
+
const lqthinqUnitConnected = useSCContextSelector(
|
|
14
|
+
(state) => state.iot.lgthinq.unitConnected
|
|
15
|
+
);
|
|
16
|
+
const { setAction } = useContext(SCContext);
|
|
11
17
|
|
|
12
|
-
const {
|
|
18
|
+
const { connectHomeAssistant } = useHomeAssistantConnection();
|
|
13
19
|
|
|
14
20
|
let lgThinqConnected = false;
|
|
15
21
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
22
|
+
const onLgThinqConnected = useCallback(() => {
|
|
23
|
+
setAction(Action.SET_LG_THINQ_CONNECTED, unit?.id);
|
|
20
24
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
}, [unit]);
|
|
26
|
+
|
|
27
|
+
const handleLgThinqConnect = useCallback(
|
|
28
|
+
async (options) => {
|
|
29
|
+
if (lgThinqConnected || lqthinqUnitConnected.includes(unit?.id)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
+
lgThinqConnected = true;
|
|
34
|
+
await lgThinqConnect(options, onLgThinqConnected);
|
|
35
|
+
},
|
|
36
|
+
[lqthinqUnitConnected, unit]
|
|
37
|
+
);
|
|
24
38
|
|
|
25
39
|
useEffect(() => {
|
|
26
40
|
if (unit?.remote_control_options?.bluetooth) {
|
|
@@ -34,7 +48,7 @@ export const useUnitConnectRemoteDevices = (unit) => {
|
|
|
34
48
|
isNetworkConnected
|
|
35
49
|
) {
|
|
36
50
|
(async () => {
|
|
37
|
-
await
|
|
51
|
+
await connectHomeAssistant(unit.remote_control_options.googlehome);
|
|
38
52
|
})();
|
|
39
53
|
}
|
|
40
54
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -6,7 +6,7 @@ import { RefreshControl } from 'react-native';
|
|
|
6
6
|
import Routes from '../../../utils/Route';
|
|
7
7
|
import UnitSummary from '..';
|
|
8
8
|
import { API } from '../../../configs';
|
|
9
|
-
import {
|
|
9
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
10
10
|
import { TouchableOpacity } from 'react-native';
|
|
11
11
|
import AirQuality from '../../../commons/UnitSummary/AirQuality';
|
|
12
12
|
import PowerConsumption from '../components/PowerConsumption';
|
|
@@ -30,6 +30,7 @@ jest.mock('@react-navigation/native', () => {
|
|
|
30
30
|
useNavigation: () => ({
|
|
31
31
|
navigate: mockedNavigate,
|
|
32
32
|
}),
|
|
33
|
+
useFocusEffect: jest.fn(),
|
|
33
34
|
};
|
|
34
35
|
});
|
|
35
36
|
|
|
@@ -225,7 +226,8 @@ describe('Test UnitSummary', () => {
|
|
|
225
226
|
if (list_result[index].guideName) {
|
|
226
227
|
const touch = instance.find(
|
|
227
228
|
(el) =>
|
|
228
|
-
el.props.
|
|
229
|
+
el.props.accessibilityLabel ===
|
|
230
|
+
AccessibilityLabel.UNIT_SUMMARY_GUIDE_TOUCH &&
|
|
229
231
|
el.type === TouchableOpacity
|
|
230
232
|
);
|
|
231
233
|
await act(async () => {
|
package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import {
|
|
3
|
+
import { AccessibilityLabel } from '../../../../../configs/Constants';
|
|
4
4
|
import { API, Colors } from '../../../../../configs';
|
|
5
5
|
import PowerConsumption from '../index';
|
|
6
6
|
import { SCProvider } from '../../../../../context';
|
|
@@ -42,7 +42,9 @@ describe('Test 3PPowerConsumption', () => {
|
|
|
42
42
|
});
|
|
43
43
|
const instance = tree.root;
|
|
44
44
|
const listIndicator = instance.find(
|
|
45
|
-
(el) =>
|
|
45
|
+
(el) =>
|
|
46
|
+
el.props.accessibilityLabel ===
|
|
47
|
+
AccessibilityLabel.LIST_QUALITY_INDICATOR_3PC
|
|
46
48
|
);
|
|
47
49
|
expect(listIndicator).not.toBeUndefined();
|
|
48
50
|
const resultList = [
|
|
@@ -10,7 +10,7 @@ import ConfigHistoryChart from '../../../../commons/UnitSummary/ConfigHistoryCha
|
|
|
10
10
|
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
11
11
|
import HistoryChart from '../../../../commons/Device/HistoryChart';
|
|
12
12
|
import { axiosGet } from '../../../../utils/Apis/axios';
|
|
13
|
-
import {
|
|
13
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
14
14
|
|
|
15
15
|
const ThreePhasePowerConsumption = memo(({ summaryDetail }) => {
|
|
16
16
|
const t = useTranslations();
|
|
@@ -229,7 +229,7 @@ const ThreePhasePowerConsumption = memo(({ summaryDetail }) => {
|
|
|
229
229
|
<ListQualityIndicator
|
|
230
230
|
data={dataList}
|
|
231
231
|
style={styles.styleList}
|
|
232
|
-
|
|
232
|
+
accessibilityLabel={AccessibilityLabel.LIST_QUALITY_INDICATOR_3PC}
|
|
233
233
|
/>
|
|
234
234
|
{showBoxHistory && (
|
|
235
235
|
<View>
|
package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
3
|
import MockAdapter from 'axios-mock-adapter';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { AccessibilityLabel } from '../../../../../configs/Constants';
|
|
6
6
|
import { API, Colors } from '../../../../../configs';
|
|
7
7
|
import ListQualityIndicator from '../../../../../commons/Device/WaterQualitySensor/ListQualityIndicator';
|
|
8
8
|
import PowerConsumption from '../index';
|
|
@@ -36,7 +36,9 @@ describe('Test PowerConsumption', () => {
|
|
|
36
36
|
});
|
|
37
37
|
const instance = tree.root;
|
|
38
38
|
const listIndicator = instance.find(
|
|
39
|
-
(el) =>
|
|
39
|
+
(el) =>
|
|
40
|
+
el.props.accessibilityLabel ===
|
|
41
|
+
AccessibilityLabel.LIST_QUALITY_INDICATOR_PC
|
|
40
42
|
);
|
|
41
43
|
expect(listIndicator).not.toBeUndefined();
|
|
42
44
|
const resultList = [
|
|
@@ -9,7 +9,7 @@ import ListQualityIndicator from '../../../../commons/Device/WaterQualitySensor/
|
|
|
9
9
|
import PMSensorIndicatior from '../../../../commons/Device/PMSensor/PMSensorIndicatior';
|
|
10
10
|
import ConfigHistoryChart from '../../../../commons/UnitSummary/ConfigHistoryChart';
|
|
11
11
|
import HistoryChart from '../../../../commons/Device/HistoryChart';
|
|
12
|
-
import {
|
|
12
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
13
13
|
|
|
14
14
|
import { axiosGet } from '../../../../utils/Apis/axios';
|
|
15
15
|
|
|
@@ -138,7 +138,7 @@ const PowerConsumption = memo(({ summaryDetail }) => {
|
|
|
138
138
|
<ListQualityIndicator
|
|
139
139
|
data={dataList}
|
|
140
140
|
style={styles.styleList}
|
|
141
|
-
|
|
141
|
+
accessibilityLabel={AccessibilityLabel.LIST_QUALITY_INDICATOR_PC}
|
|
142
142
|
/>
|
|
143
143
|
{showBoxHistory && (
|
|
144
144
|
<View>
|
|
@@ -19,15 +19,16 @@ jest.mock('@react-navigation/native', () => {
|
|
|
19
19
|
useNavigation: () => ({
|
|
20
20
|
navigate: mockedNavigate,
|
|
21
21
|
}),
|
|
22
|
+
useFocusEffect: jest.fn(),
|
|
22
23
|
};
|
|
23
24
|
});
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
+
const mockConnectHomeAssistant = jest.fn();
|
|
26
27
|
jest.mock('../../../../../hooks/IoT', () => {
|
|
27
28
|
return {
|
|
28
29
|
...jest.requireActual('../../../../../hooks/IoT'),
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
useHomeAssistantConnection: () => ({
|
|
31
|
+
connectHomeAssistant: mockConnectHomeAssistant,
|
|
31
32
|
}),
|
|
32
33
|
};
|
|
33
34
|
});
|
|
@@ -82,7 +83,7 @@ describe('test RunningDevices', () => {
|
|
|
82
83
|
act(() => {
|
|
83
84
|
button[0].props.onPress();
|
|
84
85
|
});
|
|
85
|
-
expect(
|
|
86
|
+
expect(mockConnectHomeAssistant).toBeCalled();
|
|
86
87
|
});
|
|
87
88
|
});
|
|
88
89
|
|
|
@@ -2,12 +2,13 @@ import React, { memo, useEffect } from 'react';
|
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
import ItemDevice from '../../../../commons/Device/ItemDevice';
|
|
4
4
|
import { scanBluetoothDevices } from '../../../../iot/RemoteControl/Bluetooth';
|
|
5
|
-
import {
|
|
5
|
+
import { useHomeAssistantConnection } from '../../../../hooks/IoT';
|
|
6
|
+
import { useDevicesStatus } from '../../../../hooks/Common';
|
|
6
7
|
|
|
7
8
|
const RunningDevices = memo(({ unit, summaryDetail }) => {
|
|
8
9
|
const { devices } = summaryDetail;
|
|
9
10
|
|
|
10
|
-
const {
|
|
11
|
+
const { connectHomeAssistant } = useHomeAssistantConnection();
|
|
11
12
|
|
|
12
13
|
useEffect(() => {
|
|
13
14
|
if (unit.remote_control_options) {
|
|
@@ -16,12 +17,14 @@ const RunningDevices = memo(({ unit, summaryDetail }) => {
|
|
|
16
17
|
}
|
|
17
18
|
if (unit.remote_control_options.googlehome) {
|
|
18
19
|
(async () =>
|
|
19
|
-
await
|
|
20
|
+
await connectHomeAssistant(unit.remote_control_options.googlehome))();
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23
24
|
}, [unit]);
|
|
24
25
|
|
|
26
|
+
useDevicesStatus(unit, devices);
|
|
27
|
+
|
|
25
28
|
return (
|
|
26
29
|
<View style={styles.container}>
|
|
27
30
|
{!!devices &&
|
|
@@ -3,7 +3,7 @@ import { View, StyleSheet } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import { Colors } from '../../../../configs';
|
|
5
5
|
import Text from '../../../../commons/Text';
|
|
6
|
-
import {
|
|
6
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
7
7
|
|
|
8
8
|
const TotalPowerBox = memo(({ title, value, measure }) => {
|
|
9
9
|
return (
|
|
@@ -13,7 +13,7 @@ const TotalPowerBox = memo(({ title, value, measure }) => {
|
|
|
13
13
|
color={Colors.Gray8}
|
|
14
14
|
size={14}
|
|
15
15
|
style={styles.txtTotal}
|
|
16
|
-
|
|
16
|
+
accessibilityLabel={AccessibilityLabel.TOTAL_POWER_BOX_TITLE}
|
|
17
17
|
>
|
|
18
18
|
{title}
|
|
19
19
|
</Text>
|
|
@@ -5,7 +5,7 @@ import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
|
5
5
|
import { Colors } from '../../../../configs';
|
|
6
6
|
import Text from '../../../../commons/Text';
|
|
7
7
|
import TotalPowerBox from '../TotalPowerBox';
|
|
8
|
-
import {
|
|
8
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
9
9
|
|
|
10
10
|
const TotalPowerConsumption = memo(({ time, total }) => {
|
|
11
11
|
const t = useTranslations();
|
|
@@ -21,7 +21,7 @@ const TotalPowerConsumption = memo(({ time, total }) => {
|
|
|
21
21
|
title={t('text_total_power_consumption')}
|
|
22
22
|
value={total.value}
|
|
23
23
|
measure={total.measure}
|
|
24
|
-
|
|
24
|
+
accessibilityLabel={AccessibilityLabel.TOTAL_POWER_CONSUMPTION}
|
|
25
25
|
/>
|
|
26
26
|
</View>
|
|
27
27
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import {
|
|
3
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
4
4
|
import TotalPowerBox from '../TotalPowerBox';
|
|
5
5
|
|
|
6
6
|
describe('Test Total Power Box', () => {
|
|
@@ -12,7 +12,8 @@ describe('Test Total Power Box', () => {
|
|
|
12
12
|
});
|
|
13
13
|
const instance = tree.root;
|
|
14
14
|
const item = instance.find(
|
|
15
|
-
(el) =>
|
|
15
|
+
(el) =>
|
|
16
|
+
el.props.accessibilityLabel === AccessibilityLabel.TOTAL_POWER_BOX_TITLE
|
|
16
17
|
);
|
|
17
18
|
expect(item.props.children).toBe('titleTest');
|
|
18
19
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import {
|
|
3
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
4
4
|
import { SCProvider } from '../../../../context';
|
|
5
5
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
6
|
import TotalPowerConsumption from '../TotalPowerConsumption/index';
|
|
@@ -24,7 +24,9 @@ describe('Test Total Power Consumption', () => {
|
|
|
24
24
|
});
|
|
25
25
|
const instance = tree.root;
|
|
26
26
|
const item = instance.find(
|
|
27
|
-
(el) =>
|
|
27
|
+
(el) =>
|
|
28
|
+
el.props.accessibilityLabel ===
|
|
29
|
+
AccessibilityLabel.TOTAL_POWER_CONSUMPTION
|
|
28
30
|
);
|
|
29
31
|
expect(item.props.value).toBe(10);
|
|
30
32
|
});
|
|
@@ -19,12 +19,12 @@ import RunningDevices from './components/RunningDevices';
|
|
|
19
19
|
import Temperature from './components/Temperature';
|
|
20
20
|
import UvIndex from './components/UvIndex';
|
|
21
21
|
import WaterQuality from './components/WaterQuality';
|
|
22
|
-
import {
|
|
22
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
23
23
|
import { timeDifference } from '../../utils/Converter/time';
|
|
24
24
|
|
|
25
25
|
const UnitSummary = memo(({ route }) => {
|
|
26
26
|
const t = useTranslations();
|
|
27
|
-
const { unitData, unitId, summaryData, summaryId } = route
|
|
27
|
+
const { unitData, unitId, summaryData, summaryId } = route?.params || {};
|
|
28
28
|
const [summaryDetail, setSummaryDetail] = useState({});
|
|
29
29
|
const [unit, setUnit] = useState(unitData || { id: unitId });
|
|
30
30
|
const [summary, setSummary] = useState(summaryData || { id: summaryId });
|
|
@@ -128,12 +128,14 @@ const UnitSummary = memo(({ route }) => {
|
|
|
128
128
|
setLoading(true);
|
|
129
129
|
fetchSummaryDetail();
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
if (summary?.screen !== Routes.RunningDevices) {
|
|
132
|
+
const autoUpdate = setInterval(() => {
|
|
133
|
+
fetchSummaryDetail();
|
|
134
|
+
}, 10000); // fetch each 10 second
|
|
134
135
|
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
return () => clearInterval(autoUpdate);
|
|
137
|
+
}
|
|
138
|
+
}, [fetchSummaryDetail, summary?.screen]);
|
|
137
139
|
|
|
138
140
|
const onRefresh = useCallback(() => {
|
|
139
141
|
setLoading(true);
|
|
@@ -170,7 +172,7 @@ const UnitSummary = memo(({ route }) => {
|
|
|
170
172
|
GuideName ? (
|
|
171
173
|
<View style={styles.rightComponent}>
|
|
172
174
|
<TouchableOpacity
|
|
173
|
-
|
|
175
|
+
accessibilityLabel={AccessibilityLabel.UNIT_SUMMARY_GUIDE_TOUCH}
|
|
174
176
|
onPress={() => navigation.navigate(GuideName)}
|
|
175
177
|
>
|
|
176
178
|
<IconOutline
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { useSelector } from 'react-redux';
|
|
4
4
|
import WaterQualityGuide from '../index';
|
|
5
5
|
import { create, act } from 'react-test-renderer';
|
|
6
|
-
import {
|
|
6
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
7
7
|
import Text from '../../../commons/Text';
|
|
8
8
|
import { SCProvider } from '../../../context';
|
|
9
9
|
import { mockSCStore } from '../../../context/mockStore';
|
|
@@ -45,42 +45,47 @@ describe('Test WaterQualityGuide', () => {
|
|
|
45
45
|
const getQueryset = (instance) => {
|
|
46
46
|
const textTitle = instance.findAll(
|
|
47
47
|
(el) =>
|
|
48
|
-
el.props.
|
|
48
|
+
el.props.accessibilityLabel ===
|
|
49
|
+
AccessibilityLabel.WATER_QUALITY_GUIDE_TITLE && el.type === Text
|
|
49
50
|
);
|
|
50
51
|
const textDescription = instance.findAll(
|
|
51
52
|
(el) =>
|
|
52
|
-
el.props.
|
|
53
|
-
|
|
53
|
+
el.props.accessibilityLabel ===
|
|
54
|
+
AccessibilityLabel.WATER_QUALITY_GUIDE_DESCRIPTION && el.type === Text
|
|
54
55
|
);
|
|
55
56
|
const textTitleLevel = instance.findAll(
|
|
56
57
|
(el) =>
|
|
57
|
-
el.props.
|
|
58
|
-
|
|
58
|
+
el.props.accessibilityLabel ===
|
|
59
|
+
AccessibilityLabel.WATER_QUALITY_GUIDE_TITLE_LEVEL && el.type === Text
|
|
59
60
|
);
|
|
60
61
|
const textDescriptionLevel = instance.findAll(
|
|
61
62
|
(el) =>
|
|
62
|
-
el.props.
|
|
63
|
+
el.props.accessibilityLabel ===
|
|
64
|
+
AccessibilityLabel.WATER_QUALITY_GUIDE_DESCRIPTION_LEVEL &&
|
|
63
65
|
el.type === Text
|
|
64
66
|
);
|
|
65
67
|
|
|
66
68
|
const textTitle1 = instance.findAll(
|
|
67
69
|
(el) =>
|
|
68
|
-
el.props.
|
|
69
|
-
|
|
70
|
+
el.props.accessibilityLabel ===
|
|
71
|
+
AccessibilityLabel.WATER_QUALITY_GUIDE_TITLE1 && el.type === Text
|
|
70
72
|
);
|
|
71
73
|
const textDescription1 = instance.findAll(
|
|
72
74
|
(el) =>
|
|
73
|
-
el.props.
|
|
75
|
+
el.props.accessibilityLabel ===
|
|
76
|
+
AccessibilityLabel.WATER_QUALITY_GUIDE_DESCRIPTION1 &&
|
|
74
77
|
el.type === Text
|
|
75
78
|
);
|
|
76
79
|
const textTitleLevel1 = instance.findAll(
|
|
77
80
|
(el) =>
|
|
78
|
-
el.props.
|
|
81
|
+
el.props.accessibilityLabel ===
|
|
82
|
+
AccessibilityLabel.WATER_QUALITY_GUIDE_TITLE_LEVEL1 &&
|
|
79
83
|
el.type === Text
|
|
80
84
|
);
|
|
81
85
|
const textDescriptionLevel1 = instance.findAll(
|
|
82
86
|
(el) =>
|
|
83
|
-
el.props.
|
|
87
|
+
el.props.accessibilityLabel ===
|
|
88
|
+
AccessibilityLabel.WATER_QUALITY_GUIDE_DESCRIPTION_LEVEL1 &&
|
|
84
89
|
el.type === Text
|
|
85
90
|
);
|
|
86
91
|
return {
|