@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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import { API, Colors } from '../../../../configs';
|
|
3
|
+
import _TextInput from '../../../../commons/Form/TextInput';
|
|
4
|
+
import styles from '../Styles/indexStyles';
|
|
5
|
+
import AlertAction from '../../../../commons/AlertAction';
|
|
6
|
+
import { axiosPatch } from '../../../../utils/Apis/axios';
|
|
7
|
+
import { ToastBottomHelper } from '../../../../utils/Utils';
|
|
8
|
+
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
9
|
+
import useKeyboardAnimated from '../../../../hooks/Explore/useKeyboardAnimated';
|
|
10
|
+
|
|
11
|
+
const RenameScript = ({ automate, setAutomate, isVisible, setIsVisible }) => {
|
|
12
|
+
const t = useTranslations();
|
|
13
|
+
const [inputName, setInputName] = useState(automate.name);
|
|
14
|
+
const transY = useKeyboardAnimated();
|
|
15
|
+
|
|
16
|
+
const renameScript = useCallback(async () => {
|
|
17
|
+
const { success, data: script } = await axiosPatch(
|
|
18
|
+
API.AUTOMATE.SCRIPT(automate.id),
|
|
19
|
+
{
|
|
20
|
+
name: inputName,
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
if (success) {
|
|
24
|
+
setAutomate((prev) => ({ ...prev, name: script.name }));
|
|
25
|
+
ToastBottomHelper.success(t('rename_successfully'));
|
|
26
|
+
} else {
|
|
27
|
+
ToastBottomHelper.error(t('rename_failed'));
|
|
28
|
+
}
|
|
29
|
+
setIsVisible(false);
|
|
30
|
+
}, [automate.id, inputName, setAutomate, setIsVisible, t]);
|
|
31
|
+
|
|
32
|
+
const hidePopup = () => setIsVisible(false);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<AlertAction
|
|
36
|
+
visible={isVisible}
|
|
37
|
+
hideModal={hidePopup}
|
|
38
|
+
title={t('rename_automate')}
|
|
39
|
+
message=""
|
|
40
|
+
leftButtonTitle={t('cancel')}
|
|
41
|
+
leftButtonClick={hidePopup}
|
|
42
|
+
rightButtonTitle={t('rename')}
|
|
43
|
+
rightButtonClick={renameScript}
|
|
44
|
+
rightButtonStyle={{ color: Colors.Primary }}
|
|
45
|
+
transY={transY}
|
|
46
|
+
>
|
|
47
|
+
<_TextInput
|
|
48
|
+
onChange={setInputName}
|
|
49
|
+
value={inputName}
|
|
50
|
+
defaultValue={automate?.name}
|
|
51
|
+
textInputStyle={styles.textInput}
|
|
52
|
+
maxLength={64}
|
|
53
|
+
/>
|
|
54
|
+
</AlertAction>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default RenameScript;
|
|
@@ -3,23 +3,24 @@ import { create, act } from 'react-test-renderer';
|
|
|
3
3
|
import Toast from 'react-native-toast-message';
|
|
4
4
|
|
|
5
5
|
import MockAdapter from 'axios-mock-adapter';
|
|
6
|
-
import { SCProvider } from '
|
|
7
|
-
import { mockSCStore } from '
|
|
8
|
-
import ScriptDetail from '
|
|
9
|
-
import MenuActionMore from '
|
|
10
|
-
import AlertAction from '
|
|
11
|
-
import _TextInput from '
|
|
6
|
+
import { SCProvider } from '../../../../context';
|
|
7
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
8
|
+
import ScriptDetail from '../index';
|
|
9
|
+
import MenuActionMore from '../../../../commons/MenuActionMore';
|
|
10
|
+
import AlertAction from '../../../../commons/AlertAction';
|
|
11
|
+
import _TextInput from '../../../../commons/Form/TextInput';
|
|
12
12
|
import {
|
|
13
|
-
AUTOMATE_SELECT,
|
|
14
13
|
AUTOMATE_TYPE,
|
|
15
14
|
AccessibilityLabel,
|
|
16
|
-
} from '
|
|
17
|
-
import { API } from '
|
|
15
|
+
} from '../../../../configs/Constants';
|
|
16
|
+
import { API } from '../../../../configs';
|
|
18
17
|
import { TouchableOpacity } from 'react-native';
|
|
19
|
-
import Routes from '
|
|
20
|
-
import WrapHeaderScrollable from '
|
|
21
|
-
import ItemAutomate from '
|
|
22
|
-
import api from '
|
|
18
|
+
import Routes from '../../../../utils/Route';
|
|
19
|
+
import WrapHeaderScrollable from '../../../../commons/Sharing/WrapHeaderScrollable';
|
|
20
|
+
import ItemAutomate from '../../../../commons/Automate/ItemAutomate';
|
|
21
|
+
import api from '../../../../utils/Apis/axios';
|
|
22
|
+
import Text from '../../../../commons/Text';
|
|
23
|
+
import { useNavigation } from '@react-navigation/native';
|
|
23
24
|
|
|
24
25
|
const wrapComponent = (route) => (
|
|
25
26
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -27,18 +28,6 @@ const wrapComponent = (route) => (
|
|
|
27
28
|
</SCProvider>
|
|
28
29
|
);
|
|
29
30
|
|
|
30
|
-
const mockGoBack = jest.fn();
|
|
31
|
-
const mockNavigate = jest.fn();
|
|
32
|
-
jest.mock('@react-navigation/native', () => {
|
|
33
|
-
return {
|
|
34
|
-
...jest.requireActual('@react-navigation/native'),
|
|
35
|
-
useNavigation: () => ({
|
|
36
|
-
goBack: mockGoBack,
|
|
37
|
-
navigate: mockNavigate,
|
|
38
|
-
}),
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
|
|
42
31
|
const mock = new MockAdapter(api.axiosInstance);
|
|
43
32
|
|
|
44
33
|
describe('Test ScriptDetail', () => {
|
|
@@ -46,18 +35,19 @@ describe('Test ScriptDetail', () => {
|
|
|
46
35
|
let data;
|
|
47
36
|
let tree;
|
|
48
37
|
|
|
38
|
+
const mockGoBack = useNavigation().goBack;
|
|
39
|
+
const mockNavigate = useNavigation().navigate;
|
|
49
40
|
beforeEach(() => {
|
|
50
41
|
mockGoBack.mockClear();
|
|
42
|
+
mockNavigate.mockClear();
|
|
43
|
+
mock.reset();
|
|
51
44
|
route = {
|
|
52
45
|
params: {
|
|
53
46
|
id: 1,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
type: AUTOMATE_TYPE.ONE_TAP,
|
|
57
|
-
havePermission: true,
|
|
58
|
-
automate: {
|
|
47
|
+
preAutomate: {
|
|
48
|
+
unit: 2,
|
|
59
49
|
author: 'Le Minh Tam',
|
|
60
|
-
id:
|
|
50
|
+
id: 1,
|
|
61
51
|
type: 'value_change',
|
|
62
52
|
value_change: {
|
|
63
53
|
condition: '<',
|
|
@@ -67,9 +57,6 @@ describe('Test ScriptDetail', () => {
|
|
|
67
57
|
sensor_id: 73,
|
|
68
58
|
value: 35,
|
|
69
59
|
},
|
|
70
|
-
script: {
|
|
71
|
-
id: 1,
|
|
72
|
-
},
|
|
73
60
|
},
|
|
74
61
|
},
|
|
75
62
|
};
|
|
@@ -93,7 +80,7 @@ describe('Test ScriptDetail', () => {
|
|
|
93
80
|
});
|
|
94
81
|
const instance = tree.root;
|
|
95
82
|
const menu = instance.findByType(MenuActionMore);
|
|
96
|
-
const alertAction = instance.
|
|
83
|
+
const alertAction = instance.findAllByType(AlertAction)[0];
|
|
97
84
|
const rename = menu.props.listMenuItem[0];
|
|
98
85
|
|
|
99
86
|
await act(async () => {
|
|
@@ -119,7 +106,7 @@ describe('Test ScriptDetail', () => {
|
|
|
119
106
|
});
|
|
120
107
|
const instance = tree.root;
|
|
121
108
|
const menu = instance.findByType(MenuActionMore);
|
|
122
|
-
const alertAction = instance.
|
|
109
|
+
const alertAction = instance.findAllByType(AlertAction)[0];
|
|
123
110
|
const rename = menu.props.listMenuItem[0];
|
|
124
111
|
|
|
125
112
|
await act(async () => {
|
|
@@ -128,7 +115,7 @@ describe('Test ScriptDetail', () => {
|
|
|
128
115
|
expect(menu.props.isVisible).toBeFalsy();
|
|
129
116
|
expect(alertAction.props.visible).toBeTruthy();
|
|
130
117
|
|
|
131
|
-
mock.onPatch(API.AUTOMATE.SCRIPT(1)).reply(500
|
|
118
|
+
mock.onPatch(API.AUTOMATE.SCRIPT(1)).reply(500);
|
|
132
119
|
await act(async () => {
|
|
133
120
|
await alertAction.props.rightButtonClick();
|
|
134
121
|
});
|
|
@@ -142,8 +129,8 @@ describe('Test ScriptDetail', () => {
|
|
|
142
129
|
});
|
|
143
130
|
const instance = tree.root;
|
|
144
131
|
const menu = instance.findByType(MenuActionMore);
|
|
145
|
-
const alertAction = instance.
|
|
146
|
-
const deleteItem = menu.props.listMenuItem[
|
|
132
|
+
const alertAction = instance.findAllByType(AlertAction)[1];
|
|
133
|
+
const deleteItem = menu.props.listMenuItem[2];
|
|
147
134
|
|
|
148
135
|
await act(async () => {
|
|
149
136
|
await menu.props.onItemClick(deleteItem);
|
|
@@ -191,6 +178,8 @@ describe('Test ScriptDetail', () => {
|
|
|
191
178
|
|
|
192
179
|
it('test activate one tap', async () => {
|
|
193
180
|
mock.onGet(API.AUTOMATE.SCRIPT(1)).reply(200, data);
|
|
181
|
+
route.params.preAutomate.type = AUTOMATE_TYPE.ONE_TAP;
|
|
182
|
+
|
|
194
183
|
await act(async () => {
|
|
195
184
|
tree = await create(wrapComponent(route));
|
|
196
185
|
});
|
|
@@ -223,15 +212,9 @@ describe('Test ScriptDetail', () => {
|
|
|
223
212
|
await act(async () => {
|
|
224
213
|
await button.props.onPress();
|
|
225
214
|
});
|
|
226
|
-
expect(mockNavigate).toHaveBeenCalledWith(Routes.
|
|
227
|
-
|
|
228
|
-
automateId: route.params.id,
|
|
229
|
-
isCreateNewAction: true,
|
|
230
|
-
scriptName: route.params.name,
|
|
231
|
-
title: AUTOMATE_SELECT.SELECT_DEVICE,
|
|
232
|
-
type: AUTOMATE_TYPE.ONE_TAP,
|
|
233
|
-
oldType: AUTOMATE_TYPE.ONE_TAP,
|
|
234
|
-
automate: route.params.automate,
|
|
215
|
+
expect(mockNavigate).toHaveBeenCalledWith(Routes.SelectControlDevices, {
|
|
216
|
+
unitId: route.params.preAutomate.unit,
|
|
217
|
+
automateId: route.params.preAutomate.id,
|
|
235
218
|
});
|
|
236
219
|
});
|
|
237
220
|
|
|
@@ -246,21 +229,24 @@ describe('Test ScriptDetail', () => {
|
|
|
246
229
|
await act(async () => {
|
|
247
230
|
await WrapHeaderScrollables[0].props.onGoBack();
|
|
248
231
|
});
|
|
249
|
-
expect(
|
|
232
|
+
expect(mockGoBack).toBeCalled();
|
|
250
233
|
});
|
|
251
234
|
|
|
252
|
-
const _testGoToActivityLog = (
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
235
|
+
const _testGoToActivityLog = (
|
|
236
|
+
count,
|
|
237
|
+
automateType,
|
|
238
|
+
activityLogType,
|
|
239
|
+
unitId
|
|
240
|
+
) => {
|
|
241
|
+
it(`test go to activity log ${count}`, async () => {
|
|
242
|
+
route.params.preAutomate.type = automateType;
|
|
243
|
+
route.params.preAutomate.unit = unitId;
|
|
258
244
|
await act(async () => {
|
|
259
245
|
tree = await create(wrapComponent(route));
|
|
260
246
|
});
|
|
261
247
|
const instance = tree.root;
|
|
262
248
|
const menu = instance.findByType(MenuActionMore);
|
|
263
|
-
const gotoActivityLog = menu.props.listMenuItem[
|
|
249
|
+
const gotoActivityLog = menu.props.listMenuItem[1];
|
|
264
250
|
|
|
265
251
|
await act(async () => {
|
|
266
252
|
await menu.props.onItemClick(gotoActivityLog);
|
|
@@ -268,9 +254,9 @@ describe('Test ScriptDetail', () => {
|
|
|
268
254
|
expect(mockNavigate).toHaveBeenCalledWith(Routes.ActivityLog, {
|
|
269
255
|
id: route.params.id,
|
|
270
256
|
type: activityLogType,
|
|
271
|
-
share:
|
|
257
|
+
share: unitId,
|
|
272
258
|
filterEnabled: {
|
|
273
|
-
user:
|
|
259
|
+
user: !!unitId,
|
|
274
260
|
date: true,
|
|
275
261
|
},
|
|
276
262
|
});
|
|
@@ -278,18 +264,19 @@ describe('Test ScriptDetail', () => {
|
|
|
278
264
|
};
|
|
279
265
|
|
|
280
266
|
_testGoToActivityLog(
|
|
267
|
+
1,
|
|
281
268
|
AUTOMATE_TYPE.ONE_TAP,
|
|
282
269
|
`automate.${AUTOMATE_TYPE.ONE_TAP}`,
|
|
283
|
-
|
|
270
|
+
2
|
|
284
271
|
);
|
|
285
|
-
_testGoToActivityLog(AUTOMATE_TYPE.VALUE_CHANGE, 'automate',
|
|
286
|
-
_testGoToActivityLog(AUTOMATE_TYPE.VALUE_CHANGE, 'automate',
|
|
272
|
+
_testGoToActivityLog(2, AUTOMATE_TYPE.VALUE_CHANGE, 'automate', 2);
|
|
273
|
+
_testGoToActivityLog(3, AUTOMATE_TYPE.VALUE_CHANGE, 'automate', undefined);
|
|
287
274
|
|
|
288
275
|
it('Test render textCondition value change >', async () => {
|
|
289
276
|
route.params = {
|
|
290
277
|
...route.params,
|
|
291
|
-
|
|
292
|
-
|
|
278
|
+
preAutomate: {
|
|
279
|
+
type: AUTOMATE_TYPE.VALUE_CHANGE,
|
|
293
280
|
value_change: {
|
|
294
281
|
config_name: 'Light Value',
|
|
295
282
|
value: 3,
|
|
@@ -302,7 +289,7 @@ describe('Test ScriptDetail', () => {
|
|
|
302
289
|
});
|
|
303
290
|
const instance = tree.root;
|
|
304
291
|
const itemAutomate = instance.findByType(ItemAutomate);
|
|
305
|
-
expect(itemAutomate.props.
|
|
292
|
+
expect(itemAutomate.findAllByType(Text)[1].props.children).toEqual(
|
|
306
293
|
'Light Value higher than 3'
|
|
307
294
|
);
|
|
308
295
|
|
|
@@ -315,8 +302,8 @@ describe('Test ScriptDetail', () => {
|
|
|
315
302
|
it('Test render textCondition value change =', async () => {
|
|
316
303
|
route.params = {
|
|
317
304
|
...route.params,
|
|
318
|
-
|
|
319
|
-
|
|
305
|
+
preAutomate: {
|
|
306
|
+
type: AUTOMATE_TYPE.VALUE_CHANGE,
|
|
320
307
|
value_change: { config_name: 'Light Value', value: 3, condition: '=' },
|
|
321
308
|
},
|
|
322
309
|
};
|
|
@@ -325,14 +312,16 @@ describe('Test ScriptDetail', () => {
|
|
|
325
312
|
});
|
|
326
313
|
const instance = tree.root;
|
|
327
314
|
const itemAutomate = instance.findByType(ItemAutomate);
|
|
328
|
-
expect(itemAutomate.props.
|
|
315
|
+
expect(itemAutomate.findAllByType(Text)[1].props.children).toEqual(
|
|
316
|
+
'Light Value equal 3'
|
|
317
|
+
);
|
|
329
318
|
});
|
|
330
319
|
|
|
331
320
|
it('Test render textCondition value change <', async () => {
|
|
332
321
|
route.params = {
|
|
333
322
|
...route.params,
|
|
334
|
-
|
|
335
|
-
|
|
323
|
+
preAutomate: {
|
|
324
|
+
type: AUTOMATE_TYPE.VALUE_CHANGE,
|
|
336
325
|
value_change: {
|
|
337
326
|
config_name: 'Light Value',
|
|
338
327
|
value: 3,
|
|
@@ -345,7 +334,7 @@ describe('Test ScriptDetail', () => {
|
|
|
345
334
|
});
|
|
346
335
|
const instance = tree.root;
|
|
347
336
|
const itemAutomate = instance.findByType(ItemAutomate);
|
|
348
|
-
expect(itemAutomate.props.
|
|
337
|
+
expect(itemAutomate.findAllByType(Text)[1].props.children).toEqual(
|
|
349
338
|
'Light Value lower than 3'
|
|
350
339
|
);
|
|
351
340
|
});
|
|
@@ -353,8 +342,8 @@ describe('Test ScriptDetail', () => {
|
|
|
353
342
|
it('Test render textCondition schedule repeat everyday', async () => {
|
|
354
343
|
route.params = {
|
|
355
344
|
...route.params,
|
|
356
|
-
|
|
357
|
-
|
|
345
|
+
preAutomate: {
|
|
346
|
+
type: AUTOMATE_TYPE.SCHEDULE,
|
|
358
347
|
schedule: {
|
|
359
348
|
repeat: 'every_day',
|
|
360
349
|
date_repeat: '2022-01-02',
|
|
@@ -367,14 +356,16 @@ describe('Test ScriptDetail', () => {
|
|
|
367
356
|
});
|
|
368
357
|
const instance = tree.root;
|
|
369
358
|
const itemAutomate = instance.findByType(ItemAutomate);
|
|
370
|
-
expect(itemAutomate.props.
|
|
359
|
+
expect(itemAutomate.findAllByType(Text)[1].props.children).toEqual(
|
|
360
|
+
'Every day at 19:00'
|
|
361
|
+
);
|
|
371
362
|
});
|
|
372
363
|
|
|
373
364
|
it('Test render textCondition schedule repeat weekday', async () => {
|
|
374
365
|
route.params = {
|
|
375
366
|
...route.params,
|
|
376
|
-
|
|
377
|
-
|
|
367
|
+
preAutomate: {
|
|
368
|
+
type: AUTOMATE_TYPE.SCHEDULE,
|
|
378
369
|
schedule: {
|
|
379
370
|
repeat: 'every_week',
|
|
380
371
|
date_repeat: '2022-01-02',
|
|
@@ -388,7 +379,7 @@ describe('Test ScriptDetail', () => {
|
|
|
388
379
|
});
|
|
389
380
|
const instance = tree.root;
|
|
390
381
|
const itemAutomate = instance.findByType(ItemAutomate);
|
|
391
|
-
expect(itemAutomate.props.
|
|
382
|
+
expect(itemAutomate.findAllByType(Text)[1].props.children).toEqual(
|
|
392
383
|
'Mon, Tue, Thu, Sat at 19:00'
|
|
393
384
|
);
|
|
394
385
|
});
|
package/src/screens/{ScriptDetail → Automate/ScriptDetail}/__test__/useStarredScript.test.js
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { act, renderHook } from '@testing-library/react-hooks';
|
|
3
|
-
import { SCProvider } from '
|
|
4
|
-
import { mockSCStore } from '
|
|
3
|
+
import { SCProvider } from '../../../../context';
|
|
4
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
5
5
|
import { useStarredScript } from '../hooks/useStarredScript';
|
|
6
6
|
import MockAdapter from 'axios-mock-adapter';
|
|
7
|
-
import api from '
|
|
8
|
-
import { API } from '
|
|
9
|
-
import { Action } from '
|
|
7
|
+
import api from '../../../../utils/Apis/axios';
|
|
8
|
+
import { API } from '../../../../configs';
|
|
9
|
+
import { Action } from '../../../../context/actionType';
|
|
10
10
|
|
|
11
11
|
const mockedSetAction = jest.fn();
|
|
12
12
|
const mock = new MockAdapter(api.axiosInstance);
|
|
@@ -22,8 +22,9 @@ React.useContext = mockUseContext;
|
|
|
22
22
|
|
|
23
23
|
jest.mock('react-native-deep-linking');
|
|
24
24
|
|
|
25
|
-
describe('Test useStarredScript',
|
|
25
|
+
describe('Test useStarredScript', () => {
|
|
26
26
|
let props;
|
|
27
|
+
|
|
27
28
|
beforeEach(() => {
|
|
28
29
|
mockedSetAction.mockClear();
|
|
29
30
|
props = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useCallback, useContext } from 'react';
|
|
2
|
-
import { SCContext, useSCContextSelector } from '
|
|
3
|
-
import { Action } from '
|
|
4
|
-
import { axiosPost } from '
|
|
5
|
-
import { API } from '
|
|
2
|
+
import { SCContext, useSCContextSelector } from '../../../../context';
|
|
3
|
+
import { Action } from '../../../../context/actionType';
|
|
4
|
+
import { axiosPost } from '../../../../utils/Apis/axios';
|
|
5
|
+
import { API } from '../../../../configs';
|
|
6
6
|
|
|
7
7
|
export const useStarredScript = (automate) => {
|
|
8
8
|
const { setAction } = useContext(SCContext);
|