@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,114 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TouchableOpacity } from 'react-native';
|
|
3
|
-
import { act, create } from 'react-test-renderer';
|
|
4
|
-
import { HorizontalPicker } from '../../../commons';
|
|
5
|
-
import { SCProvider } from '../../../context';
|
|
6
|
-
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
-
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
8
|
-
import SetUpSensor from '../SetupSensor';
|
|
9
|
-
import { useRoute } from '@react-navigation/native';
|
|
10
|
-
|
|
11
|
-
const mockSetSensorData = jest.fn();
|
|
12
|
-
const mockDispatch = jest.fn();
|
|
13
|
-
const mockGoBack = jest.fn();
|
|
14
|
-
|
|
15
|
-
jest.mock('react', () => {
|
|
16
|
-
return {
|
|
17
|
-
...jest.requireActual('react'),
|
|
18
|
-
memo: (x) => x,
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
jest.mock('@react-navigation/native', () => {
|
|
23
|
-
return {
|
|
24
|
-
...jest.requireActual('@react-navigation/native'),
|
|
25
|
-
useRoute: jest.fn(),
|
|
26
|
-
useNavigation: () => ({
|
|
27
|
-
goBack: mockGoBack,
|
|
28
|
-
dispatch: mockDispatch,
|
|
29
|
-
}),
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const wrapComponent = (configuration, onPress) => (
|
|
34
|
-
<SCProvider initState={mockSCStore({})}>
|
|
35
|
-
<SetUpSensor />
|
|
36
|
-
</SCProvider>
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
describe('Test SetUpSensor', () => {
|
|
40
|
-
let tree;
|
|
41
|
-
beforeEach(() => {
|
|
42
|
-
useRoute.mockClear();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('Test render', async () => {
|
|
46
|
-
useRoute.mockReturnValue({
|
|
47
|
-
params: {
|
|
48
|
-
item: {
|
|
49
|
-
id: 1,
|
|
50
|
-
value: 10,
|
|
51
|
-
range_min: 0,
|
|
52
|
-
range_max: 100,
|
|
53
|
-
decimal_behind: 2,
|
|
54
|
-
title: 'is below (<)',
|
|
55
|
-
sensor_type: 'air_quality',
|
|
56
|
-
},
|
|
57
|
-
sensorData: [],
|
|
58
|
-
setSensorData: () => mockSetSensorData,
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
await act(async () => {
|
|
62
|
-
tree = await create(wrapComponent());
|
|
63
|
-
});
|
|
64
|
-
const instance = tree.root;
|
|
65
|
-
|
|
66
|
-
await act(async () => {
|
|
67
|
-
instance.findAllByType(TouchableOpacity)[0].props.onPress();
|
|
68
|
-
instance.findAllByType(TouchableOpacity)[1].props.onPress();
|
|
69
|
-
instance.findAllByType(TouchableOpacity)[2].props.onPress();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
73
|
-
expect(mockDispatch).toBeCalled();
|
|
74
|
-
|
|
75
|
-
await act(async () => {
|
|
76
|
-
touchableOpacities[4].props.onPress();
|
|
77
|
-
});
|
|
78
|
-
const HorizontalPickers = instance.findAllByType(HorizontalPicker);
|
|
79
|
-
expect(HorizontalPickers).toHaveLength(1);
|
|
80
|
-
await act(async () => {
|
|
81
|
-
HorizontalPickers[0].props.onChangeValue(128);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const BottomButtonViews = instance.findAllByType(BottomButtonView);
|
|
85
|
-
expect(BottomButtonViews).toHaveLength(1);
|
|
86
|
-
await act(async () => {
|
|
87
|
-
BottomButtonViews[0].props.onPressMain();
|
|
88
|
-
});
|
|
89
|
-
expect(mockGoBack).toBeCalled();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('Test change value and item', async () => {
|
|
93
|
-
useRoute.mockReturnValue({
|
|
94
|
-
params: {
|
|
95
|
-
item: {
|
|
96
|
-
id: 1,
|
|
97
|
-
value: 10,
|
|
98
|
-
range_min: 0,
|
|
99
|
-
decimal_behind: 2,
|
|
100
|
-
title: 'is below (<)',
|
|
101
|
-
sensor_type: 'air_quality',
|
|
102
|
-
},
|
|
103
|
-
sensorData: [],
|
|
104
|
-
setSensorData: () => mockSetSensorData,
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
await act(async () => {
|
|
108
|
-
tree = await create(wrapComponent());
|
|
109
|
-
});
|
|
110
|
-
const instance = tree.root;
|
|
111
|
-
const HorizontalPickers = instance.findAllByType(HorizontalPicker);
|
|
112
|
-
expect(HorizontalPickers).toHaveLength(1);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import React, { memo, useCallback, useState } from 'react';
|
|
2
|
-
import { ScrollView, View } from 'react-native';
|
|
3
|
-
import { CommonActions, useNavigation } from '@react-navigation/native';
|
|
4
|
-
|
|
5
|
-
import { API, Colors } from '../../configs';
|
|
6
|
-
import { AccessibilityLabel } from '../../configs/Constants';
|
|
7
|
-
import _TextInput from '../../commons/Form/TextInput';
|
|
8
|
-
import styles from './AddNewOneTapStyles';
|
|
9
|
-
import { HeaderCustom } from '../../commons/Header';
|
|
10
|
-
import BottomButtonView from '../../commons/BottomButtonView';
|
|
11
|
-
import Text from '../../commons/Text';
|
|
12
|
-
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
13
|
-
import { axiosPost, axiosPut } from '../../utils/Apis/axios';
|
|
14
|
-
import Routes from '../../utils/Route';
|
|
15
|
-
import { popAction } from '../../navigations/utils';
|
|
16
|
-
import { AUTOMATE_TYPE } from '../../configs/Constants';
|
|
17
|
-
|
|
18
|
-
const AddNewOneTap = memo(({ route }) => {
|
|
19
|
-
const {
|
|
20
|
-
type,
|
|
21
|
-
unit,
|
|
22
|
-
automateData = {},
|
|
23
|
-
automate = {},
|
|
24
|
-
isAutomateTab,
|
|
25
|
-
isMultiUnits,
|
|
26
|
-
automateId,
|
|
27
|
-
scriptName,
|
|
28
|
-
oldType,
|
|
29
|
-
} = route?.params || {};
|
|
30
|
-
const t = useTranslations();
|
|
31
|
-
const { navigate, dispatch, goBack } = useNavigation();
|
|
32
|
-
const [name, setName] = useState(scriptName ? scriptName : '');
|
|
33
|
-
|
|
34
|
-
const handleContinue = useCallback(async () => {
|
|
35
|
-
const params = {
|
|
36
|
-
unit: isMultiUnits ? null : unit.id,
|
|
37
|
-
type: type,
|
|
38
|
-
name: name,
|
|
39
|
-
...automateData,
|
|
40
|
-
};
|
|
41
|
-
const { success, data } = automateId
|
|
42
|
-
? await axiosPut(API.AUTOMATE.UPDATE_AUTOMATE(automateId), params)
|
|
43
|
-
: await axiosPost(API.AUTOMATE.CREATE_AUTOMATE(), params);
|
|
44
|
-
if (success) {
|
|
45
|
-
navigate(Routes.ScriptDetail, {
|
|
46
|
-
unit: unit,
|
|
47
|
-
id: data.id,
|
|
48
|
-
name: name,
|
|
49
|
-
type: type,
|
|
50
|
-
automate: { ...automate, ...data },
|
|
51
|
-
havePermission: true,
|
|
52
|
-
isCreateScriptSuccess: true,
|
|
53
|
-
isAutomateTab: isAutomateTab,
|
|
54
|
-
isMultiUnits,
|
|
55
|
-
});
|
|
56
|
-
dispatch((state) => {
|
|
57
|
-
const routes = state.routes.filter(
|
|
58
|
-
(r) =>
|
|
59
|
-
r.name !== Routes.AddNewOneTap &&
|
|
60
|
-
r.name !== Routes.AddNewAutoSmart &&
|
|
61
|
-
r.name !== Routes.SelectUnit &&
|
|
62
|
-
r.name !== Routes.SelectSensorDevices &&
|
|
63
|
-
r.name !== Routes.SetSchedule &&
|
|
64
|
-
r.name !== Routes.SelectAction
|
|
65
|
-
);
|
|
66
|
-
return CommonActions.reset({
|
|
67
|
-
...state,
|
|
68
|
-
routes,
|
|
69
|
-
index: routes.length - 1,
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}, [
|
|
74
|
-
isMultiUnits,
|
|
75
|
-
unit,
|
|
76
|
-
type,
|
|
77
|
-
name,
|
|
78
|
-
automateData,
|
|
79
|
-
automateId,
|
|
80
|
-
navigate,
|
|
81
|
-
automate,
|
|
82
|
-
isAutomateTab,
|
|
83
|
-
dispatch,
|
|
84
|
-
]);
|
|
85
|
-
|
|
86
|
-
const onChangeName = useCallback((text) => {
|
|
87
|
-
setName(text);
|
|
88
|
-
}, []);
|
|
89
|
-
|
|
90
|
-
const onClose = useCallback(() => {
|
|
91
|
-
if (automateId) {
|
|
92
|
-
navigate(Routes.ScriptDetail, {
|
|
93
|
-
id: automateId,
|
|
94
|
-
name: scriptName,
|
|
95
|
-
type: oldType,
|
|
96
|
-
havePermission: true,
|
|
97
|
-
unit,
|
|
98
|
-
isMultiUnits,
|
|
99
|
-
isAutomateTab,
|
|
100
|
-
});
|
|
101
|
-
} else if (isAutomateTab) {
|
|
102
|
-
dispatch(popAction(5));
|
|
103
|
-
goBack();
|
|
104
|
-
} else {
|
|
105
|
-
goBack();
|
|
106
|
-
}
|
|
107
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
108
|
-
}, [isAutomateTab]);
|
|
109
|
-
|
|
110
|
-
const textForNewTap =
|
|
111
|
-
type === AUTOMATE_TYPE.ONE_TAP
|
|
112
|
-
? t('name_your_button')
|
|
113
|
-
: t('name_your_script');
|
|
114
|
-
|
|
115
|
-
return (
|
|
116
|
-
<View style={styles.wrap}>
|
|
117
|
-
<HeaderCustom isShowClose onClose={onClose} />
|
|
118
|
-
<ScrollView scrollIndicatorInsets={{ right: 1 }}>
|
|
119
|
-
<Text
|
|
120
|
-
accessibilityLabel={AccessibilityLabel.ADD_NEW_DEVICE_ADD}
|
|
121
|
-
semibold
|
|
122
|
-
size={20}
|
|
123
|
-
color={Colors.Gray9}
|
|
124
|
-
style={styles.textHeader}
|
|
125
|
-
>
|
|
126
|
-
{textForNewTap}
|
|
127
|
-
</Text>
|
|
128
|
-
<_TextInput
|
|
129
|
-
placeholder={textForNewTap}
|
|
130
|
-
wrapStyle={styles.noMarginTop}
|
|
131
|
-
onChange={onChangeName}
|
|
132
|
-
textInputStyle={styles.textInput}
|
|
133
|
-
value={name}
|
|
134
|
-
accessibilityLabel={AccessibilityLabel.NAME_YOUR_BUTTON}
|
|
135
|
-
/>
|
|
136
|
-
</ScrollView>
|
|
137
|
-
<BottomButtonView
|
|
138
|
-
style={styles.viewBottomFixed}
|
|
139
|
-
mainTitle={t('save')}
|
|
140
|
-
onPressMain={handleContinue}
|
|
141
|
-
typeMain={name !== '' ? 'primary' : 'disabled'}
|
|
142
|
-
/>
|
|
143
|
-
</View>
|
|
144
|
-
);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
export default AddNewOneTap;
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback } from 'react';
|
|
2
|
-
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
3
|
-
import { Colors } from '../../../configs';
|
|
4
|
-
import { AUTOMATE_TYPE } from '../../../configs/Constants';
|
|
5
|
-
import Routes from '../../../utils/Route';
|
|
6
|
-
import { useNavigation } from '@react-navigation/native';
|
|
7
|
-
|
|
8
|
-
const useStateAlertAction = () => {
|
|
9
|
-
const t = useTranslations();
|
|
10
|
-
const { navigate } = useNavigation();
|
|
11
|
-
const [stateAlertAction, setStateAlertAction] = useState({
|
|
12
|
-
visible: false,
|
|
13
|
-
title: '',
|
|
14
|
-
message: '',
|
|
15
|
-
leftButton: t('cancel'),
|
|
16
|
-
rightButton: '',
|
|
17
|
-
rightColor: Colors.Primary,
|
|
18
|
-
isDelete: true,
|
|
19
|
-
});
|
|
20
|
-
const hideAlertAction = useCallback(() => {
|
|
21
|
-
setStateAlertAction({ ...stateAlertAction, visible: false });
|
|
22
|
-
}, [stateAlertAction]);
|
|
23
|
-
|
|
24
|
-
const onShowRename = useCallback(
|
|
25
|
-
(havePermission) => () => {
|
|
26
|
-
const data = havePermission
|
|
27
|
-
? {
|
|
28
|
-
visible: true,
|
|
29
|
-
title: t('rename_automate'),
|
|
30
|
-
message: '',
|
|
31
|
-
leftButton: t('cancel'),
|
|
32
|
-
rightButton: t('rename'),
|
|
33
|
-
rightColor: Colors.Primary,
|
|
34
|
-
isDelete: false,
|
|
35
|
-
}
|
|
36
|
-
: {
|
|
37
|
-
visible: true,
|
|
38
|
-
title: t('rename_automate'),
|
|
39
|
-
message: t('you_do_not_have_permission_to', {
|
|
40
|
-
doAction: t('rename_automate').toLowerCase(),
|
|
41
|
-
}),
|
|
42
|
-
leftButton: t('ok'),
|
|
43
|
-
rightButton: null,
|
|
44
|
-
isDelete: false,
|
|
45
|
-
};
|
|
46
|
-
setStateAlertAction((action) => {
|
|
47
|
-
return {
|
|
48
|
-
...action,
|
|
49
|
-
...data,
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
[t]
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const onShowActivityLog = useCallback(
|
|
57
|
-
(havePermission, id, type, unit) => () => {
|
|
58
|
-
if (havePermission) {
|
|
59
|
-
navigate(Routes.ActivityLog, {
|
|
60
|
-
id: id,
|
|
61
|
-
type:
|
|
62
|
-
type === AUTOMATE_TYPE.ONE_TAP
|
|
63
|
-
? `automate.${AUTOMATE_TYPE.ONE_TAP}`
|
|
64
|
-
: 'automate',
|
|
65
|
-
share: unit,
|
|
66
|
-
filterEnabled: {
|
|
67
|
-
date: true,
|
|
68
|
-
user: Boolean(unit.id),
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
} else {
|
|
72
|
-
setStateAlertAction((action) => {
|
|
73
|
-
return {
|
|
74
|
-
...action,
|
|
75
|
-
visible: true,
|
|
76
|
-
title: t('activity_log'),
|
|
77
|
-
message: t('you_do_not_have_permission_to_access', {
|
|
78
|
-
doAction: t('activity_log').toLowerCase(),
|
|
79
|
-
}),
|
|
80
|
-
leftButton: t('ok'),
|
|
81
|
-
rightButton: null,
|
|
82
|
-
isDelete: true,
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
[navigate, t]
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
const onShowDelete = useCallback(
|
|
91
|
-
(scriptName, havePermission) => () => {
|
|
92
|
-
const data = havePermission
|
|
93
|
-
? {
|
|
94
|
-
visible: true,
|
|
95
|
-
title: t('title_delete_script', {
|
|
96
|
-
scriptName: scriptName,
|
|
97
|
-
}),
|
|
98
|
-
message: t('message_delete_script', {
|
|
99
|
-
scriptName: scriptName,
|
|
100
|
-
}),
|
|
101
|
-
leftButton: t('cancel'),
|
|
102
|
-
rightButton: t('remove'),
|
|
103
|
-
rightColor: Colors.Gray6,
|
|
104
|
-
isDelete: true,
|
|
105
|
-
}
|
|
106
|
-
: {
|
|
107
|
-
visible: true,
|
|
108
|
-
title: t('title_delete_script', {
|
|
109
|
-
scriptName: scriptName,
|
|
110
|
-
}),
|
|
111
|
-
message: t('you_do_not_have_permission_to', {
|
|
112
|
-
doAction: t('delete_script').toLowerCase(),
|
|
113
|
-
}),
|
|
114
|
-
leftButton: t('ok'),
|
|
115
|
-
rightButton: null,
|
|
116
|
-
isDelete: true,
|
|
117
|
-
};
|
|
118
|
-
setStateAlertAction((action) => {
|
|
119
|
-
return {
|
|
120
|
-
...action,
|
|
121
|
-
...data,
|
|
122
|
-
};
|
|
123
|
-
});
|
|
124
|
-
},
|
|
125
|
-
[t]
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
return [
|
|
129
|
-
stateAlertAction,
|
|
130
|
-
hideAlertAction,
|
|
131
|
-
onShowRename,
|
|
132
|
-
onShowActivityLog,
|
|
133
|
-
onShowDelete,
|
|
134
|
-
];
|
|
135
|
-
};
|
|
136
|
-
export { useStateAlertAction };
|