@eohjsc/react-native-smart-city 0.3.90 → 0.3.92
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 +1 -1
- package/src/Images/Common/reorder.svg +3 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/AutoLockStyles.js +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +3 -1
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +3 -10
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +1 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/SetupGeneratePasscodeStyles.js +1 -1
- package/src/commons/ActionGroup/OnOffTemplate/SwitchButtonTemplate.js +13 -5
- package/src/commons/ActionGroup/SliderRangeTemplate.js +100 -69
- package/src/commons/ActionGroup/SliderRangeTemplateStyles.js +27 -27
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +4 -1
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +1 -1
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +4 -1
- package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +56 -0
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +2 -2
- package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +45 -8
- package/src/commons/ActionGroup/__test__/index.test.js +0 -19
- package/src/commons/ActionGroup/index.js +0 -3
- package/src/commons/ActionTemplate/CurtainAction.js +5 -5
- package/src/commons/ActionTemplate/CurtainActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OnOffButtonAction.js +4 -4
- package/src/commons/ActionTemplate/OnOffButtonActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OnOffSimpleAction.js +4 -4
- package/src/commons/ActionTemplate/OnOffSimpleActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OnOffSmartLockAction.js +4 -4
- package/src/commons/ActionTemplate/OnOffSmartLockActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OneButtonAction.js +3 -3
- package/src/commons/ActionTemplate/OneButtonActionStyles.js +1 -1
- package/src/commons/ActionTemplate/ThreeButtonAction.js +5 -5
- package/src/commons/ActionTemplate/ThreeButtonActionStyles.js +1 -1
- package/src/commons/ActionTemplate/__test__/CurtainAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/OnOffSimpleAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/OnOffSmartLockAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/OneButtonAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/ThreeButtonAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/index.test.js +21 -70
- package/src/commons/ActionTemplate/index.js +19 -55
- package/src/commons/Alert/__test__/Alert.test.js +1 -1
- package/src/commons/Auth/AccountList.js +1 -1
- package/src/commons/Auth/__test__/OtpInputList.test.js +17 -19
- package/src/commons/Automate/ItemAutomate.js +10 -4
- package/src/commons/Automate/__test__/ItemAutomate.test.js +11 -11
- package/src/commons/BackDefault/__test__/BackDefault.test.js +1 -1
- package/src/commons/Button/__test__/Button.test.js +1 -1
- package/src/commons/ButtonPopup/__test__/ButtonPopup.test.js +1 -1
- package/src/commons/Calendar/__test__/Calendar.test.js +1 -1
- package/src/commons/ChartLoading/__test__/ChartLoading.test.js +1 -1
- package/src/commons/CircleButton/__test__/CircleButton.test.js +1 -1
- package/src/commons/CircleView/__test__/CircleView.test.js +1 -1
- package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -2
- package/src/commons/DateTimeRangeChange/index.js +31 -48
- package/src/commons/Device/DeviceAlertStatus.js +2 -1
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +2 -2
- package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +1 -1
- package/src/commons/Device/FlatListItems.js +1 -1
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +2 -2
- package/src/commons/Device/HistoryChart.js +6 -49
- package/src/commons/Device/LinearChart/LinearChart.test.js +1 -1
- package/src/commons/Device/ProgressBar/__test__/ProgressBar.test.js +1 -1
- package/src/commons/Device/ProgressBar/index.js +5 -11
- package/src/commons/Device/ProgressBar/styles.js +11 -3
- package/src/commons/Device/RainningSensor/__test__/CurrentRainSensor.test.js +5 -5
- package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +3 -3
- package/src/commons/Device/WindDirection/Compass/Compass.test.js +2 -2
- package/src/commons/Device/WindSpeed/Anemometer/index.js +2 -0
- package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +14 -1
- package/src/commons/Device/WindSpeed/LinearChart/index.js +5 -3
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +3 -3
- package/src/commons/Device/__test__/DisconnectedView.test.js +2 -2
- package/src/commons/Device/__test__/FlatListItems.test.js +1 -1
- package/src/commons/Device/__test__/SensorConnectedStatus.test.js +1 -1
- package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +1 -1
- package/src/commons/FlatListDnD/__test__/index.test.js +49 -0
- package/src/commons/FlatListDnD/index.js +37 -0
- package/src/commons/FlatListDnD/styles.js +12 -0
- package/src/commons/Form/__test__/CurrencyInput.test.js +2 -2
- package/src/commons/Form/__test__/TextInput.test.js +3 -3
- package/src/commons/Form/__test__/TextInputPassword.test.js +2 -2
- package/src/commons/FullLoading/__test__/index.test.js +2 -2
- package/src/commons/Header/HeaderCustom.js +2 -1
- package/src/commons/HorizontalPicker/index.js +65 -38
- package/src/commons/IconComponent/index.js +3 -2
- package/src/commons/ImageButton/__test__/ImageButton.test.js +1 -1
- package/src/commons/MediaPlayer/__test__/index.test.js +8 -3
- package/src/commons/MediaPlayer/index.js +11 -7
- package/src/commons/MenuActionMore/index.js +6 -4
- package/src/commons/Modal/ModalBottom.js +2 -3
- package/src/commons/Modal/ModalCustom.js +2 -3
- package/src/commons/NavBar/index.js +48 -50
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplateStyles.js +1 -1
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +5 -5
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplateStyles.js +1 -1
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +5 -5
- package/src/commons/OneTapTemplate/StatesGridActionTemplateStyles.js +1 -1
- package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +2 -2
- package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +1 -1
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +2 -2
- package/src/commons/PreventAccess/index.js +1 -1
- package/src/commons/RowItem/__test__/RowItem.test.js +1 -1
- package/src/commons/RowUser/__test__/RowUser.test.js +1 -1
- package/src/commons/Section/Section.test.js +2 -2
- package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -1
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +3 -3
- package/src/commons/Sharing/StationDevicePermissions.js +4 -4
- package/src/commons/Sharing/WrapHeaderScrollable.js +5 -5
- package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +1 -1
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +3 -3
- package/src/commons/Sharing/__test__/MemberList.test.js +6 -4
- package/src/commons/Sharing/__test__/RowMember.test.js +2 -2
- package/src/commons/Sharing/__test__/WrapHeaderScrollable.test.js +4 -2
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +7 -11
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +13 -16
- package/src/commons/SubUnit/OneTap/index.js +22 -7
- package/src/commons/TextButton/__test__/TextButton.test.js +2 -2
- package/src/commons/Today/__test__/Today.test.js +1 -1
- package/src/commons/TouchableScale/__test__/TouchableScale.test.js +1 -1
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +4 -0
- package/src/commons/UnitSummary/AirQuality/index.js +2 -2
- package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +1 -1
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +0 -6
- package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +1 -1
- package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +1 -1
- package/src/commons/ViewButtonBottom/__test__/ViewButtonBottom.test.js +1 -1
- package/src/configs/API.js +14 -31
- package/src/configs/AccessibilityLabel.js +1 -0
- package/src/configs/Colors.js +1 -1
- package/src/configs/Constants.js +14 -48
- package/src/context/reducer.ts +3 -1
- package/src/hoc/__test__/withRemoteControl.test.js +1 -1
- package/src/hooks/Common/__test__/useStatusbar.test.js +5 -5
- package/src/hooks/Common/index.js +0 -2
- package/src/hooks/Common/useKeyboardShow.js +4 -4
- package/src/hooks/Common/useStatusBar.js +2 -2
- package/src/hooks/Common/useTitleHeader.js +5 -7
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +11 -0
- package/src/hooks/IoT/useBluetoothConnection.js +6 -3
- package/src/hooks/index.js +1 -2
- package/src/navigations/UnitStack.js +51 -17
- package/src/screens/ActivityLog/FilterPopup.js +4 -4
- package/src/screens/ActivityLog/__test__/FilterPopup.test.js +2 -2
- package/src/screens/ActivityLog/__test__/index.test.js +2 -2
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +3 -3
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +5 -5
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +9 -33
- package/src/screens/AddNewAutoSmart/index.js +33 -89
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectRouterGuide.test.js +1 -1
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +1 -1
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +1 -1
- package/src/screens/AddNewGateway/SelectDeviceSubUnit.js +1 -2
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +5 -17
- package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +1 -1
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +2 -2
- package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +3 -3
- package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +2 -2
- package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +8 -16
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +10 -12
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -14
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -14
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +1 -1
- package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +3 -2
- package/src/screens/AddNewGateway/index.js +1 -1
- package/src/screens/AllCamera/__test__/index.test.js +18 -57
- package/src/screens/AllCamera/index.js +100 -33
- package/src/screens/AllGateway/DetailConfigActionZigbee/__test__/index.test.js +0 -18
- package/src/screens/AllGateway/DetailConfigActionZigbee/index.js +1 -1
- package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +5 -2
- package/src/screens/AllGateway/hooks/__test__/index.test.js +1 -1
- package/src/screens/Automate/AddNewAction/ChooseAction.js +139 -0
- package/src/screens/Automate/AddNewAction/ChooseConfig.js +179 -0
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Components/LoadingSelectAction.js +1 -1
- package/src/screens/Automate/AddNewAction/Components/SelectDevices.js +75 -0
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/DeviceStyles.js +5 -1
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/__test__/index.test.js +4 -4
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/index.js +5 -4
- package/src/screens/Automate/AddNewAction/NewActionWrapper.js +56 -0
- package/src/screens/Automate/AddNewAction/SelectControlDevices.js +69 -0
- package/src/screens/Automate/AddNewAction/SelectMonitorDevices.js +110 -0
- package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +196 -0
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Styles/SelectActionStyles.js +1 -1
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Styles/SelectSensorDevicesStyles.js +1 -1
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Styles/SetupSensorStyles.js +5 -3
- package/src/screens/{AddNewAction/__test__/SelectAction.test.js → Automate/AddNewAction/__test__/ChooseAction.test.js} +101 -122
- package/src/screens/Automate/AddNewAction/__test__/ChooseConfig.test.js +210 -0
- package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +130 -0
- package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +92 -0
- package/src/screens/Automate/AddNewAction/__test__/SetupSensor.test.js +131 -0
- package/src/screens/Automate/Components/InputName.js +64 -0
- package/src/screens/{AddNewOneTap/AddNewOneTapStyles.js → Automate/Components/InputNameStyles.js} +2 -2
- package/src/screens/{EditActionsList → Automate/EditActionsList}/Styles/indexStyles.js +5 -1
- package/src/screens/{EditActionsList → Automate/EditActionsList}/__tests__/index.test.js +20 -12
- package/src/screens/{EditActionsList → Automate/EditActionsList}/index.js +18 -19
- package/src/screens/Automate/MultiUnits.js +70 -68
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +134 -0
- package/src/screens/Automate/OneTap/index.js +16 -0
- package/src/screens/Automate/Scenario/ScenarioName.js +15 -0
- package/src/screens/{AddNewOneTap → Automate/Scenario}/__test__/AddNewOneTap.test.js +27 -45
- package/src/screens/Automate/ScriptDetail/Components/DeleteScript.js +45 -0
- package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +58 -0
- package/src/screens/{ScriptDetail → Automate/ScriptDetail}/Styles/indexStyles.js +1 -1
- package/src/screens/{ScriptDetail → Automate/ScriptDetail}/__test__/index.test.js +67 -76
- package/src/screens/{ScriptDetail → Automate/ScriptDetail}/__test__/useStarredScript.test.js +7 -6
- package/src/screens/{ScriptDetail → Automate/ScriptDetail}/hooks/useStarredScript.js +4 -4
- package/src/screens/Automate/ScriptDetail/index.js +346 -0
- package/src/screens/Automate/ScriptDetail/utils.js +113 -0
- package/src/screens/{SetSchedule → Automate/SetSchedule}/__test__/SelectWeekday.test.js +2 -2
- package/src/screens/{SetSchedule → Automate/SetSchedule}/__test__/index.test.js +21 -46
- package/src/screens/{SetSchedule → Automate/SetSchedule}/components/RepeatOptionsPopup.js +4 -4
- package/src/screens/{SetSchedule → Automate/SetSchedule}/components/RowItem.js +2 -2
- package/src/screens/{SetSchedule → Automate/SetSchedule}/components/SelectWeekday.js +3 -3
- package/src/screens/Automate/SetSchedule/index.js +140 -0
- package/src/screens/{SetSchedule → Automate/SetSchedule}/styles/RepeatOptionsPopupStyles.js +1 -1
- package/src/screens/{SetSchedule → Automate/SetSchedule}/styles/RowItemStyles.js +1 -1
- package/src/screens/{SetSchedule → Automate/SetSchedule}/styles/SelectWeekdayStyles.js +1 -1
- package/src/screens/{SetSchedule → Automate/SetSchedule}/styles/indexStyles.js +1 -1
- package/src/screens/Automate/ValueChange/ValueChangeName.js +16 -0
- package/src/screens/Automate/__test__/MultiUnits.test.js +78 -122
- package/src/screens/Automate/__test__/index.test.js +21 -47
- package/src/screens/Automate/constants.js +0 -0
- package/src/screens/Automate/index.js +18 -24
- package/src/screens/ChangePosition/__test__/index.test.js +75 -0
- package/src/screens/ChangePosition/index.js +112 -0
- package/src/screens/ChangePosition/styles.js +87 -0
- package/src/screens/Device/__test__/DetailHistoryChart.test.js +2 -2
- package/src/screens/Device/__test__/EmergencyCountdown.test.js +4 -2
- package/src/screens/Device/__test__/detail.test.js +202 -257
- package/src/screens/Device/__test__/sensorDisplayItem.test.js +14 -10
- package/src/screens/Device/components/ChartWrapper.js +3 -3
- package/src/screens/Device/components/SensorDisplayItem.js +2 -1
- package/src/screens/Device/components/VisualChart.js +56 -9
- package/src/screens/Device/components/__test__/VisualChart.test.js +1 -1
- package/src/screens/Device/detail.js +14 -0
- package/src/screens/Device/hooks/__test__/useEmergencyButton.test.js +35 -13
- package/src/screens/Device/hooks/useEvaluateValue.js +28 -2
- package/src/screens/Device/styles.js +7 -0
- package/src/screens/DeviceInfo/__test__/index.test.js +16 -18
- package/src/screens/DeviceInfo/index.js +6 -5
- package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +52 -0
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +18 -13
- package/src/screens/Notification/__test__/Notification.test.js +64 -73
- package/src/screens/Notification/index.js +14 -14
- package/src/screens/PlayBackCamera/index.js +2 -3
- package/src/screens/SelectUnit/__test__/index.test.js +0 -5
- package/src/screens/SelectUnit/index.js +1 -2
- package/src/screens/SharedUnit/index.js +5 -4
- package/src/screens/Sharing/Components/TitleCheckBox.js +2 -2
- package/src/screens/Sharing/SelectUser.js +2 -2
- package/src/screens/Sharing/__test__/MemberList.test.js +9 -15
- package/src/screens/Sharing/__test__/MemberList2.test.js +10 -16
- package/src/screens/Sharing/__test__/SelectUser.test.js +8 -4
- package/src/screens/SideMenuDetail/SideMenuDetailStyles.js +1 -1
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +3 -3
- package/src/screens/SmartAccount/__test__/Connecting.test.js +1 -1
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +3 -3
- package/src/screens/SmartAccount/index.js +1 -0
- package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +1 -1
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +5 -5
- package/src/screens/SmartIr/__test__/SelectBrand.test.js +2 -2
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +2 -2
- package/src/screens/SmartIr/__test__/SmartIr.test.js +2 -2
- package/src/screens/SubUnit/ManageSubUnit.js +4 -4
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +9 -28
- package/src/screens/TDSGuide/index.js +1 -1
- package/src/screens/Template/GatewayList.js +4 -1
- package/src/screens/Template/__test__/detail.test.js +24 -22
- package/src/screens/Template/detail.js +1 -0
- package/src/screens/UVIndexGuide/index.js +2 -2
- package/src/screens/Unit/Detail.js +6 -5
- package/src/screens/Unit/SelectAddToFavorites.js +1 -1
- package/src/screens/Unit/__test__/ChooseLocation.test.js +8 -13
- package/src/screens/Unit/__test__/Detail.test.js +10 -14
- package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +1 -1
- package/src/screens/Unit/__test__/SmartAccount.test.js +8 -14
- package/src/screens/Unit/components/__test__/Header.test.js +4 -4
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +1 -1
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +14 -6
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +1 -1
- package/src/screens/UnitSummary/components/Temperature/index.js +2 -2
- package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +4 -0
- package/src/screens/UnitSummary/components/UvIndex/index.js +2 -2
- package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +6 -11
- package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -2
- package/src/screens/UnitSummary/components/__test__/TotalPowerBox.test.js +1 -1
- package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +1 -1
- package/src/screens/UnitSummary/components/__test__/index.test.js +2 -2
- package/src/screens/WaterQualityGuide/index.js +10 -5
- package/src/utils/Apis/axios.js +3 -0
- package/src/utils/I18n/translations/en.json +24 -18
- package/src/utils/I18n/translations/vi.json +22 -18
- package/src/utils/Route/index.js +9 -3
- package/src/utils/Utils.js +29 -0
- package/src/utils/__test__/Utils.test.js +6 -0
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +0 -130
- package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +0 -109
- package/src/commons/Auth/SocialButton.js +0 -54
- package/src/commons/Auth/__test__/SocialButton.test.js +0 -44
- package/src/commons/Sharing/__test__/StationDevicePermission.test.js +0 -85
- package/src/hooks/__test__/useInitDeepLink.test.js +0 -28
- package/src/hooks/useInitDeepLink.js +0 -25
- package/src/screens/AddNewAction/SelectAction.js +0 -570
- package/src/screens/AddNewAction/SelectSensorDevices.js +0 -236
- package/src/screens/AddNewAction/SetupSensor.js +0 -263
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +0 -181
- package/src/screens/AddNewAction/__test__/SetupSensor.test.js +0 -114
- package/src/screens/AddNewOneTap/index.js +0 -147
- package/src/screens/ScriptDetail/hooks/index.js +0 -136
- package/src/screens/ScriptDetail/index.js +0 -525
- package/src/screens/SetSchedule/index.js +0 -200
- /package/src/screens/{AddNewAction → Automate/AddNewAction}/Components/index.js +0 -0
- /package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/LoadingSelectAction.test.js +0 -0
|
@@ -1,570 +0,0 @@
|
|
|
1
|
-
import React, { memo, useCallback, useEffect, useState, useMemo } from 'react';
|
|
2
|
-
import { Alert, Image, TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import { useNavigation } from '@react-navigation/native';
|
|
4
|
-
import { Icon } from '@ant-design/react-native';
|
|
5
|
-
|
|
6
|
-
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
7
|
-
import BottomButtonView from '../../commons/BottomButtonView';
|
|
8
|
-
import Text from '../../commons/Text';
|
|
9
|
-
import ActionTemplate from '../../commons/ActionTemplate';
|
|
10
|
-
import NumberUpDownActionTemplate from '../../commons/OneTapTemplate/NumberUpDownActionTemplate';
|
|
11
|
-
import OptionsDropdownActionTemplate from '../../commons/OneTapTemplate/OptionsDropdownActionTemplate';
|
|
12
|
-
import StatesGridActionTemplate from '../../commons/OneTapTemplate/StatesGridActionTemplate';
|
|
13
|
-
import { axiosGet, axiosPost, axiosPut } from '../../utils/Apis/axios';
|
|
14
|
-
import { API, Images } from '../../configs';
|
|
15
|
-
import {
|
|
16
|
-
CONDITION_TYPES,
|
|
17
|
-
STATE_VALUE_SENSOR_TYPES,
|
|
18
|
-
AccessibilityLabel,
|
|
19
|
-
AUTOMATE_TYPE,
|
|
20
|
-
} from '../../configs/Constants';
|
|
21
|
-
import Routes from '../../utils/Route';
|
|
22
|
-
import styles from './Styles/SelectActionStyles';
|
|
23
|
-
import moment from 'moment';
|
|
24
|
-
import { Colors } from '../../configs';
|
|
25
|
-
import { TitleCheckBox } from '../Sharing/Components';
|
|
26
|
-
import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
|
|
27
|
-
import { popAction } from '../../navigations/utils';
|
|
28
|
-
import { LoadingSelectAction } from './Components';
|
|
29
|
-
import { notImplemented, ToastBottomHelper } from '../../utils/Utils';
|
|
30
|
-
|
|
31
|
-
const SelectAction = memo(({ route }) => {
|
|
32
|
-
const t = useTranslations();
|
|
33
|
-
const { navigate, dispatch, goBack } = useNavigation();
|
|
34
|
-
const {
|
|
35
|
-
unit,
|
|
36
|
-
device,
|
|
37
|
-
automateId,
|
|
38
|
-
automate = {},
|
|
39
|
-
scriptName,
|
|
40
|
-
isSelectSensor = false,
|
|
41
|
-
type,
|
|
42
|
-
isAutomateTab,
|
|
43
|
-
isCreateNewAction,
|
|
44
|
-
isMultiUnits,
|
|
45
|
-
oldType,
|
|
46
|
-
isSetupEvent,
|
|
47
|
-
} = route?.params || {};
|
|
48
|
-
const [data, setData] = useState([]);
|
|
49
|
-
const [actions, setActions] = useState([]);
|
|
50
|
-
const [sensorData, setSensorData] = useState([]);
|
|
51
|
-
const [checkedItem, setCheckedItem] = useState({});
|
|
52
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
53
|
-
const [isfetched, setIsfetched] = useState(true);
|
|
54
|
-
|
|
55
|
-
const fetchData = useCallback(async () => {
|
|
56
|
-
isSelectSensor && setIsLoading(true);
|
|
57
|
-
setIsfetched(true);
|
|
58
|
-
const { success, data: automateData } = await axiosGet(
|
|
59
|
-
isSelectSensor
|
|
60
|
-
? API.AUTOMATE.GET_SENSOR_CONFIG(device.id)
|
|
61
|
-
: isSetupEvent
|
|
62
|
-
? API.DEVICE.DISPLAY_EVENTS(device.id)
|
|
63
|
-
: API.DEVICE.DISPLAY_ACTIONS(device.id),
|
|
64
|
-
isSelectSensor && {},
|
|
65
|
-
isSelectSensor && true
|
|
66
|
-
);
|
|
67
|
-
if (success) {
|
|
68
|
-
if (isSelectSensor) {
|
|
69
|
-
if (automate?.config_id) {
|
|
70
|
-
const conditionType = [
|
|
71
|
-
{
|
|
72
|
-
title: `${t('is_below')} (<)`,
|
|
73
|
-
type: CONDITION_TYPES.IS_BELOW,
|
|
74
|
-
conditionValue: '<',
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
title: `${t('is')} (=)`,
|
|
78
|
-
type: CONDITION_TYPES.IS,
|
|
79
|
-
conditionValue: '=',
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
title: `${t('is_above')} (>)`,
|
|
83
|
-
type: CONDITION_TYPES.IS_ABOVE,
|
|
84
|
-
conditionValue: '>',
|
|
85
|
-
},
|
|
86
|
-
];
|
|
87
|
-
const condition = conditionType.find((item) => {
|
|
88
|
-
return item.conditionValue === automate.condition;
|
|
89
|
-
});
|
|
90
|
-
const updateSensorData = automateData.map((obj) =>
|
|
91
|
-
obj.id === automate.config_id
|
|
92
|
-
? { ...obj, value: automate.value, ...condition }
|
|
93
|
-
: obj
|
|
94
|
-
);
|
|
95
|
-
let selectSensor = automateData.find((config) => {
|
|
96
|
-
return config.id === automate.config_id;
|
|
97
|
-
});
|
|
98
|
-
setSensorData(updateSensorData);
|
|
99
|
-
setCheckedItem(selectSensor);
|
|
100
|
-
} else {
|
|
101
|
-
setSensorData(automateData);
|
|
102
|
-
}
|
|
103
|
-
} else {
|
|
104
|
-
if (isSetupEvent) {
|
|
105
|
-
setData(automateData?.actions);
|
|
106
|
-
setSensorData(automateData?.config_events);
|
|
107
|
-
} else {
|
|
108
|
-
setData(automateData);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
setIsfetched(false);
|
|
113
|
-
const to = setTimeout(() => {
|
|
114
|
-
setIsLoading(false);
|
|
115
|
-
clearTimeout(to);
|
|
116
|
-
}, 1000);
|
|
117
|
-
}, [
|
|
118
|
-
automate.condition,
|
|
119
|
-
automate.config_id,
|
|
120
|
-
automate.value,
|
|
121
|
-
device.id,
|
|
122
|
-
isSelectSensor,
|
|
123
|
-
isSetupEvent,
|
|
124
|
-
t,
|
|
125
|
-
]);
|
|
126
|
-
|
|
127
|
-
const checkConditionToContinue = useCallback(() => {
|
|
128
|
-
const itemTemp = sensorData?.find((i) => i.id === checkedItem?.id);
|
|
129
|
-
if (itemTemp?.value) {
|
|
130
|
-
navigate(Routes.AddNewOneTap, {
|
|
131
|
-
automateData: {
|
|
132
|
-
condition: itemTemp?.conditionValue || '<',
|
|
133
|
-
value: itemTemp?.value,
|
|
134
|
-
config: itemTemp?.id,
|
|
135
|
-
},
|
|
136
|
-
type: isSetupEvent ? AUTOMATE_TYPE.EVENT_SENSOR : type,
|
|
137
|
-
unit,
|
|
138
|
-
isAutomateTab,
|
|
139
|
-
isSelectSensor,
|
|
140
|
-
isMultiUnits,
|
|
141
|
-
automateId,
|
|
142
|
-
automate: {
|
|
143
|
-
...automate,
|
|
144
|
-
condition: itemTemp?.conditionValue || '<',
|
|
145
|
-
value: itemTemp?.value,
|
|
146
|
-
config_id: itemTemp?.id,
|
|
147
|
-
config_name: itemTemp?.name,
|
|
148
|
-
sensor_type: itemTemp?.sensor_type,
|
|
149
|
-
},
|
|
150
|
-
scriptName,
|
|
151
|
-
});
|
|
152
|
-
} else {
|
|
153
|
-
ToastBottomHelper.error(t('please_choose_condition_before_continue'));
|
|
154
|
-
}
|
|
155
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
156
|
-
}, [
|
|
157
|
-
sensorData,
|
|
158
|
-
navigate,
|
|
159
|
-
type,
|
|
160
|
-
unit,
|
|
161
|
-
isSelectSensor,
|
|
162
|
-
automateId,
|
|
163
|
-
scriptName,
|
|
164
|
-
checkedItem,
|
|
165
|
-
t,
|
|
166
|
-
]);
|
|
167
|
-
const onSave = useCallback(async () => {
|
|
168
|
-
if (actions.length && !!checkedItem.id) {
|
|
169
|
-
Alert.alert('', t('choose_only_one'));
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
if (isSelectSensor || sensorData?.length > 0) {
|
|
173
|
-
await checkConditionToContinue();
|
|
174
|
-
} else {
|
|
175
|
-
if (automateId) {
|
|
176
|
-
let result = false;
|
|
177
|
-
let data_automate;
|
|
178
|
-
if (isCreateNewAction) {
|
|
179
|
-
let list_action = [...actions];
|
|
180
|
-
list_action = list_action.map((item) => ({
|
|
181
|
-
action: item.action,
|
|
182
|
-
data: item.data,
|
|
183
|
-
}));
|
|
184
|
-
const { success } = await axiosPost(
|
|
185
|
-
API.AUTOMATE.ADD_SCRIPT_ACTION(automateId),
|
|
186
|
-
{
|
|
187
|
-
list_action,
|
|
188
|
-
unit: unit.id,
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
result = success;
|
|
192
|
-
data_automate = automate;
|
|
193
|
-
} else {
|
|
194
|
-
const params = {
|
|
195
|
-
unit: isMultiUnits ? null : unit.id,
|
|
196
|
-
type: type,
|
|
197
|
-
name: scriptName,
|
|
198
|
-
action: actions[0].action,
|
|
199
|
-
};
|
|
200
|
-
const { success } = await axiosPut(
|
|
201
|
-
API.AUTOMATE.UPDATE_AUTOMATE(automateId),
|
|
202
|
-
params
|
|
203
|
-
);
|
|
204
|
-
result = success;
|
|
205
|
-
data_automate = {
|
|
206
|
-
...automate,
|
|
207
|
-
event: {
|
|
208
|
-
end_device_name: device?.name,
|
|
209
|
-
action: actions[0]?.action_name,
|
|
210
|
-
},
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
result &&
|
|
214
|
-
navigate(Routes.ScriptDetail, {
|
|
215
|
-
id: automateId,
|
|
216
|
-
name: scriptName,
|
|
217
|
-
havePermission: true,
|
|
218
|
-
unit,
|
|
219
|
-
saveAt: moment().valueOf(),
|
|
220
|
-
type: type,
|
|
221
|
-
isAutomateTab,
|
|
222
|
-
isCreateNewAction,
|
|
223
|
-
isMultiUnits,
|
|
224
|
-
automate: data_automate,
|
|
225
|
-
});
|
|
226
|
-
} else {
|
|
227
|
-
navigate(Routes.AddNewOneTap, {
|
|
228
|
-
automateData: {
|
|
229
|
-
action: actions[0].action,
|
|
230
|
-
},
|
|
231
|
-
type: AUTOMATE_TYPE.EVENT_ACTION,
|
|
232
|
-
unit,
|
|
233
|
-
isAutomateTab,
|
|
234
|
-
isSelectSensor,
|
|
235
|
-
isMultiUnits,
|
|
236
|
-
automateId,
|
|
237
|
-
automate: {
|
|
238
|
-
...automate,
|
|
239
|
-
action: actions[0].action,
|
|
240
|
-
},
|
|
241
|
-
scriptName,
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
246
|
-
}, [
|
|
247
|
-
actions,
|
|
248
|
-
automateId,
|
|
249
|
-
navigate,
|
|
250
|
-
scriptName,
|
|
251
|
-
type,
|
|
252
|
-
unit,
|
|
253
|
-
isSelectSensor,
|
|
254
|
-
checkedItem,
|
|
255
|
-
sensorData,
|
|
256
|
-
isCreateNewAction,
|
|
257
|
-
]);
|
|
258
|
-
|
|
259
|
-
const handleOnSelectAction = (action) => {
|
|
260
|
-
let newActions = [...actions];
|
|
261
|
-
let index = -1;
|
|
262
|
-
|
|
263
|
-
switch (action.template) {
|
|
264
|
-
case 'on_off_button_action_template':
|
|
265
|
-
case 'one_button_action_template':
|
|
266
|
-
case 'three_button_action_template':
|
|
267
|
-
case 'OnOffSimpleActionTemplate':
|
|
268
|
-
case 'curtain_action_template':
|
|
269
|
-
case 'OnOffSmartLockActionTemplate':
|
|
270
|
-
index = newActions.findIndex((item) => {
|
|
271
|
-
return (
|
|
272
|
-
item.template === 'on_off_button_action_template' ||
|
|
273
|
-
item.template === 'one_button_action_template' ||
|
|
274
|
-
item.template === 'three_button_action_template' ||
|
|
275
|
-
item.template === 'OnOffSimpleActionTemplate' ||
|
|
276
|
-
item.template === 'curtain_action_template' ||
|
|
277
|
-
item.template === 'OnOffSmartLockActionTemplate'
|
|
278
|
-
);
|
|
279
|
-
});
|
|
280
|
-
break;
|
|
281
|
-
|
|
282
|
-
case 'StatesGridActionTemplate':
|
|
283
|
-
index = newActions.findIndex(
|
|
284
|
-
(item) => item.template === action.template
|
|
285
|
-
);
|
|
286
|
-
break;
|
|
287
|
-
case 'OptionsDropdownActionTemplate':
|
|
288
|
-
case 'NumberUpDownActionTemplate':
|
|
289
|
-
index = newActions.findIndex((item) => item.action === action.action);
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (index < 0) {
|
|
294
|
-
newActions.push(action);
|
|
295
|
-
} else {
|
|
296
|
-
newActions[index] = action;
|
|
297
|
-
}
|
|
298
|
-
setActions(newActions);
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
const handleClose = useCallback(() => {
|
|
302
|
-
if (automateId) {
|
|
303
|
-
navigate(Routes.ScriptDetail, {
|
|
304
|
-
id: automateId,
|
|
305
|
-
name: scriptName,
|
|
306
|
-
type: oldType,
|
|
307
|
-
havePermission: true,
|
|
308
|
-
unit,
|
|
309
|
-
isMultiUnits,
|
|
310
|
-
isCreateNewAction,
|
|
311
|
-
isAutomateTab,
|
|
312
|
-
});
|
|
313
|
-
} else if (isCreateNewAction) {
|
|
314
|
-
dispatch(popAction(2));
|
|
315
|
-
} else if (isSelectSensor) {
|
|
316
|
-
dispatch(popAction(3));
|
|
317
|
-
isAutomateTab && goBack();
|
|
318
|
-
} else {
|
|
319
|
-
notImplemented(t);
|
|
320
|
-
}
|
|
321
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
322
|
-
}, [route.params]);
|
|
323
|
-
|
|
324
|
-
const onChecked = useCallback(
|
|
325
|
-
(_, isChecked, id) => {
|
|
326
|
-
setCheckedItem(isChecked ? sensorData.find((i) => i?.id === id) : {});
|
|
327
|
-
},
|
|
328
|
-
[sensorData]
|
|
329
|
-
);
|
|
330
|
-
|
|
331
|
-
const onPressItem = (item) => () => {
|
|
332
|
-
navigate(Routes.SetUpSensor, {
|
|
333
|
-
item,
|
|
334
|
-
sensorData,
|
|
335
|
-
setSensorData,
|
|
336
|
-
isAutomateTab,
|
|
337
|
-
});
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
const RenderCondition = useCallback(
|
|
341
|
-
(item) => {
|
|
342
|
-
const stateConditionData = STATE_VALUE_SENSOR_TYPES.find(
|
|
343
|
-
(i) => i.type === item?.sensor_type
|
|
344
|
-
);
|
|
345
|
-
const isNumberValue = !stateConditionData;
|
|
346
|
-
|
|
347
|
-
if (isNumberValue) {
|
|
348
|
-
return `${item?.name} ${item.title || t('is_below') + ' (<)'} ${
|
|
349
|
-
item?.value
|
|
350
|
-
} ${item?.unit || ''}`;
|
|
351
|
-
}
|
|
352
|
-
return t(stateConditionData?.stateValue[item?.value]);
|
|
353
|
-
},
|
|
354
|
-
[t]
|
|
355
|
-
);
|
|
356
|
-
|
|
357
|
-
const rightComponent = useMemo(
|
|
358
|
-
() => (
|
|
359
|
-
<TouchableOpacity style={styles.closeButton} onPress={handleClose}>
|
|
360
|
-
<Icon name={'close'} size={24} color={Colors.Black} />
|
|
361
|
-
</TouchableOpacity>
|
|
362
|
-
),
|
|
363
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
364
|
-
[route.params]
|
|
365
|
-
);
|
|
366
|
-
|
|
367
|
-
const renderBottomButtonView = useMemo(
|
|
368
|
-
() => (
|
|
369
|
-
<BottomButtonView
|
|
370
|
-
style={styles.bottomButtonView}
|
|
371
|
-
mainTitle={t(automateId ? 'save' : 'continue')}
|
|
372
|
-
onPressMain={onSave}
|
|
373
|
-
typeMain={
|
|
374
|
-
actions.length > 0 || !!checkedItem?.id ? 'primary' : 'disabled'
|
|
375
|
-
}
|
|
376
|
-
/>
|
|
377
|
-
),
|
|
378
|
-
[t, automateId, onSave, actions.length, checkedItem?.id]
|
|
379
|
-
);
|
|
380
|
-
|
|
381
|
-
useEffect(() => {
|
|
382
|
-
fetchData();
|
|
383
|
-
}, [fetchData]);
|
|
384
|
-
|
|
385
|
-
return (
|
|
386
|
-
<View style={styles.wrap}>
|
|
387
|
-
<WrapHeaderScrollable
|
|
388
|
-
title={t('set_up {name}', { name: device?.name })}
|
|
389
|
-
headerAniStyle={styles.headerAniStyle}
|
|
390
|
-
rightComponent={rightComponent}
|
|
391
|
-
>
|
|
392
|
-
{isSelectSensor ? (
|
|
393
|
-
isLoading ? (
|
|
394
|
-
<LoadingSelectAction style={styles.container} />
|
|
395
|
-
) : (
|
|
396
|
-
sensorData.map((item) => {
|
|
397
|
-
const isHasValue = !!item?.value;
|
|
398
|
-
return (
|
|
399
|
-
<View style={styles.wrapItem} key={item?.id}>
|
|
400
|
-
<TitleCheckBox
|
|
401
|
-
onPress={onChecked}
|
|
402
|
-
id={item?.id}
|
|
403
|
-
title={item?.name}
|
|
404
|
-
titleStyle={styles.titleStyle}
|
|
405
|
-
wrapStyle={styles.wrapStyleCheckBox}
|
|
406
|
-
isChecked={checkedItem?.id === item?.id}
|
|
407
|
-
/>
|
|
408
|
-
<TouchableOpacity
|
|
409
|
-
onPress={onPressItem(item)}
|
|
410
|
-
style={[styles.wrapCondition, styles.shadowView]}
|
|
411
|
-
>
|
|
412
|
-
<Text type="Body" color={Colors.Gray7}>
|
|
413
|
-
{t('condition')}
|
|
414
|
-
</Text>
|
|
415
|
-
<Text
|
|
416
|
-
numberOfLines={1}
|
|
417
|
-
type="H4"
|
|
418
|
-
semibold={isHasValue}
|
|
419
|
-
style={styles.description}
|
|
420
|
-
>
|
|
421
|
-
{isHasValue
|
|
422
|
-
? RenderCondition(item)
|
|
423
|
-
: `${t('no')} ${t('condition')}`}
|
|
424
|
-
</Text>
|
|
425
|
-
{isHasValue && (
|
|
426
|
-
<Image
|
|
427
|
-
source={Images.arrowBack}
|
|
428
|
-
style={styles.arrowRight}
|
|
429
|
-
/>
|
|
430
|
-
)}
|
|
431
|
-
</TouchableOpacity>
|
|
432
|
-
</View>
|
|
433
|
-
);
|
|
434
|
-
})
|
|
435
|
-
)
|
|
436
|
-
) : (
|
|
437
|
-
<View>
|
|
438
|
-
<RenderActionItem
|
|
439
|
-
data={data}
|
|
440
|
-
device={device}
|
|
441
|
-
onSelectAction={handleOnSelectAction}
|
|
442
|
-
accessibilityLabel={AccessibilityLabel.ACTION_ITEM}
|
|
443
|
-
/>
|
|
444
|
-
{/* TODO: Nhat - refactor/combine with value_change case */}
|
|
445
|
-
{!!sensorData &&
|
|
446
|
-
sensorData.map((item) => {
|
|
447
|
-
const isHasValue = !!item?.value;
|
|
448
|
-
return (
|
|
449
|
-
<View style={styles.wrapItem} key={item?.id}>
|
|
450
|
-
<TitleCheckBox
|
|
451
|
-
onPress={onChecked}
|
|
452
|
-
id={item?.id}
|
|
453
|
-
title={item?.name}
|
|
454
|
-
titleStyle={styles.titleStyle}
|
|
455
|
-
wrapStyle={styles.wrapStyleCheckBox}
|
|
456
|
-
isChecked={checkedItem?.id === item?.id}
|
|
457
|
-
/>
|
|
458
|
-
<TouchableOpacity
|
|
459
|
-
onPress={onPressItem(item)}
|
|
460
|
-
style={[styles.wrapCondition, styles.shadowView]}
|
|
461
|
-
>
|
|
462
|
-
<Text type="Body" color={Colors.Gray7}>
|
|
463
|
-
{t('condition')}
|
|
464
|
-
</Text>
|
|
465
|
-
<Text
|
|
466
|
-
numberOfLines={1}
|
|
467
|
-
type="H4"
|
|
468
|
-
semibold={isHasValue}
|
|
469
|
-
style={styles.description}
|
|
470
|
-
>
|
|
471
|
-
{isHasValue
|
|
472
|
-
? RenderCondition(item)
|
|
473
|
-
: `${t('no')} ${t('condition')}`}
|
|
474
|
-
</Text>
|
|
475
|
-
{isHasValue && (
|
|
476
|
-
<Image
|
|
477
|
-
source={Images.arrowBack}
|
|
478
|
-
style={styles.arrowRight}
|
|
479
|
-
/>
|
|
480
|
-
)}
|
|
481
|
-
</TouchableOpacity>
|
|
482
|
-
</View>
|
|
483
|
-
);
|
|
484
|
-
})}
|
|
485
|
-
</View>
|
|
486
|
-
)}
|
|
487
|
-
{data?.length === 0 && sensorData?.length === 0 && !isfetched && (
|
|
488
|
-
<View style={styles.noneData}>
|
|
489
|
-
<Text center>
|
|
490
|
-
{t('you_do_not_have_the_device_or_have_share_control_device')}
|
|
491
|
-
</Text>
|
|
492
|
-
</View>
|
|
493
|
-
)}
|
|
494
|
-
</WrapHeaderScrollable>
|
|
495
|
-
{renderBottomButtonView}
|
|
496
|
-
</View>
|
|
497
|
-
);
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
const RenderActionItem = ({ device, data, onSelectAction }) => {
|
|
501
|
-
const actionTemplate = [];
|
|
502
|
-
const optionsDropdownActionTemplates = [];
|
|
503
|
-
const numberUpDownActionTemplates = [];
|
|
504
|
-
const statesGridActionTemplates = [];
|
|
505
|
-
|
|
506
|
-
data?.forEach((item) => {
|
|
507
|
-
switch (item.template) {
|
|
508
|
-
case 'on_off_button_action_template':
|
|
509
|
-
case 'one_button_action_template':
|
|
510
|
-
case 'three_button_action_template':
|
|
511
|
-
case 'OnOffSimpleActionTemplate':
|
|
512
|
-
case 'curtain_action_template':
|
|
513
|
-
case 'OnOffSmartLockActionTemplate':
|
|
514
|
-
actionTemplate.push(item);
|
|
515
|
-
break;
|
|
516
|
-
case 'OptionsDropdownActionTemplate':
|
|
517
|
-
optionsDropdownActionTemplates.push(item);
|
|
518
|
-
break;
|
|
519
|
-
case 'NumberUpDownActionTemplate':
|
|
520
|
-
numberUpDownActionTemplates.push(item);
|
|
521
|
-
break;
|
|
522
|
-
case 'StatesGridActionTemplate':
|
|
523
|
-
statesGridActionTemplates.push(item);
|
|
524
|
-
break;
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
|
|
528
|
-
const handleOnSelectAction = (action) => {
|
|
529
|
-
onSelectAction && onSelectAction(action);
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
return (
|
|
533
|
-
<>
|
|
534
|
-
{actionTemplate.length > 0 && (
|
|
535
|
-
<ActionTemplate
|
|
536
|
-
device={device}
|
|
537
|
-
data={actionTemplate}
|
|
538
|
-
onSelectAction={handleOnSelectAction}
|
|
539
|
-
/>
|
|
540
|
-
)}
|
|
541
|
-
{numberUpDownActionTemplates.map((item) => (
|
|
542
|
-
<NumberUpDownActionTemplate
|
|
543
|
-
key={item.id}
|
|
544
|
-
device={device}
|
|
545
|
-
data={item}
|
|
546
|
-
onSelectAction={handleOnSelectAction}
|
|
547
|
-
/>
|
|
548
|
-
))}
|
|
549
|
-
|
|
550
|
-
{optionsDropdownActionTemplates.map((item) => (
|
|
551
|
-
<OptionsDropdownActionTemplate
|
|
552
|
-
key={item.id}
|
|
553
|
-
device={device}
|
|
554
|
-
data={item}
|
|
555
|
-
onSelectAction={handleOnSelectAction}
|
|
556
|
-
/>
|
|
557
|
-
))}
|
|
558
|
-
{statesGridActionTemplates.map((item) => (
|
|
559
|
-
<StatesGridActionTemplate
|
|
560
|
-
key={item.id}
|
|
561
|
-
device={device}
|
|
562
|
-
data={item}
|
|
563
|
-
onSelectAction={handleOnSelectAction}
|
|
564
|
-
/>
|
|
565
|
-
))}
|
|
566
|
-
</>
|
|
567
|
-
);
|
|
568
|
-
};
|
|
569
|
-
|
|
570
|
-
export default SelectAction;
|