@eohjsc/react-native-smart-city 0.3.29 → 0.3.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -5
- package/src/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 +2 -2
- package/src/commons/Action/__test__/ItemQuickAction.test.js +17 -9
- package/src/commons/ActionGroup/ColorPickerTemplate.js +36 -17
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +6 -6
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +18 -13
- 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 +2 -2
- package/src/commons/ActionGroup/OneBigButtonTemplate.js +5 -5
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +38 -22
- package/src/commons/ActionGroup/SliderRangeTemplate.js +24 -16
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +25 -9
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/ControlPlay.test.js +13 -7
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/RectangleButton.test.js +9 -5
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/SmartTiviActionTemplate.test.js +25 -9
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +16 -6
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +10 -4
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/RectangleButton.js +7 -3
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate.js +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/AlertAction/index.js +2 -2
- package/src/commons/Auth/AccountItem.js +9 -3
- package/src/commons/Auth/__test__/AccountItem.test.js +6 -3
- package/src/commons/Automate/ItemAutomate.js +13 -3
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/BottomButtonView/index.js +4 -4
- package/src/commons/Button/index.js +2 -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 +10 -11
- package/src/commons/Device/ItemDevice.js +27 -20
- 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 +6 -5
- package/src/commons/NavBar/index.js +4 -4
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +11 -5
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +7 -3
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +4 -2
- package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +11 -8
- package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +9 -5
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +5 -3
- package/src/commons/Popover/index.js +2 -12
- 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 +7 -4
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +25 -10
- package/src/commons/SubUnit/OneTap/index.js +9 -4
- package/src/commons/SubUnit/ShortDetail.js +11 -29
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +15 -10
- package/src/commons/SummaryItem/index.js +2 -2
- package/src/commons/Unit/HeaderUnit/index.js +4 -5
- package/src/commons/Unit/SharedUnit.js +10 -8
- package/src/commons/Unit/__test__/HeaderUnit.test.js +13 -5
- package/src/commons/Unit/__test__/SharedUnit.test.js +30 -11
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +13 -8
- package/src/commons/UnitSummary/AirQuality/index.js +7 -3
- package/src/commons/UnitSummary/TotalPowerBox.js +2 -2
- package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -2
- package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +3 -2
- package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +4 -2
- package/src/commons/ViewButtonBottom/index.js +4 -4
- package/src/commons/WheelDateTimePicker/index.js +5 -3
- package/src/commons/WrapParallaxScrollView/index.js +2 -1
- package/src/configs/API.js +12 -14
- package/src/configs/AccessibilityLabel.js +608 -0
- package/src/configs/Colors.js +4 -0
- package/src/configs/Constants.js +1 -593
- 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/withRemoteControl.js +1 -0
- package/src/hooks/Common/index.js +2 -2
- package/src/hooks/Common/useDevicesStatus.js +1 -1
- 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/IoT/useValueEvaluation.js +10 -19
- package/src/iot/RemoteControl/{GoogleHome.js → HomeAssistant.js} +27 -23
- 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 +5 -8
- 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 +5 -1
- package/src/screens/AddNewAction/SelectAction.js +36 -20
- package/src/screens/AddNewAction/SelectSensorDevices.js +3 -3
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +3 -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 +11 -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 +16 -17
- package/src/screens/Device/components/SensorDisplayItem.js +51 -26
- package/src/screens/Device/detail.js +65 -38
- package/src/screens/Device/hooks/useEvaluateValue.js +0 -2
- package/src/screens/Device/hooks/useFavoriteDevice.js +4 -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 +11 -7
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -1
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +9 -10
- 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/Notification/__test__/NotificationItem.test.js +6 -30
- package/src/screens/Notification/components/NotificationItem.js +3 -19
- package/src/screens/PlayBackCamera/__test__/index.test.js +9 -6
- package/src/screens/PlayBackCamera/index.js +6 -6
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/index.js +10 -3
- package/src/screens/ScriptDetail/__test__/index.test.js +8 -4
- package/src/screens/ScriptDetail/index.js +7 -5
- 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 +6 -3
- package/src/screens/Sharing/Components/Styles/SensorItemStyles.js +4 -0
- package/src/screens/Sharing/Components/Styles/TitleCheckBoxStyles.js +4 -0
- package/src/screens/Sharing/Components/TitleCheckBox.js +17 -8
- package/src/screens/Sharing/Components/__test__/SensorItem.test.js +4 -2
- package/src/screens/Sharing/InfoMemberUnit.js +7 -6
- package/src/screens/Sharing/MemberList.js +4 -4
- package/src/screens/Sharing/SelectPermission.js +9 -4
- package/src/screens/Sharing/SelectUser.js +9 -5
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +3 -2
- package/src/screens/Sharing/__test__/SelectUser.test.js +7 -4
- package/src/screens/SideMenuDetail/__test__/index.test.js +11 -7
- package/src/screens/SideMenuDetail/index.js +2 -2
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +4 -2
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +5 -5
- package/src/screens/SmartIr/__test__/SmartIr.test.js +14 -6
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +4 -2
- package/src/screens/SmartIr/components/{SelectDeviceType.js → SelectIrDeviceType.js} +2 -2
- package/src/screens/SmartIr/index.js +1 -1
- package/src/screens/SubUnit/AddSubUnit.js +7 -3
- package/src/screens/SubUnit/Detail.js +6 -6
- package/src/screens/SubUnit/EditSubUnit.js +10 -6
- package/src/screens/SubUnit/ManageSubUnit.js +2 -2
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +6 -3
- package/src/screens/SubUnit/__test__/Detail.test.js +5 -3
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +9 -5
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +3 -2
- package/src/screens/SyncLGDevice/AddLGDevice.js +4 -4
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -4
- package/src/screens/TDSGuide/__test__/TDSGuide.test.js +4 -2
- package/src/screens/TDSGuide/index.js +2 -2
- package/src/screens/Template/EditTemplate.js +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 +14 -9
- package/src/screens/Unit/ManageUnit.js +21 -15
- package/src/screens/Unit/MyAllUnit/index.js +1 -1
- package/src/screens/Unit/SelectAddToFavorites.js +11 -2
- 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 +8 -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 +25 -10
- package/src/utils/I18n/translations/vi.json +22 -9
- package/src/utils/Route/index.js +22 -10
- package/src/commons/Connecting/index.js +0 -67
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +0 -28
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +0 -41
- package/src/commons/ConnectingProcess/__test__/Connecting.test.js +0 -163
- package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +0 -19
- package/src/commons/ConnectingProcess/index.js +0 -213
- package/src/commons/ConnectingProcess/styles.js +0 -69
- package/src/hooks/IoT/useGGHomeConnection.js +0 -91
- package/src/iot/RemoteControl/index.js +0 -55
- package/src/screens/AddNewDevice/ConnectDevices.js +0 -184
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +0 -131
- package/src/screens/AddNewGateway/ConnectedGateway.js +0 -139
- package/src/screens/AddNewGateway/ConnectingGateway.js +0 -137
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +0 -214
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +0 -307
- 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
|
@@ -3,7 +3,7 @@ import { ScrollView, SafeAreaView, Platform } from 'react-native';
|
|
|
3
3
|
import { CommonActions, useNavigation } from '@react-navigation/native';
|
|
4
4
|
|
|
5
5
|
import { API, Colors } from '../../configs';
|
|
6
|
-
import {
|
|
6
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
7
7
|
import _TextInput from '../../commons/Form/TextInput';
|
|
8
8
|
import styles from './AddNewOneTapStyles';
|
|
9
9
|
import { HeaderCustom } from '../../commons/Header';
|
|
@@ -26,7 +26,7 @@ const AddNewOneTap = memo(({ route }) => {
|
|
|
26
26
|
automateId,
|
|
27
27
|
scriptName,
|
|
28
28
|
oldType,
|
|
29
|
-
} = route
|
|
29
|
+
} = route?.params || {};
|
|
30
30
|
const t = useTranslations();
|
|
31
31
|
const { navigate, dispatch, goBack } = useNavigation();
|
|
32
32
|
const [name, setName] = useState(scriptName ? scriptName : '');
|
|
@@ -123,7 +123,7 @@ const AddNewOneTap = memo(({ route }) => {
|
|
|
123
123
|
<HeaderCustom isShowClose onClose={onClose} />
|
|
124
124
|
<ScrollView scrollIndicatorInsets={{ right: 1 }}>
|
|
125
125
|
<Text
|
|
126
|
-
|
|
126
|
+
accessibilityLabel={AccessibilityLabel.ADD_NEW_DEVICE_ADD}
|
|
127
127
|
semibold
|
|
128
128
|
size={20}
|
|
129
129
|
color={Colors.Gray9}
|
|
@@ -137,7 +137,7 @@ const AddNewOneTap = memo(({ route }) => {
|
|
|
137
137
|
onChange={onChangeName}
|
|
138
138
|
textInputStyle={styles.textInput}
|
|
139
139
|
value={name}
|
|
140
|
-
|
|
140
|
+
accessibilityLabel={AccessibilityLabel.NAME_YOUR_BUTTON}
|
|
141
141
|
/>
|
|
142
142
|
</ScrollView>
|
|
143
143
|
<BottomButtonView
|
|
@@ -9,7 +9,7 @@ import { mockSCStore } from '../../../context/mockStore';
|
|
|
9
9
|
import ItemOneTap from '../../../commons/SubUnit/OneTap/ItemOneTap';
|
|
10
10
|
import ItemAddNew from '../../../commons/Device/ItemAddNew';
|
|
11
11
|
import Routes from '../../../utils/Route';
|
|
12
|
-
import {
|
|
12
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
13
13
|
import api from '../../../utils/Apis/axios';
|
|
14
14
|
import { API } from '../../../configs';
|
|
15
15
|
|
|
@@ -208,7 +208,7 @@ describe('Test Automate', () => {
|
|
|
208
208
|
|
|
209
209
|
const iconArrowRight = instance.findAll(
|
|
210
210
|
(el) =>
|
|
211
|
-
el.props.
|
|
211
|
+
el.props.accessibilityLabel === AccessibilityLabel.ICON_ARROW_RIGHT &&
|
|
212
212
|
el.type === TouchableOpacity
|
|
213
213
|
);
|
|
214
214
|
|
|
@@ -20,7 +20,11 @@ import Loading from './Components/Loading';
|
|
|
20
20
|
import ItemAddNew from '../../commons/Device/ItemAddNew';
|
|
21
21
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
22
22
|
import { useGetIdUser } from '../../hooks/Common';
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
AUTOMATE_TYPE,
|
|
25
|
+
AccessibilityLabel,
|
|
26
|
+
UNIT_TYPES,
|
|
27
|
+
} from '../../configs/Constants';
|
|
24
28
|
|
|
25
29
|
const keyExtractor = (item) => item.id;
|
|
26
30
|
|
|
@@ -134,7 +138,7 @@ const Automate = () => {
|
|
|
134
138
|
isOwner
|
|
135
139
|
)}
|
|
136
140
|
style={styles.arrowRightButton}
|
|
137
|
-
|
|
141
|
+
accessibilityLabel={AccessibilityLabel.ICON_ARROW_RIGHT}
|
|
138
142
|
>
|
|
139
143
|
<Image source={Images.arrowBack} style={styles.arrowRight} />
|
|
140
144
|
</TouchableOpacity>
|
|
@@ -6,7 +6,7 @@ import { mockSCStore } from '../../../context/mockStore';
|
|
|
6
6
|
import ConfirmUnitDeletion from '../index';
|
|
7
7
|
import _TextInput from '../../../commons/Form/TextInput';
|
|
8
8
|
import { TouchableOpacity } from 'react-native';
|
|
9
|
-
import {
|
|
9
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
10
10
|
import API from '../../../configs/API';
|
|
11
11
|
import api from '../../../utils/Apis/axios';
|
|
12
12
|
import MockAdapter from 'axios-mock-adapter';
|
|
@@ -74,7 +74,8 @@ describe('Test ConfirmUnitDeletion', () => {
|
|
|
74
74
|
|
|
75
75
|
const touchableOpacity = instance.find(
|
|
76
76
|
(el) =>
|
|
77
|
-
el.props.
|
|
77
|
+
el.props.accessibilityLabel ===
|
|
78
|
+
AccessibilityLabel.CONFIRM_UNIT_DELETION_BUTTON &&
|
|
78
79
|
el.type === TouchableOpacity
|
|
79
80
|
);
|
|
80
81
|
const textInput = instance.findByType(_TextInput);
|
|
@@ -12,11 +12,11 @@ import { Button } from '../../commons';
|
|
|
12
12
|
import Routes from '../../utils/Route';
|
|
13
13
|
import { axiosDelete } from '../../utils/Apis/axios';
|
|
14
14
|
import { ToastBottomHelper } from '../../utils/Utils';
|
|
15
|
-
import {
|
|
15
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
16
16
|
|
|
17
17
|
const ConfirmUnitDeletion = ({ route }) => {
|
|
18
18
|
const t = useTranslations();
|
|
19
|
-
const { unit } = route
|
|
19
|
+
const { unit } = route?.params || {};
|
|
20
20
|
const navigation = useNavigation();
|
|
21
21
|
const [confirm, setConfrim] = useState('');
|
|
22
22
|
const [errorText, setErrorText] = useState();
|
|
@@ -60,7 +60,7 @@ const ConfirmUnitDeletion = ({ route }) => {
|
|
|
60
60
|
type="auth"
|
|
61
61
|
title={t('done')}
|
|
62
62
|
onPress={onSendPress}
|
|
63
|
-
|
|
63
|
+
accessibilityLabel={AccessibilityLabel.CONFIRM_UNIT_DELETION_BUTTON}
|
|
64
64
|
/>
|
|
65
65
|
</View>
|
|
66
66
|
</WrapHeaderScrollable>
|
|
@@ -8,7 +8,7 @@ import { mockSCStore } from '../../../../context/mockStore';
|
|
|
8
8
|
import EditDevice from '..';
|
|
9
9
|
import AlertAction from '../../../../commons/AlertAction';
|
|
10
10
|
import _TextInput from '../../../../commons/Form/TextInput';
|
|
11
|
-
import {
|
|
11
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
12
12
|
import { API } from '../../../../configs';
|
|
13
13
|
import { useRoute } from '@react-navigation/native';
|
|
14
14
|
import api from '../../../../utils/Apis/axios';
|
|
@@ -66,7 +66,7 @@ describe('Test EditDevice', () => {
|
|
|
66
66
|
const alertAction = instance.findByType(AlertAction);
|
|
67
67
|
const buttonRename = instance.findAll(
|
|
68
68
|
(el) =>
|
|
69
|
-
el.props.
|
|
69
|
+
el.props.accessibilityLabel === AccessibilityLabel.DEVICE_SHOW_RENAME &&
|
|
70
70
|
el.type === TouchableOpacity
|
|
71
71
|
);
|
|
72
72
|
expect(buttonRename).toHaveLength(1);
|
|
@@ -95,7 +95,7 @@ describe('Test EditDevice', () => {
|
|
|
95
95
|
const alertAction = instance.findByType(AlertAction);
|
|
96
96
|
const buttonRename = instance.findAll(
|
|
97
97
|
(el) =>
|
|
98
|
-
el.props.
|
|
98
|
+
el.props.accessibilityLabel === AccessibilityLabel.DEVICE_SHOW_RENAME &&
|
|
99
99
|
el.type === TouchableOpacity
|
|
100
100
|
);
|
|
101
101
|
expect(buttonRename).toHaveLength(1);
|
|
@@ -129,7 +129,7 @@ describe('Test EditDevice', () => {
|
|
|
129
129
|
const alertAction = instance.findByType(AlertAction);
|
|
130
130
|
const buttonDelete = instance.findAll(
|
|
131
131
|
(el) =>
|
|
132
|
-
el.props.
|
|
132
|
+
el.props.accessibilityLabel === AccessibilityLabel.DEVICE_SHOW_REMOVE &&
|
|
133
133
|
el.type === TouchableOpacity
|
|
134
134
|
);
|
|
135
135
|
expect(buttonDelete).toHaveLength(1);
|
|
@@ -153,7 +153,7 @@ describe('Test EditDevice', () => {
|
|
|
153
153
|
const alertAction = instance.findByType(AlertAction);
|
|
154
154
|
const buttonDelete = instance.findAll(
|
|
155
155
|
(el) =>
|
|
156
|
-
el.props.
|
|
156
|
+
el.props.accessibilityLabel === AccessibilityLabel.DEVICE_SHOW_REMOVE &&
|
|
157
157
|
el.type === TouchableOpacity
|
|
158
158
|
);
|
|
159
159
|
expect(buttonDelete).toHaveLength(1);
|
|
@@ -6,7 +6,7 @@ import { IconOutline } from '@ant-design/icons-react-native';
|
|
|
6
6
|
import { Colors } from '../../../configs';
|
|
7
7
|
import Text from '../../../commons/Text';
|
|
8
8
|
import { useRoute } from '@react-navigation/native';
|
|
9
|
-
import {
|
|
9
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
10
10
|
import AlertAction from '../../../commons/AlertAction';
|
|
11
11
|
import _TextInput from '../../../commons/Form/TextInput';
|
|
12
12
|
import styles from './styles/EditDeviceStyles';
|
|
@@ -85,7 +85,7 @@ const EditDevice = memo(() => {
|
|
|
85
85
|
<TouchableOpacity
|
|
86
86
|
style={styles.DeviceButton}
|
|
87
87
|
onPress={onShowRename}
|
|
88
|
-
|
|
88
|
+
accessibilityLabel={AccessibilityLabel.DEVICE_SHOW_RENAME}
|
|
89
89
|
>
|
|
90
90
|
<View style={styles.DeviceButtonLeft}>
|
|
91
91
|
<Text type="H4" semibold>
|
|
@@ -108,7 +108,7 @@ const EditDevice = memo(() => {
|
|
|
108
108
|
<TouchableOpacity
|
|
109
109
|
style={styles.removeButton}
|
|
110
110
|
onPress={onShowDelete(sensor?.name)}
|
|
111
|
-
|
|
111
|
+
accessibilityLabel={AccessibilityLabel.DEVICE_SHOW_REMOVE}
|
|
112
112
|
>
|
|
113
113
|
<Text
|
|
114
114
|
type={'H4'}
|
|
@@ -8,7 +8,7 @@ import { API } from '../../../configs';
|
|
|
8
8
|
import { AlertSendConfirm } from '../../../commons/EmergencyButton/AlertSendConfirm';
|
|
9
9
|
import { AlertSent } from '../../../commons/EmergencyButton/AlertSent';
|
|
10
10
|
import { AlertAction, ButtonPopup, MenuActionMore } from '../../../commons';
|
|
11
|
-
import {
|
|
11
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
12
12
|
import Text from '../../../commons/Text';
|
|
13
13
|
import { IconFill } from '@ant-design/icons-react-native';
|
|
14
14
|
import CurrentRainSensor from '../../../commons/Device/RainningSensor/CurrentRainSensor';
|
|
@@ -53,7 +53,7 @@ jest.mock('react', () => ({
|
|
|
53
53
|
jest.mock('../../../hooks/Common', () => {
|
|
54
54
|
return {
|
|
55
55
|
...jest.requireActual('../../../hooks/Common'),
|
|
56
|
-
|
|
56
|
+
useHomeAssistantDeviceConnected: () => ({ isConnected: true }),
|
|
57
57
|
};
|
|
58
58
|
});
|
|
59
59
|
|
|
@@ -228,29 +228,35 @@ describe('test DeviceDetail', () => {
|
|
|
228
228
|
});
|
|
229
229
|
const instance = tree.root;
|
|
230
230
|
const sensorDisplayItem = instance.findAll(
|
|
231
|
-
(el) =>
|
|
231
|
+
(el) =>
|
|
232
|
+
el.props.accessibilityLabel === AccessibilityLabel.SENSOR_DISPLAY_ITEM
|
|
232
233
|
);
|
|
233
234
|
expect(sensorDisplayItem.length).toEqual(2);
|
|
234
235
|
|
|
235
236
|
const itemActionGroup = instance.find(
|
|
236
|
-
(el) =>
|
|
237
|
+
(el) =>
|
|
238
|
+
el.props.accessibilityLabel ===
|
|
239
|
+
AccessibilityLabel.DEVICE_DETAIL_ACTION_GROUP
|
|
237
240
|
);
|
|
238
241
|
expect(itemActionGroup).toBeDefined();
|
|
239
242
|
|
|
240
243
|
const button1 = instance.find(
|
|
241
|
-
(el) =>
|
|
244
|
+
(el) =>
|
|
245
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_TEMPLATE_1
|
|
242
246
|
);
|
|
243
247
|
await act(async () => {
|
|
244
248
|
await button1.props.onPress();
|
|
245
249
|
});
|
|
246
250
|
const button2 = instance.find(
|
|
247
|
-
(el) =>
|
|
251
|
+
(el) =>
|
|
252
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_TEMPLATE_2
|
|
248
253
|
);
|
|
249
254
|
await act(async () => {
|
|
250
255
|
await button2.props.onPress();
|
|
251
256
|
});
|
|
252
257
|
const button3 = instance.find(
|
|
253
|
-
(el) =>
|
|
258
|
+
(el) =>
|
|
259
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_TEMPLATE_3
|
|
254
260
|
);
|
|
255
261
|
await act(async () => {
|
|
256
262
|
await button3.props.onPress();
|
|
@@ -289,8 +295,8 @@ describe('test DeviceDetail', () => {
|
|
|
289
295
|
const instance = tree.root;
|
|
290
296
|
const buttonPopup = instance.find(
|
|
291
297
|
(el) =>
|
|
292
|
-
el.props.
|
|
293
|
-
|
|
298
|
+
el.props.accessibilityLabel ===
|
|
299
|
+
AccessibilityLabel.BUTTON_POPUP_RESOLVED && el.type === ButtonPopup
|
|
294
300
|
);
|
|
295
301
|
const alertAction = instance.findByType(AlertAction);
|
|
296
302
|
expect(buttonPopup.props.visible).toEqual(false);
|
|
@@ -315,13 +321,13 @@ describe('test DeviceDetail', () => {
|
|
|
315
321
|
const instance = tree.root;
|
|
316
322
|
const buttonPopupTitle = instance.find(
|
|
317
323
|
(el) =>
|
|
318
|
-
el.props.
|
|
319
|
-
|
|
324
|
+
el.props.accessibilityLabel ===
|
|
325
|
+
AccessibilityLabel.BUTTON_POPUP_RESOLVED_TITLE && el.type === Text
|
|
320
326
|
);
|
|
321
327
|
const buttonPopupIcon = instance.find(
|
|
322
328
|
(el) =>
|
|
323
|
-
el.props.
|
|
324
|
-
|
|
329
|
+
el.props.accessibilityLabel ===
|
|
330
|
+
AccessibilityLabel.BUTTON_POPUP_RESOLVED_ICON && el.type === IconFill
|
|
325
331
|
);
|
|
326
332
|
expect(buttonPopupTitle.props.children).toEqual([
|
|
327
333
|
'Unit name',
|
|
@@ -477,7 +483,8 @@ describe('test DeviceDetail', () => {
|
|
|
477
483
|
|
|
478
484
|
const instance = tree.root;
|
|
479
485
|
const sensorDisplayItem = instance.findAll(
|
|
480
|
-
(el) =>
|
|
486
|
+
(el) =>
|
|
487
|
+
el.props.accessibilityLabel === AccessibilityLabel.SENSOR_DISPLAY_ITEM
|
|
481
488
|
);
|
|
482
489
|
expect(sensorDisplayItem).toHaveLength(4);
|
|
483
490
|
});
|
|
@@ -541,7 +548,8 @@ describe('test DeviceDetail', () => {
|
|
|
541
548
|
|
|
542
549
|
const instance = tree.root;
|
|
543
550
|
const sensorDisplayItem = instance.findAll(
|
|
544
|
-
(el) =>
|
|
551
|
+
(el) =>
|
|
552
|
+
el.props.accessibilityLabel === AccessibilityLabel.SENSOR_DISPLAY_ITEM
|
|
545
553
|
);
|
|
546
554
|
expect(sensorDisplayItem).toHaveLength(1);
|
|
547
555
|
});
|
|
@@ -589,7 +597,8 @@ describe('test DeviceDetail', () => {
|
|
|
589
597
|
|
|
590
598
|
const instance = tree.root;
|
|
591
599
|
const sensorDisplayItem = instance.findAll(
|
|
592
|
-
(el) =>
|
|
600
|
+
(el) =>
|
|
601
|
+
el.props.accessibilityLabel === AccessibilityLabel.SENSOR_DISPLAY_ITEM
|
|
593
602
|
);
|
|
594
603
|
expect(sensorDisplayItem).toHaveLength(1);
|
|
595
604
|
|
|
@@ -604,7 +613,8 @@ describe('test DeviceDetail', () => {
|
|
|
604
613
|
});
|
|
605
614
|
const instance = tree.root;
|
|
606
615
|
const sensorDisplayItem = instance.findAll(
|
|
607
|
-
(el) =>
|
|
616
|
+
(el) =>
|
|
617
|
+
el.props.accessibilityLabel === AccessibilityLabel.SENSOR_DISPLAY_ITEM
|
|
608
618
|
);
|
|
609
619
|
expect(sensorDisplayItem).toHaveLength(0);
|
|
610
620
|
});
|
|
@@ -618,7 +628,9 @@ describe('test DeviceDetail', () => {
|
|
|
618
628
|
expect(menu.props.isVisible).toBe(false);
|
|
619
629
|
|
|
620
630
|
const buttonMore = instance.find(
|
|
621
|
-
(el) =>
|
|
631
|
+
(el) =>
|
|
632
|
+
el.props.accessibilityLabel ===
|
|
633
|
+
AccessibilityLabel.HEADER_DEVICE_BUTTON_MORE
|
|
622
634
|
);
|
|
623
635
|
await act(async () => {
|
|
624
636
|
await buttonMore.props.onPress();
|
|
@@ -627,7 +639,7 @@ describe('test DeviceDetail', () => {
|
|
|
627
639
|
});
|
|
628
640
|
|
|
629
641
|
test('Add device to Favourites', async () => {
|
|
630
|
-
const sensor = route
|
|
642
|
+
const sensor = route?.params?.sensorData;
|
|
631
643
|
sensor.is_favourite = false;
|
|
632
644
|
|
|
633
645
|
await act(async () => {
|
|
@@ -636,7 +648,9 @@ describe('test DeviceDetail', () => {
|
|
|
636
648
|
const instance = tree.root;
|
|
637
649
|
mock.onPost(API.DEVICE.ADD_TO_FAVOURITES(sensor.id)).reply(200);
|
|
638
650
|
const buttonStar = instance.find(
|
|
639
|
-
(el) =>
|
|
651
|
+
(el) =>
|
|
652
|
+
el.props.accessibilityLabel ===
|
|
653
|
+
AccessibilityLabel.HEADER_DEVICE_BUTTON_STAR
|
|
640
654
|
);
|
|
641
655
|
await act(async () => {
|
|
642
656
|
await buttonStar.props.onPress();
|
|
@@ -644,7 +658,7 @@ describe('test DeviceDetail', () => {
|
|
|
644
658
|
});
|
|
645
659
|
|
|
646
660
|
test('Remove device from Favourites', async () => {
|
|
647
|
-
const sensor = route
|
|
661
|
+
const sensor = route?.params?.sensorData;
|
|
648
662
|
store.unit.favoriteDeviceIds = [sensor.id];
|
|
649
663
|
|
|
650
664
|
await act(async () => {
|
|
@@ -654,7 +668,9 @@ describe('test DeviceDetail', () => {
|
|
|
654
668
|
mock.onPost(API.DEVICE.REMOVE_FROM_FAVOURITES(sensor.id)).reply(200);
|
|
655
669
|
|
|
656
670
|
const buttonStar = instance.find(
|
|
657
|
-
(el) =>
|
|
671
|
+
(el) =>
|
|
672
|
+
el.props.accessibilityLabel ===
|
|
673
|
+
AccessibilityLabel.HEADER_DEVICE_BUTTON_STAR
|
|
658
674
|
);
|
|
659
675
|
await act(async () => {
|
|
660
676
|
await buttonStar.props.onPress();
|
|
@@ -5,8 +5,10 @@ import HistoryChart from '../../../commons/Device/HistoryChart';
|
|
|
5
5
|
import { API } from '../../../configs';
|
|
6
6
|
import { axiosGet } from '../../../utils/Apis/axios';
|
|
7
7
|
|
|
8
|
-
export const DetailHistoryChart = ({ item, sensor }) => {
|
|
9
|
-
const
|
|
8
|
+
export const DetailHistoryChart = ({ item = {}, sensor = {} }) => {
|
|
9
|
+
const { configuration = {} } = item;
|
|
10
|
+
const { configs = [] } = configuration;
|
|
11
|
+
const [chartData, setChartData] = useState(configs);
|
|
10
12
|
const [startDate, setStartDate] = useState(
|
|
11
13
|
moment().subtract(1, 'days').valueOf()
|
|
12
14
|
);
|
|
@@ -14,7 +16,7 @@ export const DetailHistoryChart = ({ item, sensor }) => {
|
|
|
14
16
|
useEffect(() => {
|
|
15
17
|
const fetchData = async () => {
|
|
16
18
|
let params = new URLSearchParams();
|
|
17
|
-
|
|
19
|
+
configs.map((config) => {
|
|
18
20
|
params.append('config', config.id);
|
|
19
21
|
});
|
|
20
22
|
params.append('date_from', startDate / 1000);
|
|
@@ -30,7 +32,7 @@ export const DetailHistoryChart = ({ item, sensor }) => {
|
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
const formatData =
|
|
35
|
+
const formatData = configs.map((config) => {
|
|
34
36
|
const dataChart = data.find((k) => k.config === config.id) || {
|
|
35
37
|
data: [],
|
|
36
38
|
};
|
|
@@ -40,7 +42,7 @@ export const DetailHistoryChart = ({ item, sensor }) => {
|
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
44
|
fetchData();
|
|
43
|
-
}, [startDate, endDate,
|
|
45
|
+
}, [startDate, endDate, sensor, configs]);
|
|
44
46
|
if (!chartData.length) {
|
|
45
47
|
return false;
|
|
46
48
|
}
|
|
@@ -7,8 +7,8 @@ export const SensorConnectStatusViewHeader = ({
|
|
|
7
7
|
connectedViaNetwork,
|
|
8
8
|
connectedViaBle,
|
|
9
9
|
isDeviceHasBle,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
connectedViaHomeAssistant,
|
|
11
|
+
isHomeAssistantConnecting,
|
|
12
12
|
lastUpdated,
|
|
13
13
|
isDisplayTime,
|
|
14
14
|
showWindDirection,
|
|
@@ -18,10 +18,8 @@ export const SensorConnectStatusViewHeader = ({
|
|
|
18
18
|
if (!!sensor && sensor?.is_managed_by_backend) {
|
|
19
19
|
return false;
|
|
20
20
|
} else {
|
|
21
|
-
if (sensor?.device_type === DEVICE_TYPE.
|
|
22
|
-
return
|
|
23
|
-
} else if (sensor?.device_type === DEVICE_TYPE.GOOGLE_HOME) {
|
|
24
|
-
return isGGHomeConnecting;
|
|
21
|
+
if (sensor?.device_type === DEVICE_TYPE.GOOGLE_HOME) {
|
|
22
|
+
return isHomeAssistantConnecting;
|
|
25
23
|
} else {
|
|
26
24
|
return false;
|
|
27
25
|
}
|
|
@@ -33,6 +31,14 @@ export const SensorConnectStatusViewHeader = ({
|
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
if (!!sensor && sensor?.is_managed_by_backend) {
|
|
34
|
+
if (sensor?.device_type === DEVICE_TYPE.LG_THINQ) {
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<ConnectedViewHeader lastUpdated={lastUpdated} />
|
|
38
|
+
{children}
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
36
42
|
if (connectedViaNetwork) {
|
|
37
43
|
return (
|
|
38
44
|
<>
|
|
@@ -63,21 +69,14 @@ export const SensorConnectStatusViewHeader = ({
|
|
|
63
69
|
}
|
|
64
70
|
} else {
|
|
65
71
|
// not managed by backend
|
|
66
|
-
if (sensor?.device_type === DEVICE_TYPE.
|
|
67
|
-
|
|
68
|
-
<>
|
|
69
|
-
<ConnectedViewHeader lastUpdated={lastUpdated} />
|
|
70
|
-
{children}
|
|
71
|
-
</>
|
|
72
|
-
);
|
|
73
|
-
} else if (sensor?.device_type === DEVICE_TYPE.GOOGLE_HOME) {
|
|
74
|
-
if (connectedViaGGHome) {
|
|
72
|
+
if (sensor?.device_type === DEVICE_TYPE.GOOGLE_HOME) {
|
|
73
|
+
if (connectedViaHomeAssistant) {
|
|
75
74
|
return (
|
|
76
75
|
<>
|
|
77
76
|
<ConnectedViewHeader
|
|
78
77
|
lastUpdated={lastUpdated}
|
|
79
78
|
isDisplayTime={isDisplayTime}
|
|
80
|
-
type={'
|
|
79
|
+
type={'HomeAssistant'}
|
|
81
80
|
/>
|
|
82
81
|
{children}
|
|
83
82
|
</>
|
|
@@ -86,7 +85,7 @@ export const SensorConnectStatusViewHeader = ({
|
|
|
86
85
|
return (
|
|
87
86
|
<DisconnectedView
|
|
88
87
|
sensor={sensor}
|
|
89
|
-
type={'
|
|
88
|
+
type={'HomeAssistant'}
|
|
90
89
|
isDeviceHasBle={isDeviceHasBle}
|
|
91
90
|
/>
|
|
92
91
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import ActionGroup from '../../../commons/ActionGroup';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { CardDevMode } from '../../../commons/DevMode';
|
|
5
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
6
6
|
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
7
7
|
import { DetailHistoryChart } from './DetailHistoryChart';
|
|
8
8
|
import CurrentRainSensor from '../../../commons/Device/RainningSensor/CurrentRainSensor';
|
|
@@ -28,7 +28,7 @@ const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
|
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
export const SensorDisplayItem = ({
|
|
31
|
-
item,
|
|
31
|
+
item = {},
|
|
32
32
|
sensor,
|
|
33
33
|
emergency,
|
|
34
34
|
getData,
|
|
@@ -40,6 +40,8 @@ export const SensorDisplayItem = ({
|
|
|
40
40
|
}) => {
|
|
41
41
|
const t = useTranslations();
|
|
42
42
|
const userId = useSCContextSelector((state) => state.auth.account.user.id);
|
|
43
|
+
const { configuration = {}, id: idTemplate } = item;
|
|
44
|
+
const { type, uri, id, name, title } = configuration;
|
|
43
45
|
|
|
44
46
|
const sendRemoteCommand = useRemoteControl();
|
|
45
47
|
|
|
@@ -50,42 +52,47 @@ export const SensorDisplayItem = ({
|
|
|
50
52
|
[sensor, userId, sendRemoteCommand]
|
|
51
53
|
);
|
|
52
54
|
|
|
53
|
-
if (
|
|
54
|
-
setShowWindDirection(true);
|
|
55
|
+
if (type === 'compass') {
|
|
56
|
+
setShowWindDirection && setShowWindDirection(true);
|
|
55
57
|
}
|
|
56
58
|
switch (item.type) {
|
|
57
59
|
case 'camera':
|
|
58
60
|
return (
|
|
59
|
-
<
|
|
61
|
+
<CardDevMode title={t('camera')} id={idTemplate} isWrap>
|
|
60
62
|
<View style={styles.mediaContainer}>
|
|
61
63
|
<MediaPlayerDetail
|
|
62
|
-
uri={
|
|
64
|
+
uri={uri}
|
|
63
65
|
thumbnail={{
|
|
64
66
|
uri: background,
|
|
65
67
|
}}
|
|
66
|
-
key={`camera-device-${
|
|
67
|
-
cameraName={
|
|
68
|
+
key={`camera-device-${id}`}
|
|
69
|
+
cameraName={name}
|
|
68
70
|
width={standardizeWidth - 32}
|
|
69
71
|
height={standardizeHeight - 16}
|
|
70
72
|
/>
|
|
71
73
|
</View>
|
|
72
|
-
</
|
|
74
|
+
</CardDevMode>
|
|
73
75
|
);
|
|
74
76
|
case 'action':
|
|
75
77
|
return (
|
|
76
78
|
<ActionGroup
|
|
77
|
-
|
|
78
|
-
actionGroup={
|
|
79
|
+
accessibilityLabel={AccessibilityLabel.DEVICE_DETAIL_ACTION_GROUP}
|
|
80
|
+
actionGroup={configuration}
|
|
79
81
|
doAction={doAction}
|
|
80
82
|
sensor={sensor}
|
|
83
|
+
id={idTemplate}
|
|
81
84
|
/>
|
|
82
85
|
);
|
|
83
86
|
case 'history':
|
|
84
87
|
return <DetailHistoryChart item={item} sensor={sensor} />;
|
|
85
88
|
case 'value':
|
|
86
|
-
switch (
|
|
89
|
+
switch (type) {
|
|
87
90
|
case 'circle':
|
|
88
|
-
return
|
|
91
|
+
return (
|
|
92
|
+
<CardDevMode id={idTemplate}>
|
|
93
|
+
<CurrentRainSensor data={getData(item)} />
|
|
94
|
+
</CardDevMode>
|
|
95
|
+
);
|
|
89
96
|
case 'simple_list':
|
|
90
97
|
return (
|
|
91
98
|
<PMSensorIndicatior
|
|
@@ -94,22 +101,32 @@ export const SensorDisplayItem = ({
|
|
|
94
101
|
/>
|
|
95
102
|
);
|
|
96
103
|
case 'gauge':
|
|
97
|
-
return
|
|
104
|
+
return (
|
|
105
|
+
<CardDevMode id={idTemplate}>
|
|
106
|
+
<Anemometer data={getData(item)} maxValue={maxValue} />
|
|
107
|
+
</CardDevMode>
|
|
108
|
+
);
|
|
98
109
|
case 'compass':
|
|
99
|
-
return
|
|
110
|
+
return (
|
|
111
|
+
<CardDevMode id={idTemplate}>
|
|
112
|
+
<Compass data={getData(item)} />
|
|
113
|
+
</CardDevMode>
|
|
114
|
+
);
|
|
100
115
|
case 'alert_status':
|
|
101
116
|
return (
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
117
|
+
<CardDevMode id={idTemplate}>
|
|
118
|
+
<DeviceAlertStatus
|
|
119
|
+
data={getData(item)}
|
|
120
|
+
style={styles.marginLeft}
|
|
121
|
+
offsetTitle={offsetTitle}
|
|
122
|
+
setOffsetTitle={setOffsetTitle}
|
|
123
|
+
/>
|
|
124
|
+
</CardDevMode>
|
|
108
125
|
);
|
|
109
126
|
case 'flat_list':
|
|
110
127
|
return (
|
|
111
128
|
<FlatListItems
|
|
112
|
-
title={
|
|
129
|
+
title={title}
|
|
113
130
|
data={getData(item)}
|
|
114
131
|
style={[styles.marginLeft, styles.marginVertical]}
|
|
115
132
|
offsetTitle={offsetTitle}
|
|
@@ -119,14 +136,22 @@ export const SensorDisplayItem = ({
|
|
|
119
136
|
return <ListQualityIndicator data={getData(item)} />;
|
|
120
137
|
}
|
|
121
138
|
case 'emergency':
|
|
122
|
-
switch (
|
|
139
|
+
switch (type) {
|
|
123
140
|
case 'detail':
|
|
124
|
-
return
|
|
141
|
+
return (
|
|
142
|
+
<CardDevMode id={idTemplate}>
|
|
143
|
+
<EmergencyDetail item={item} />
|
|
144
|
+
</CardDevMode>
|
|
145
|
+
);
|
|
125
146
|
default:
|
|
126
147
|
return <EmergencyButton emergency={emergency} />;
|
|
127
148
|
}
|
|
128
149
|
case 'info':
|
|
129
|
-
return
|
|
150
|
+
return (
|
|
151
|
+
<CardDevMode id={idTemplate}>
|
|
152
|
+
<FooterInfo data={configuration} />
|
|
153
|
+
</CardDevMode>
|
|
154
|
+
);
|
|
130
155
|
case 'smart_ir':
|
|
131
156
|
return <SmartIr item={item} />;
|
|
132
157
|
default:
|