@eohjsc/react-native-smart-city 0.3.91 → 0.3.93
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 +5 -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__/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 +3 -3
- package/src/commons/ActionTemplate/CurtainActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OnOffButtonAction.js +2 -2
- package/src/commons/ActionTemplate/OnOffButtonActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OnOffSimpleAction.js +2 -2
- package/src/commons/ActionTemplate/OnOffSimpleActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OnOffSmartLockAction.js +2 -2
- package/src/commons/ActionTemplate/OnOffSmartLockActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OneButtonAction.js +1 -1
- package/src/commons/ActionTemplate/OneButtonActionStyles.js +1 -1
- package/src/commons/ActionTemplate/ThreeButtonAction.js +3 -3
- package/src/commons/ActionTemplate/ThreeButtonActionStyles.js +1 -1
- package/src/commons/AlertAction/index.js +5 -0
- package/src/commons/Auth/AccountList.js +1 -1
- package/src/commons/Auth/__test__/OtpInputList.test.js +13 -17
- package/src/commons/Automate/ItemAutomate.js +10 -4
- package/src/commons/Automate/__test__/ItemAutomate.test.js +11 -11
- package/src/commons/BottomButtonView/index.js +22 -4
- package/src/commons/Button/index.js +5 -0
- package/src/commons/Device/ConnectedViewHeader.js +0 -1
- package/src/commons/Device/DeviceAlertStatus.js +2 -1
- package/src/commons/Device/Emergency/EmergencyDetail.js +4 -2
- package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +4 -2
- package/src/commons/Device/ProgressBar/index.js +7 -11
- package/src/commons/Device/ProgressBar/styles.js +9 -4
- package/src/commons/Device/WindSpeed/Anemometer/index.js +3 -1
- package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +14 -1
- package/src/commons/Device/WindSpeed/LinearChart/index.js +4 -2
- 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__/TextInput.test.js +1 -1
- package/src/commons/Header/HeaderCustom.js +10 -19
- package/src/commons/HorizontalPicker/index.js +65 -38
- package/src/commons/IconComponent/index.js +3 -2
- 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 +1 -1
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplateStyles.js +1 -1
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +1 -1
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplateStyles.js +1 -1
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +1 -1
- package/src/commons/OneTapTemplate/StatesGridActionTemplateStyles.js +1 -1
- package/src/commons/PreventAccess/index.js +1 -1
- package/src/commons/Sharing/StationDevicePermissions.js +4 -4
- package/src/commons/Sharing/WrapHeaderScrollable.js +5 -5
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +2 -2
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +12 -59
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +16 -20
- package/src/commons/SubUnit/OneTap/index.js +20 -7
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +4 -0
- package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +1 -1
- package/src/commons/ViewButtonBottom/index.js +32 -4
- package/src/configs/API.js +9 -0
- package/src/configs/AccessibilityLabel.js +2 -0
- package/src/configs/BLE.js +1 -0
- package/src/configs/Colors.js +1 -1
- package/src/configs/Constants.js +12 -18
- package/src/context/actionType.ts +2 -1
- package/src/context/mockStore.ts +1 -0
- package/src/context/reducer.ts +12 -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/Explore/useKeyboardAnimated.js +10 -4
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +11 -0
- package/src/hooks/IoT/useBluetoothConnection.js +20 -29
- package/src/hooks/index.js +1 -2
- package/src/hooks/useMqtt.js +95 -0
- package/src/iot/Monitor.js +2 -1
- package/src/iot/RemoteControl/Bluetooth.js +56 -19
- package/src/iot/RemoteControl/__test__/Bluetooth.test.js +140 -0
- package/src/iot/mqtt.js +233 -0
- package/src/navigations/UnitStack.js +44 -12
- package/src/screens/AddLocationMaps/index.js +18 -16
- package/src/screens/AddLocationMaps/indexStyle.js +3 -0
- package/src/screens/AddNewGateway/SelectDeviceSubUnit.js +1 -2
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +5 -17
- package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +5 -13
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +9 -11
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -14
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -14
- package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +3 -2
- package/src/screens/AddNewGateway/index.js +1 -1
- package/src/screens/AllCamera/index.js +2 -3
- 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/{AddNewAction → Automate/AddNewAction}/ChooseAction.js +78 -119
- package/src/screens/{AddNewAction → Automate/AddNewAction}/ChooseConfig.js +45 -73
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Components/LoadingSelectAction.js +1 -1
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Components/SelectDevices.js +3 -3
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/DeviceStyles.js +5 -1
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/__test__/index.test.js +3 -3
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/index.js +5 -4
- package/src/screens/{AddNewAction → Automate/AddNewAction}/NewActionWrapper.js +5 -7
- package/src/screens/{AddNewAction → Automate/AddNewAction}/SelectControlDevices.js +11 -49
- package/src/screens/{AddNewAction → Automate/AddNewAction}/SelectMonitorDevices.js +10 -42
- package/src/screens/{AddNewAction → Automate/AddNewAction}/SetupConfigCondition.js +52 -101
- 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 +4 -2
- package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/ChooseAction.test.js +10 -11
- package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/ChooseConfig.test.js +26 -27
- package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/SelectControlDevices.test.js +9 -9
- package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/SelectMonitorDevices.test.js +5 -5
- package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/SetupSensor.test.js +52 -16
- package/src/screens/Automate/AddNewAutoSmart/AddAutomationTypeSmart.js +25 -0
- package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +78 -0
- package/src/screens/Automate/AddNewAutoSmart/AddUnknownTypeSmart.js +29 -0
- package/src/screens/{AddNewAutoSmart → Automate/AddNewAutoSmart}/__test__/AddNewAutoSmart.test.js +18 -41
- package/src/screens/{AddNewAutoSmart → Automate/AddNewAutoSmart}/styles/AddNewAutoSmartStyles.js +1 -1
- package/src/screens/Automate/Components/InputName.js +64 -0
- package/src/screens/{AddNewOneTap/AddNewOneTapStyles.js → Automate/Components/InputNameStyles.js} +3 -3
- package/src/screens/{EditActionsList → Automate/EditActionsList}/Styles/indexStyles.js +5 -1
- package/src/screens/{EditActionsList → Automate/EditActionsList}/__tests__/index.test.js +17 -31
- package/src/screens/{EditActionsList → Automate/EditActionsList}/index.js +49 -51
- package/src/screens/Automate/MultiUnits.js +69 -67
- 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 +110 -74
- 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 +360 -0
- package/src/screens/{ScriptDetail → Automate/ScriptDetail}/utils.js +32 -31
- 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 +77 -121
- package/src/screens/Automate/__test__/index.test.js +3 -10
- package/src/screens/Automate/constants.js +0 -0
- package/src/screens/Automate/index.js +12 -23
- 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__/detail.test.js +203 -258
- package/src/screens/Device/__test__/mqttDetail.test.js +599 -0
- package/src/screens/Device/__test__/sensorDisplayItem.test.js +4 -0
- package/src/screens/Device/components/SensorDisplayItem.js +3 -8
- package/src/screens/Device/components/VisualChart.js +55 -8
- package/src/screens/Device/detail.js +78 -30
- package/src/screens/Device/hooks/__test__/useEmergencyButton.test.js +35 -13
- package/src/screens/Device/hooks/useDeviceWatchConfigControl.js +13 -3
- package/src/screens/Device/hooks/useEvaluateValue.js +20 -2
- package/src/screens/Device/styles.js +7 -0
- 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 +1 -1
- package/src/screens/PlayBackCamera/index.js +2 -3
- package/src/screens/SelectUnit/__test__/index.test.js +8 -13
- package/src/screens/SharedUnit/index.js +5 -4
- 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/__test__/SmartAccount.test.js +8 -4
- package/src/screens/SmartAccount/index.js +9 -9
- package/src/screens/SmartAccount/style.js +8 -7
- 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 +14 -20
- package/src/screens/Template/detail.js +1 -0
- package/src/screens/UVIndexGuide/index.js +2 -2
- package/src/screens/Unit/Detail.js +10 -24
- package/src/screens/Unit/SelectAddToFavorites.js +1 -1
- package/src/screens/Unit/Summaries.js +6 -17
- package/src/screens/Unit/__test__/ChooseLocation.test.js +8 -13
- package/src/screens/Unit/__test__/Detail.test.js +3 -1
- package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +1 -1
- package/src/screens/Unit/__test__/SmartAccount.test.js +8 -14
- package/src/screens/Unit/__test__/Summaries.test.js +2 -2
- package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +4 -0
- package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +6 -11
- package/src/screens/WaterQualityGuide/index.js +10 -5
- package/src/utils/FactoryGateway.js +525 -0
- package/src/utils/I18n/translations/en.json +28 -19
- package/src/utils/I18n/translations/vi.json +26 -20
- package/src/utils/Route/index.js +5 -1
- package/src/utils/Utils.js +40 -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 -46
- package/src/commons/Device/SensorConnectedStatus.js +0 -56
- package/src/commons/Device/__test__/SensorConnectedStatus.test.js +0 -29
- 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/AddNewAutoSmart/index.js +0 -149
- package/src/screens/AddNewOneTap/index.js +0 -156
- package/src/screens/ScriptDetail/hooks/index.js +0 -136
- package/src/screens/ScriptDetail/index.js +0 -446
- 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
package/src/screens/{AddNewAction → Automate/AddNewAction}/Components/LoadingSelectAction.js
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import ContentLoader, { Rect } from 'react-content-loader/native';
|
|
4
|
-
import { Constants } from '
|
|
4
|
+
import { Constants } from '../../../../configs';
|
|
5
5
|
|
|
6
6
|
const LoadingSelectAction = ({ style }) => (
|
|
7
7
|
<View style={style}>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { View } from 'react-native';
|
|
2
2
|
import styles from '../Styles/SelectSensorDevicesStyles';
|
|
3
|
-
import Text from '
|
|
4
|
-
import NavBar from '
|
|
3
|
+
import Text from '../../../../commons/Text';
|
|
4
|
+
import NavBar from '../../../../commons/NavBar';
|
|
5
5
|
import Device from '../Device';
|
|
6
6
|
import React, { useCallback, useState } from 'react';
|
|
7
|
-
import { useTranslations } from '
|
|
7
|
+
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
8
8
|
import NewActionWrapper from '../NewActionWrapper';
|
|
9
9
|
|
|
10
10
|
const SelectDevices = ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { Colors, Constants } from '
|
|
2
|
+
import { Colors, Constants } from '../../../../configs';
|
|
3
3
|
|
|
4
4
|
const marginItem = 12;
|
|
5
5
|
const marginHorizontal = 16;
|
|
@@ -40,4 +40,8 @@ export default StyleSheet.create({
|
|
|
40
40
|
height: 40,
|
|
41
41
|
resizeMode: 'contain',
|
|
42
42
|
},
|
|
43
|
+
antIconStyle: {
|
|
44
|
+
width: 40,
|
|
45
|
+
height: 40,
|
|
46
|
+
},
|
|
43
47
|
});
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
3
|
import { TouchableWithoutFeedback } from 'react-native';
|
|
4
4
|
|
|
5
|
-
import Device from '
|
|
6
|
-
import { SCProvider } from '
|
|
7
|
-
import { mockSCStore } from '
|
|
5
|
+
import Device from '../index';
|
|
6
|
+
import { SCProvider } from '../../../../../context';
|
|
7
|
+
import { mockSCStore } from '../../../../../context/mockStore';
|
|
8
8
|
|
|
9
9
|
const wrapComponent = (svgMain, sensor, title, isSelectDevice, onPress) => (
|
|
10
10
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import { TouchableWithoutFeedback, View } from 'react-native';
|
|
3
|
-
import { Colors } from '
|
|
4
|
-
import Text from '
|
|
5
|
-
import IconComponent from '
|
|
6
|
-
import { AccessibilityLabel } from '
|
|
3
|
+
import { Colors } from '../../../../configs';
|
|
4
|
+
import Text from '../../../../commons/Text';
|
|
5
|
+
import IconComponent from '../../../../commons/IconComponent';
|
|
6
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
7
7
|
import styles from './DeviceStyles';
|
|
8
8
|
|
|
9
9
|
const Device = memo(({ svgMain, sensor, title, isSelectDevice, onPress }) => {
|
|
@@ -23,6 +23,7 @@ const Device = memo(({ svgMain, sensor, title, isSelectDevice, onPress }) => {
|
|
|
23
23
|
<IconComponent
|
|
24
24
|
icon={sensor?.icon_kit || svgMain}
|
|
25
25
|
style={styles.iconSensor}
|
|
26
|
+
antIconStyle={styles.antIconStyle}
|
|
26
27
|
/>
|
|
27
28
|
</View>
|
|
28
29
|
<Text numberOfLines={1} semibold type="Body" color={Colors.Gray9}>
|
|
@@ -2,16 +2,14 @@ import React, { useCallback, useMemo } from 'react';
|
|
|
2
2
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import styles from './Styles/SelectActionStyles';
|
|
5
|
-
import
|
|
6
|
-
import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
|
|
5
|
+
import WrapHeaderScrollable from '../../../commons/Sharing/WrapHeaderScrollable';
|
|
7
6
|
import { Icon } from '@ant-design/react-native';
|
|
8
|
-
import { Colors } from '
|
|
7
|
+
import { Colors } from '../../../configs';
|
|
9
8
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
10
|
-
import BottomButtonView from '
|
|
11
|
-
import { AccessibilityLabel } from '
|
|
9
|
+
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
10
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
12
11
|
|
|
13
12
|
const NewActionWrapper = ({ name, children, canNext, onNext, nextTitle }) => {
|
|
14
|
-
const t = useTranslations();
|
|
15
13
|
const { navigate } = useNavigation();
|
|
16
14
|
const { params = {} } = useRoute();
|
|
17
15
|
const { closeScreen } = params;
|
|
@@ -36,7 +34,7 @@ const NewActionWrapper = ({ name, children, canNext, onNext, nextTitle }) => {
|
|
|
36
34
|
return (
|
|
37
35
|
<View style={styles.wrap}>
|
|
38
36
|
<WrapHeaderScrollable
|
|
39
|
-
title={
|
|
37
|
+
title={name}
|
|
40
38
|
headerAniStyle={styles.headerAniStyle}
|
|
41
39
|
rightComponent={rightComponent}
|
|
42
40
|
>
|
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { useNavigation } from '@react-navigation/native';
|
|
3
|
-
import { fetchWithCache } from '
|
|
4
|
-
import { API } from '
|
|
5
|
-
import Routes from '
|
|
3
|
+
import { fetchWithCache } from '../../../utils/Apis/axios';
|
|
4
|
+
import { API } from '../../../configs';
|
|
5
|
+
import Routes from '../../../utils/Route';
|
|
6
6
|
import SelectDevices from './Components/SelectDevices';
|
|
7
|
-
import { useTranslations } from '
|
|
7
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
8
8
|
|
|
9
9
|
const SelectControlDevices = ({ route }) => {
|
|
10
10
|
const t = useTranslations();
|
|
11
|
-
const {
|
|
12
|
-
unit,
|
|
13
|
-
automateId,
|
|
14
|
-
automate = {},
|
|
15
|
-
type,
|
|
16
|
-
scriptName,
|
|
17
|
-
isAutomateTab,
|
|
18
|
-
isCreateNewAction,
|
|
19
|
-
isMultiUnits,
|
|
20
|
-
oldType,
|
|
21
|
-
closeScreen,
|
|
22
|
-
} = route?.params || {};
|
|
11
|
+
const { unitId, closeScreen, automateId } = route?.params || {};
|
|
23
12
|
|
|
24
13
|
const [stations, setStations] = useState([]);
|
|
25
14
|
const [listStation, setListStation] = useState([]);
|
|
@@ -29,7 +18,7 @@ const SelectControlDevices = ({ route }) => {
|
|
|
29
18
|
const [loading, setLoading] = useState(true);
|
|
30
19
|
|
|
31
20
|
const fetchDetails = useCallback(async () => {
|
|
32
|
-
await fetchWithCache(API.UNIT.DEVICE_CONTROL(
|
|
21
|
+
await fetchWithCache(API.UNIT.DEVICE_CONTROL(unitId), {}, (response) => {
|
|
33
22
|
const { success, data } = response;
|
|
34
23
|
if (success) {
|
|
35
24
|
const newData = data.filter((item) => item.sensors.length > 0);
|
|
@@ -44,48 +33,22 @@ const SelectControlDevices = ({ route }) => {
|
|
|
44
33
|
}
|
|
45
34
|
});
|
|
46
35
|
setLoading(false);
|
|
47
|
-
}, [
|
|
36
|
+
}, [unitId]);
|
|
48
37
|
|
|
49
38
|
useEffect(() => {
|
|
50
39
|
fetchDetails();
|
|
51
40
|
}, [fetchDetails]);
|
|
52
41
|
|
|
53
42
|
const onPressContinue = useCallback(
|
|
54
|
-
(selectedDevice
|
|
43
|
+
(selectedDevice) => {
|
|
55
44
|
navigate(Routes.ChooseAction, {
|
|
56
|
-
|
|
45
|
+
unitId,
|
|
46
|
+
automateId,
|
|
57
47
|
device: selectedDevice,
|
|
58
|
-
automateId: automateId,
|
|
59
|
-
automate: {
|
|
60
|
-
...automate,
|
|
61
|
-
sensor_id: selectedDevice?.id
|
|
62
|
-
? selectedDevice.id
|
|
63
|
-
: automate.sensor_id,
|
|
64
|
-
},
|
|
65
|
-
stationName: stations[indexStation]?.name,
|
|
66
|
-
type,
|
|
67
|
-
scriptName,
|
|
68
|
-
isAutomateTab,
|
|
69
|
-
isCreateNewAction,
|
|
70
|
-
isMultiUnits,
|
|
71
|
-
oldType,
|
|
72
48
|
closeScreen,
|
|
73
49
|
});
|
|
74
50
|
},
|
|
75
|
-
[
|
|
76
|
-
navigate,
|
|
77
|
-
unit,
|
|
78
|
-
automateId,
|
|
79
|
-
automate,
|
|
80
|
-
stations,
|
|
81
|
-
type,
|
|
82
|
-
scriptName,
|
|
83
|
-
isAutomateTab,
|
|
84
|
-
isCreateNewAction,
|
|
85
|
-
isMultiUnits,
|
|
86
|
-
oldType,
|
|
87
|
-
closeScreen,
|
|
88
|
-
]
|
|
51
|
+
[navigate, unitId, automateId, closeScreen]
|
|
89
52
|
);
|
|
90
53
|
|
|
91
54
|
if (loading) {
|
|
@@ -95,7 +58,6 @@ const SelectControlDevices = ({ route }) => {
|
|
|
95
58
|
return (
|
|
96
59
|
<SelectDevices
|
|
97
60
|
onPressContinue={onPressContinue}
|
|
98
|
-
automateId={automateId}
|
|
99
61
|
listStation={listStation}
|
|
100
62
|
listMenuItem={listMenuItem}
|
|
101
63
|
stations={stations}
|
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { useNavigation } from '@react-navigation/native';
|
|
3
3
|
|
|
4
|
-
import { useTranslations } from '
|
|
5
|
-
import { fetchWithCache } from '
|
|
6
|
-
import { API } from '
|
|
7
|
-
import Routes from '
|
|
4
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
5
|
+
import { fetchWithCache } from '../../../utils/Apis/axios';
|
|
6
|
+
import { API } from '../../../configs';
|
|
7
|
+
import Routes from '../../../utils/Route';
|
|
8
8
|
import SelectDevices from './Components/SelectDevices';
|
|
9
|
-
import { AUTOMATE_TYPE } from '
|
|
9
|
+
import { AUTOMATE_TYPE } from '../../../configs/Constants';
|
|
10
10
|
|
|
11
11
|
const SelectMonitorDevices = ({ route }) => {
|
|
12
12
|
const t = useTranslations();
|
|
13
|
-
const {
|
|
14
|
-
unit,
|
|
15
|
-
automateId,
|
|
16
|
-
automate = {},
|
|
17
|
-
type,
|
|
18
|
-
scriptName,
|
|
19
|
-
isAutomateTab,
|
|
20
|
-
isCreateNewAction,
|
|
21
|
-
isMultiUnits,
|
|
22
|
-
oldType,
|
|
23
|
-
closeScreen,
|
|
24
|
-
} = route?.params || {};
|
|
13
|
+
const { automate = {}, isCreateNewAction, closeScreen } = route?.params || {};
|
|
25
14
|
|
|
26
15
|
const [stations, setStations] = useState([]);
|
|
27
16
|
const [listStation, setListStation] = useState([]);
|
|
@@ -33,11 +22,11 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
33
22
|
|
|
34
23
|
const fetchDetails = useCallback(async () => {
|
|
35
24
|
const configs = { params: {} };
|
|
36
|
-
if (type === AUTOMATE_TYPE.EVENT) {
|
|
25
|
+
if (automate?.type === AUTOMATE_TYPE.EVENT) {
|
|
37
26
|
configs.params.type = 'event';
|
|
38
27
|
}
|
|
39
28
|
await fetchWithCache(
|
|
40
|
-
API.UNIT.DEVICE_SENSOR(unit
|
|
29
|
+
API.UNIT.DEVICE_SENSOR(automate?.unit),
|
|
41
30
|
configs,
|
|
42
31
|
(response) => {
|
|
43
32
|
const { success, data } = response;
|
|
@@ -56,7 +45,7 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
56
45
|
}
|
|
57
46
|
);
|
|
58
47
|
setLoading(false);
|
|
59
|
-
}, [type, unit
|
|
48
|
+
}, [automate?.type, automate?.unit]);
|
|
60
49
|
|
|
61
50
|
useEffect(() => {
|
|
62
51
|
if (!automate?.sensor_id) {
|
|
@@ -86,9 +75,7 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
86
75
|
const onPressContinue = useCallback(
|
|
87
76
|
(selectedDevice, indexStation) => {
|
|
88
77
|
navigate(Routes.ChooseConfig, {
|
|
89
|
-
unit,
|
|
90
78
|
device: selectedDevice,
|
|
91
|
-
automateId: automateId,
|
|
92
79
|
automate: {
|
|
93
80
|
...automate,
|
|
94
81
|
sensor_id: selectedDevice?.id
|
|
@@ -96,29 +83,11 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
96
83
|
: automate.sensor_id,
|
|
97
84
|
},
|
|
98
85
|
stationName: stations[indexStation]?.name,
|
|
99
|
-
type,
|
|
100
|
-
scriptName,
|
|
101
|
-
isAutomateTab,
|
|
102
86
|
isCreateNewAction,
|
|
103
|
-
isMultiUnits,
|
|
104
|
-
oldType,
|
|
105
87
|
closeScreen,
|
|
106
88
|
});
|
|
107
89
|
},
|
|
108
|
-
[
|
|
109
|
-
navigate,
|
|
110
|
-
unit,
|
|
111
|
-
automateId,
|
|
112
|
-
automate,
|
|
113
|
-
stations,
|
|
114
|
-
type,
|
|
115
|
-
scriptName,
|
|
116
|
-
isAutomateTab,
|
|
117
|
-
isCreateNewAction,
|
|
118
|
-
isMultiUnits,
|
|
119
|
-
oldType,
|
|
120
|
-
closeScreen,
|
|
121
|
-
]
|
|
90
|
+
[navigate, automate, stations, isCreateNewAction, closeScreen]
|
|
122
91
|
);
|
|
123
92
|
|
|
124
93
|
if (loading) {
|
|
@@ -128,7 +97,6 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
128
97
|
return (
|
|
129
98
|
<SelectDevices
|
|
130
99
|
onPressContinue={onPressContinue}
|
|
131
|
-
automateId={automateId}
|
|
132
100
|
listStation={listStation}
|
|
133
101
|
listMenuItem={listMenuItem}
|
|
134
102
|
stations={stations}
|
|
@@ -3,35 +3,26 @@ import { Image, TouchableOpacity, View } from 'react-native';
|
|
|
3
3
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
4
4
|
|
|
5
5
|
import styles from './Styles/SetupSensorStyles';
|
|
6
|
-
import { Colors, Images } from '
|
|
7
|
-
import { useTranslations } from '
|
|
8
|
-
import { ModalCustom } from '
|
|
9
|
-
import Text from '
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import Routes from '../../utils/Route';
|
|
13
|
-
import { getAutomationData } from '../ScriptDetail/utils';
|
|
6
|
+
import { Colors, Images } from '../../../configs';
|
|
7
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
8
|
+
import { ModalCustom } from '../../../commons/Modal';
|
|
9
|
+
import Text from '../../../commons/Text';
|
|
10
|
+
import { setStatusBarPreview } from '../../../hooks/Common/useStatusBar';
|
|
11
|
+
import Routes from '../../../utils/Route';
|
|
14
12
|
import NewActionWrapper from './NewActionWrapper';
|
|
13
|
+
import _TextInput from '../../../commons/Form/TextInput';
|
|
14
|
+
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
15
15
|
|
|
16
16
|
const SetupConfigCondition = () => {
|
|
17
17
|
const t = useTranslations();
|
|
18
18
|
|
|
19
19
|
const { navigate } = useNavigation();
|
|
20
20
|
const { params = {} } = useRoute();
|
|
21
|
-
const { item,
|
|
21
|
+
const { item, defaultCondition = {} } = params;
|
|
22
22
|
|
|
23
|
-
const hasLimit = useMemo(() => !!item?.range_max, [item]);
|
|
24
23
|
const [isShowModal, setIsShowModal] = useState(false);
|
|
25
|
-
const [itemActiveModal, setItemActiveModal] = useState(
|
|
26
|
-
const [value, setValue] = useState(
|
|
27
|
-
const [minimum] = useState(hasLimit ? parseInt(item?.range_min, 10) : 0);
|
|
28
|
-
const [maximum, setMaximum] = useState(
|
|
29
|
-
value === 0
|
|
30
|
-
? 100
|
|
31
|
-
: hasLimit
|
|
32
|
-
? (parseInt(item?.range_max, 10) - minimum) * 10 + minimum
|
|
33
|
-
: (parseInt(item?.value, 10) + 20 - minimum) * 10 + minimum
|
|
34
|
-
);
|
|
24
|
+
const [itemActiveModal, setItemActiveModal] = useState(defaultCondition);
|
|
25
|
+
const [value, setValue] = useState(defaultCondition?.value || '');
|
|
35
26
|
|
|
36
27
|
const hasNoValueEvaluation = !item?.evaluate_configuration;
|
|
37
28
|
|
|
@@ -63,35 +54,6 @@ const SetupConfigCondition = () => {
|
|
|
63
54
|
return [];
|
|
64
55
|
}, [item.evaluate_configuration, item.id, t]);
|
|
65
56
|
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
let defaultCondition = null;
|
|
68
|
-
if (sensorData) {
|
|
69
|
-
const index = sensorData.findIndex((i) => i?.id === item?.id);
|
|
70
|
-
if (index !== -1 && sensorData[index].condition) {
|
|
71
|
-
defaultCondition = sensorData[index];
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (automate && !defaultCondition) {
|
|
76
|
-
const automationData = getAutomationData(type, automate);
|
|
77
|
-
|
|
78
|
-
const index = conditionOptions.findIndex(
|
|
79
|
-
(i) =>
|
|
80
|
-
i.condition === automationData?.condition &&
|
|
81
|
-
i.value === automationData?.value
|
|
82
|
-
);
|
|
83
|
-
if (index !== -1) {
|
|
84
|
-
defaultCondition = conditionOptions[index];
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (!defaultCondition) {
|
|
89
|
-
defaultCondition = conditionOptions[0];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
setItemActiveModal(defaultCondition);
|
|
93
|
-
}, [conditionOptions, item, sensorData, automate, type]);
|
|
94
|
-
|
|
95
57
|
const onOpenModal = useCallback(() => {
|
|
96
58
|
setIsShowModal(true);
|
|
97
59
|
}, []);
|
|
@@ -101,67 +63,48 @@ const SetupConfigCondition = () => {
|
|
|
101
63
|
}, []);
|
|
102
64
|
|
|
103
65
|
const onChooseCondition = (selectedItem) => () => {
|
|
104
|
-
setItemActiveModal(selectedItem);
|
|
66
|
+
setItemActiveModal((prev) => ({ ...prev, ...selectedItem }));
|
|
105
67
|
onCloseModal();
|
|
106
68
|
};
|
|
107
69
|
|
|
108
|
-
const onChangeValue = useCallback(
|
|
109
|
-
(newValue) => {
|
|
110
|
-
setValue(
|
|
111
|
-
(parseFloat(newValue / 128) + parseFloat(minimum)).toFixed(
|
|
112
|
-
item?.decimal_behind || 1
|
|
113
|
-
)
|
|
114
|
-
);
|
|
115
|
-
},
|
|
116
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
117
|
-
[value]
|
|
118
|
-
);
|
|
119
|
-
|
|
120
70
|
const onSave = useCallback(() => {
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
71
|
+
const conditionValue = parseFloat(itemActiveModal?.value);
|
|
72
|
+
if (isNaN(conditionValue)) {
|
|
73
|
+
ToastBottomHelper.error(t('value_must_be_a_number'));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (['<', '>', '='].includes(itemActiveModal?.condition)) {
|
|
78
|
+
if (item.range_min !== null && conditionValue < item.range_min) {
|
|
79
|
+
ToastBottomHelper.error(
|
|
80
|
+
t('value_must_be_greater_than_min', { min: item.range_min })
|
|
81
|
+
);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (item.range_max !== null && conditionValue > item.range_max) {
|
|
85
|
+
ToastBottomHelper.error(
|
|
86
|
+
t('value_must_be_less_than_max', { max: item.range_max })
|
|
87
|
+
);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
124
92
|
navigate({
|
|
125
93
|
name: Routes.ChooseConfig,
|
|
126
94
|
merge: true,
|
|
127
95
|
params: {
|
|
128
|
-
|
|
96
|
+
newCondition: {
|
|
97
|
+
...itemActiveModal,
|
|
98
|
+
config: item.id,
|
|
99
|
+
},
|
|
129
100
|
},
|
|
130
101
|
});
|
|
131
|
-
}, [
|
|
132
|
-
|
|
133
|
-
const renderScroll = useMemo(() => {
|
|
134
|
-
return (
|
|
135
|
-
<HorizontalPicker
|
|
136
|
-
minimum={minimum}
|
|
137
|
-
maximum={maximum}
|
|
138
|
-
segmentSpacing={8}
|
|
139
|
-
segmentWidth={8}
|
|
140
|
-
step={10}
|
|
141
|
-
normalHeight={4}
|
|
142
|
-
normalWidth={4}
|
|
143
|
-
stepHeight={12}
|
|
144
|
-
stepWidth={12}
|
|
145
|
-
stepColor={Colors.Gray6}
|
|
146
|
-
normalColor={Colors.Gray6}
|
|
147
|
-
onChangeValue={onChangeValue}
|
|
148
|
-
value={value - minimum}
|
|
149
|
-
/>
|
|
150
|
-
);
|
|
151
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
152
|
-
}, [minimum, maximum, value]);
|
|
102
|
+
}, [item.id, item.range_max, item.range_min, itemActiveModal, navigate, t]);
|
|
153
103
|
|
|
154
104
|
useEffect(() => {
|
|
155
105
|
!hasNoValueEvaluation && setValue(1);
|
|
156
106
|
}, [hasNoValueEvaluation]);
|
|
157
107
|
|
|
158
|
-
useEffect(() => {
|
|
159
|
-
if (!hasLimit && maximum - 150 <= value * 10) {
|
|
160
|
-
setMaximum(maximum + 200);
|
|
161
|
-
}
|
|
162
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
163
|
-
}, [value]);
|
|
164
|
-
|
|
165
108
|
useEffect(() => {
|
|
166
109
|
if (item?.title) {
|
|
167
110
|
const itemTemp = conditionOptions.find((i) => i.title === item.title);
|
|
@@ -171,19 +114,23 @@ const SetupConfigCondition = () => {
|
|
|
171
114
|
}, [item]);
|
|
172
115
|
|
|
173
116
|
useEffect(() => {
|
|
174
|
-
|
|
175
|
-
useStatusBarPreview(
|
|
117
|
+
setStatusBarPreview(
|
|
176
118
|
isShowModal ? Colors.BlackTransparent4 : Colors.TextTransparent
|
|
177
119
|
);
|
|
178
120
|
}, [isShowModal]);
|
|
179
121
|
|
|
122
|
+
const onChangeValue = useCallback((newValue) => {
|
|
123
|
+
setValue(newValue);
|
|
124
|
+
setItemActiveModal((prev) => ({ ...prev, value: newValue }));
|
|
125
|
+
}, []);
|
|
126
|
+
|
|
180
127
|
return (
|
|
181
128
|
<>
|
|
182
129
|
<NewActionWrapper
|
|
183
130
|
name={t('set_up {name}', { name: item?.name })}
|
|
184
131
|
nextTitle={t('save')}
|
|
185
132
|
onNext={onSave}
|
|
186
|
-
canNext={
|
|
133
|
+
canNext={itemActiveModal?.condition}
|
|
187
134
|
>
|
|
188
135
|
<TouchableOpacity
|
|
189
136
|
onPress={onOpenModal}
|
|
@@ -204,14 +151,18 @@ const SetupConfigCondition = () => {
|
|
|
204
151
|
</Text>
|
|
205
152
|
<View style={[styles.flexRow, styles.center]}>
|
|
206
153
|
<View>
|
|
207
|
-
<
|
|
208
|
-
|
|
154
|
+
<_TextInput
|
|
155
|
+
textInputStyle={styles.value}
|
|
156
|
+
wrapStyle={styles.wrapValue}
|
|
157
|
+
value={value}
|
|
158
|
+
keyboardType={'numeric'}
|
|
159
|
+
onChange={onChangeValue}
|
|
160
|
+
/>
|
|
209
161
|
</View>
|
|
210
162
|
<Text type="H2" style={styles.unit}>
|
|
211
163
|
{item?.unit}
|
|
212
164
|
</Text>
|
|
213
165
|
</View>
|
|
214
|
-
{renderScroll}
|
|
215
166
|
</>
|
|
216
167
|
)}
|
|
217
168
|
</NewActionWrapper>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
import { getBottomSpace } from 'react-native-iphone-x-helper';
|
|
3
|
-
import { Colors, Constants, Theme } from '
|
|
3
|
+
import { Colors, Constants, Theme } from '../../../../configs';
|
|
4
4
|
|
|
5
5
|
export default StyleSheet.create({
|
|
6
6
|
...Theme,
|
package/src/screens/{AddNewAction → Automate/AddNewAction}/Styles/SelectSensorDevicesStyles.js
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
import { getBottomSpace } from 'react-native-iphone-x-helper';
|
|
3
|
-
import { Colors, Constants } from '
|
|
3
|
+
import { Colors, Constants } from '../../../../configs';
|
|
4
4
|
|
|
5
5
|
export default StyleSheet.create({
|
|
6
6
|
wrap: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { Theme, Colors } from '
|
|
2
|
+
import { Theme, Colors } from '../../../../configs';
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
5
|
...Theme,
|
|
@@ -46,8 +46,10 @@ export default StyleSheet.create({
|
|
|
46
46
|
fontSize: 48,
|
|
47
47
|
fontWeight: 'bold',
|
|
48
48
|
textAlign: 'center',
|
|
49
|
-
|
|
49
|
+
borderBottomWidth: 1,
|
|
50
|
+
borderBottomColor: Colors.Black,
|
|
50
51
|
},
|
|
52
|
+
wrapValue: { marginTop: 0, margin: 0 },
|
|
51
53
|
unit: {
|
|
52
54
|
marginTop: -30,
|
|
53
55
|
},
|
|
@@ -3,14 +3,14 @@ import renderer, { act } from 'react-test-renderer';
|
|
|
3
3
|
import MockAdapter from 'axios-mock-adapter';
|
|
4
4
|
|
|
5
5
|
import ChooseAction from '../ChooseAction';
|
|
6
|
-
import { SCProvider } from '
|
|
7
|
-
import { mockSCStore } from '
|
|
8
|
-
import BottomButtonView from '
|
|
9
|
-
import { AccessibilityLabel, DEVICE_TYPE } from '
|
|
10
|
-
import api from '
|
|
11
|
-
import { API } from '
|
|
6
|
+
import { SCProvider } from '../../../../context';
|
|
7
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
8
|
+
import BottomButtonView from '../../../../commons/BottomButtonView';
|
|
9
|
+
import { AccessibilityLabel, DEVICE_TYPE } from '../../../../configs/Constants';
|
|
10
|
+
import api from '../../../../utils/Apis/axios';
|
|
11
|
+
import { API } from '../../../../configs';
|
|
12
12
|
import { TouchableOpacity } from 'react-native';
|
|
13
|
-
import SelectActionCard from '
|
|
13
|
+
import SelectActionCard from '../../../../commons/SelectActionCard';
|
|
14
14
|
import { useNavigation } from '@react-navigation/native';
|
|
15
15
|
|
|
16
16
|
const mock = new MockAdapter(api.axiosInstance);
|
|
@@ -68,9 +68,9 @@ describe('Test ChooseAction', () => {
|
|
|
68
68
|
|
|
69
69
|
it('test fetchData', async () => {
|
|
70
70
|
const response = [
|
|
71
|
-
{ template: 'on_off_button_action_template' },
|
|
72
|
-
{ template: 'one_button_action_template' },
|
|
73
|
-
{ template: 'three_button_action_template' },
|
|
71
|
+
{ template: 'on_off_button_action_template', id: 1, configuration: {} },
|
|
72
|
+
{ template: 'one_button_action_template', id: 2, configuration: {} },
|
|
73
|
+
{ template: 'three_button_action_template', id: 3, configuration: {} },
|
|
74
74
|
];
|
|
75
75
|
mock.onGet(API.DEVICE.DISPLAY_ACTIONS(1)).reply(200, response);
|
|
76
76
|
await act(async () => {
|
|
@@ -291,7 +291,6 @@ describe('Test ChooseAction', () => {
|
|
|
291
291
|
data: { config_id: config5, config_value: 1 },
|
|
292
292
|
},
|
|
293
293
|
],
|
|
294
|
-
unit: 1,
|
|
295
294
|
})
|
|
296
295
|
);
|
|
297
296
|
});
|