@eohjsc/react-native-smart-city 0.7.3-rc11 → 0.7.3-rc13
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/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
- package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +2 -2
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +5 -5
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +5 -5
- package/src/commons/ActionGroup/TerminalBoxTemplate.js +2 -2
- package/src/commons/ActionGroup/TextBoxTemplate.js +2 -2
- package/src/commons/ActionGroup/TimerActionTemplate.js +6 -3
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/ButtonPopup/index.js +2 -2
- package/src/commons/DateTimeRangeChange/DateTimeButton.js +2 -2
- package/src/commons/Device/ConnectedViewHeader.js +2 -2
- package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
- package/src/commons/Device/FlatListItems.js +3 -3
- package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
- package/src/commons/Device/ItemAddNew/index.js +2 -2
- package/src/commons/Device/ItemDevice.js +2 -2
- package/src/commons/Device/SonosSpeaker/index.js +3 -3
- package/src/commons/Device/WaterPurifierStatus/AlertStatusMachine.js +2 -2
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +6 -2
- package/src/commons/DisplayChecking/index.js +2 -2
- package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
- package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
- package/src/commons/Header/HeaderCustom.js +2 -2
- package/src/commons/HeaderAni/index.js +2 -2
- package/src/commons/NavBar/index.js +2 -2
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/SearchLocation/index.js +3 -3
- package/src/commons/SelectActionCard/index.js +2 -2
- package/src/commons/SelectSubUnit/index.js +6 -2
- package/src/commons/Sharing/BtnRemoveMember.js +2 -2
- package/src/commons/Sharing/StationDevicePermissions.js +2 -2
- package/src/commons/SubUnit/DeviceTemplate/ConfigAndEvaluation/ConfigAndEvaluation.js +2 -2
- package/src/commons/SubUnit/DeviceTemplate/ConfigValue/ConfigValue.js +2 -2
- package/src/commons/SubUnit/DeviceTemplate/EvaluationOverConfig/EvaluationOverConfig.js +2 -2
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +2 -2
- package/src/commons/Unit/HeaderUnit/index.js +3 -3
- package/src/commons/Unit/SharedUnit.js +7 -7
- package/src/configs/Theme.js +1 -1
- package/src/navigations/EmergencyContactsStack.js +2 -2
- package/src/navigations/SharedStack.js +2 -0
- package/src/navigations/UnitStack.js +2 -2
- package/src/screens/ActivityLog/index.js +2 -2
- package/src/screens/AddLocationMaps/index.js +3 -3
- package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
- package/src/screens/Automate/AddNewAction/ChooseAction.js +17 -3
- package/src/screens/Automate/AddNewAction/ChooseConfig.js +7 -6
- package/src/screens/Automate/AddNewAction/NewActionWrapper.js +2 -2
- package/src/screens/Automate/AddNewAction/SelectControlDevices.js +27 -17
- package/src/screens/Automate/AddNewAction/SelectMonitorDevices.js +17 -10
- package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +7 -2
- package/src/screens/Automate/AddNewAction/SetupScriptDelay.js +1 -1
- package/src/screens/Automate/AddNewAction/SetupScriptNotify.js +3 -3
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +29 -0
- package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +7 -7
- package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +14 -6
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +2 -0
- package/src/screens/Automate/ScriptDetail/index.js +3 -3
- package/src/screens/Automate/Styles/indexStyles.js +1 -1
- package/src/screens/Automate/index.js +36 -33
- package/src/screens/Device/EditDevice/index.js +2 -2
- package/src/screens/Device/__test__/detail.test.js +3 -3
- package/src/screens/Device/detail.js +7 -7
- package/src/screens/Drawer/index.js +3 -3
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +8 -4
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
- package/src/screens/GuestInfo/index.js +2 -2
- package/src/screens/HanetCamera/ManageAccess.js +3 -3
- package/src/screens/HanetCamera/MemberInfo.js +2 -2
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
- package/src/screens/ManageAccess/index.js +3 -3
- package/src/screens/Notification/index.js +3 -3
- package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
- package/src/screens/SelectUnit/index.js +3 -3
- package/src/screens/SharedUnit/TabHeader.js +2 -2
- package/src/screens/Sharing/Components/EndDevice.js +3 -3
- package/src/screens/Sharing/UnitMemberList.js +2 -2
- package/src/screens/SmartAccount/SuccessfullyConnected/index.js +2 -2
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +3 -2
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +2 -2
- package/src/screens/SmartIr/components/SelectBrand.js +2 -2
- package/src/screens/SubUnit/EditSubUnit.js +2 -2
- package/src/screens/SubUnit/ManageSubUnit.js +3 -3
- package/src/screens/Unit/SelectAddToFavorites.js +2 -2
- package/src/screens/Unit/SelectAddress.js +3 -3
- package/src/screens/Unit/components/AutomateScript/index.js +2 -2
- package/src/screens/Unit/components/ButtonWrapper/index.js +3 -3
- package/src/screens/Unit/components/Header/index.js +2 -2
- package/src/screens/Unit/components/SharedUnit/index.js +5 -5
- package/src/screens/UnitSummary/components/AirQuality/index.js +2 -2
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +2 -2
- package/src/screens/UnitSummary/index.js +3 -3
- package/src/utils/I18n/translations/vi.js +2 -0
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
1
|
import { useNavigation } from '@react-navigation/native';
|
|
2
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
3
3
|
|
|
4
|
+
import { API } from '../../../configs';
|
|
5
|
+
import { AUTOMATE_TYPE } from '../../../configs/Constants';
|
|
4
6
|
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
5
7
|
import { fetchWithCache } from '../../../utils/Apis/axios';
|
|
6
|
-
import { API } from '../../../configs';
|
|
7
8
|
import Routes from '../../../utils/Route';
|
|
8
9
|
import SelectDevices from './Components/SelectDevices';
|
|
9
|
-
import { AUTOMATE_TYPE } from '../../../configs/Constants';
|
|
10
10
|
|
|
11
11
|
const SelectMonitorDevices = ({ route }) => {
|
|
12
12
|
const t = useTranslations();
|
|
13
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
automate = {},
|
|
15
|
+
isCreateNewAction,
|
|
16
|
+
closeScreen,
|
|
17
|
+
multiUnit = {},
|
|
18
|
+
} = route.params || {};
|
|
19
|
+
const { type, unit, sensor_id } = automate;
|
|
14
20
|
|
|
15
21
|
const [stations, setStations] = useState([]);
|
|
16
22
|
const [listStation, setListStation] = useState([]);
|
|
@@ -22,11 +28,11 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
22
28
|
|
|
23
29
|
const fetchDetails = useCallback(async () => {
|
|
24
30
|
const configs = { params: {} };
|
|
25
|
-
if (
|
|
31
|
+
if (type === AUTOMATE_TYPE.EVENT) {
|
|
26
32
|
configs.params.type = 'event';
|
|
27
33
|
}
|
|
28
34
|
await fetchWithCache(
|
|
29
|
-
API.UNIT.DEVICE_SENSOR(
|
|
35
|
+
API.UNIT.DEVICE_SENSOR(unit || multiUnit.id),
|
|
30
36
|
configs,
|
|
31
37
|
(response) => {
|
|
32
38
|
const { success, data } = response;
|
|
@@ -46,17 +52,17 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
46
52
|
}
|
|
47
53
|
);
|
|
48
54
|
setLoading(false);
|
|
49
|
-
}, [
|
|
55
|
+
}, [multiUnit.id, type, unit]);
|
|
50
56
|
|
|
51
57
|
useEffect(() => {
|
|
52
|
-
if (!
|
|
58
|
+
if (!sensor_id) {
|
|
53
59
|
return;
|
|
54
60
|
}
|
|
55
61
|
let selectSensor = {};
|
|
56
62
|
let found = false;
|
|
57
63
|
for (let i = 0; i < stations.length; i++) {
|
|
58
64
|
for (let j = 0; j < stations[i].sensors.length; j++) {
|
|
59
|
-
if (stations[i].sensors[j].id ===
|
|
65
|
+
if (stations[i].sensors[j].id === sensor_id) {
|
|
60
66
|
selectSensor = stations[i].sensors[j];
|
|
61
67
|
found = true;
|
|
62
68
|
break;
|
|
@@ -67,7 +73,7 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
75
|
setDefaultSelectedDevice(selectSensor);
|
|
70
|
-
}, [
|
|
76
|
+
}, [sensor_id, stations]);
|
|
71
77
|
|
|
72
78
|
useEffect(() => {
|
|
73
79
|
fetchDetails();
|
|
@@ -86,6 +92,7 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
86
92
|
stationName: stations[indexStation]?.name,
|
|
87
93
|
isCreateNewAction,
|
|
88
94
|
closeScreen,
|
|
95
|
+
unitId: automate?.unit,
|
|
89
96
|
});
|
|
90
97
|
},
|
|
91
98
|
[navigate, automate, stations, isCreateNewAction, closeScreen]
|
|
@@ -43,7 +43,7 @@ const SetupConfigCondition = () => {
|
|
|
43
43
|
const t = useTranslations();
|
|
44
44
|
const { navigate } = useNavigation();
|
|
45
45
|
const { params = {} } = useRoute();
|
|
46
|
-
const { config, automate, closeScreen } = params;
|
|
46
|
+
const { config, automate, closeScreen, unitId } = params;
|
|
47
47
|
const [selectedCondition, setSelectedCondition] = useState(undefined);
|
|
48
48
|
const [customCondition, setCustomCondition] = useState(undefined);
|
|
49
49
|
const [isShowModal, setIsShowModal] = useState(false);
|
|
@@ -88,6 +88,7 @@ const SetupConfigCondition = () => {
|
|
|
88
88
|
navigate(Routes.ValueChangeName, {
|
|
89
89
|
automate,
|
|
90
90
|
closeScreen,
|
|
91
|
+
unitId,
|
|
91
92
|
});
|
|
92
93
|
};
|
|
93
94
|
|
|
@@ -180,7 +181,11 @@ const SetupConfigCondition = () => {
|
|
|
180
181
|
return;
|
|
181
182
|
}
|
|
182
183
|
setIsShowModal(false);
|
|
183
|
-
navigate(Routes.ValueChangeName, {
|
|
184
|
+
navigate(Routes.ValueChangeName, {
|
|
185
|
+
automate,
|
|
186
|
+
closeScreen,
|
|
187
|
+
unitId,
|
|
188
|
+
});
|
|
184
189
|
}}
|
|
185
190
|
style={styles.buttonContinue}
|
|
186
191
|
textSemiBold={false}
|
|
@@ -17,9 +17,9 @@ import moment from 'moment';
|
|
|
17
17
|
const SetupScriptNotify = ({ route }) => {
|
|
18
18
|
const t = useTranslations();
|
|
19
19
|
const { goBack, navigate } = useNavigation();
|
|
20
|
-
const { automate = {}, unitId } = route
|
|
20
|
+
const { automate = {}, unitId, multiUnit } = route.params || {};
|
|
21
21
|
const { id: automateId } = automate;
|
|
22
|
-
const [notify, setNotify] = useState({ unit: unitId });
|
|
22
|
+
const [notify, setNotify] = useState({ unit: unitId || multiUnit.id });
|
|
23
23
|
|
|
24
24
|
const onChangeTitle = (value) => {
|
|
25
25
|
setNotify((state) => ({
|
|
@@ -47,7 +47,7 @@ const SetupScriptNotify = ({ route }) => {
|
|
|
47
47
|
params: { saveAt: moment().valueOf() },
|
|
48
48
|
});
|
|
49
49
|
} else {
|
|
50
|
-
ToastBottomHelper.error(t('
|
|
50
|
+
ToastBottomHelper.error(t('error_please_try_later'));
|
|
51
51
|
}
|
|
52
52
|
}, [automateId, navigate, notify, t]);
|
|
53
53
|
|
|
@@ -69,6 +69,35 @@ describe('Test SetupScriptNotify', () => {
|
|
|
69
69
|
expect(spyToast).toHaveBeenCalled();
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
+
it('SetupScriptNotify onPress create script notify success with multi unit', async () => {
|
|
73
|
+
route.params.unitId = null;
|
|
74
|
+
route.params.multiUnit = { id: 1 };
|
|
75
|
+
const spyToast = jest.spyOn(ToastBottomHelper, 'success');
|
|
76
|
+
mock.onPost(API.AUTOMATE.ADD_SCRIPT_NOTIFY(1)).reply(200);
|
|
77
|
+
await act(async () => {
|
|
78
|
+
tree = await renderer.create(wrapComponent(route));
|
|
79
|
+
});
|
|
80
|
+
const instance = tree.root;
|
|
81
|
+
const inputs = instance.findAllByType(_TextInput);
|
|
82
|
+
expect(inputs).toHaveLength(2);
|
|
83
|
+
|
|
84
|
+
await act(async () => {
|
|
85
|
+
inputs[0].props.onChange('Title');
|
|
86
|
+
});
|
|
87
|
+
const touchable = instance.findAllByType(TouchableWithoutFeedback);
|
|
88
|
+
await act(async () => {
|
|
89
|
+
touchable[0].props.onPress();
|
|
90
|
+
});
|
|
91
|
+
await act(async () => {
|
|
92
|
+
inputs[1].props.onChange('Message');
|
|
93
|
+
});
|
|
94
|
+
const button = instance.findByType(BottomButtonView);
|
|
95
|
+
await act(async () => {
|
|
96
|
+
button.props.onPressMain();
|
|
97
|
+
});
|
|
98
|
+
expect(spyToast).toHaveBeenCalled();
|
|
99
|
+
});
|
|
100
|
+
|
|
72
101
|
it('SetupScriptNotify onPress create script notify error', async () => {
|
|
73
102
|
const spyToast = jest.spyOn(ToastBottomHelper, 'error');
|
|
74
103
|
mock.onPost(API.AUTOMATE.ADD_SCRIPT_NOTIFY(1)).reply(400);
|
|
@@ -7,16 +7,16 @@ import Text from '../../../commons/Text';
|
|
|
7
7
|
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
8
8
|
import Routes from '../../../utils/Route';
|
|
9
9
|
import styles from './styles/AddNewAutoSmartStyles';
|
|
10
|
+
import { AUTOMATE_TYPE } from '../../../configs/Constants';
|
|
10
11
|
|
|
11
12
|
const AddTypeSmart = ({ smartTypes, route }) => {
|
|
12
13
|
const t = useTranslations();
|
|
13
14
|
const { navigate, goBack } = useNavigation();
|
|
14
15
|
const { automate = {}, closeScreen } = route?.params || {};
|
|
16
|
+
const { id, unit, type } = automate;
|
|
15
17
|
|
|
16
18
|
const [selectedIndex, setSelectedIndex] = useState(
|
|
17
|
-
|
|
18
|
-
? smartTypes.findIndex((obj) => obj.type === automate.type)
|
|
19
|
-
: -1
|
|
19
|
+
id ? smartTypes.findIndex((obj) => obj.type === type) : -1
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
const handleOnContinue = useCallback(
|
|
@@ -27,18 +27,18 @@ const AddTypeSmart = ({ smartTypes, route }) => {
|
|
|
27
27
|
...automate,
|
|
28
28
|
type: dataAutomate?.type,
|
|
29
29
|
},
|
|
30
|
-
unitId:
|
|
30
|
+
unitId: unit,
|
|
31
31
|
closeScreen: closeScreen,
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
if (!
|
|
34
|
+
if (!unit && dataAutomate.type !== AUTOMATE_TYPE.SCHEDULE) {
|
|
35
35
|
navigate(Routes.SelectUnit, params);
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
navigate(dataAutomate.route, params);
|
|
40
40
|
},
|
|
41
|
-
[smartTypes, automate, closeScreen, navigate]
|
|
41
|
+
[smartTypes, automate, unit, closeScreen, navigate]
|
|
42
42
|
);
|
|
43
43
|
|
|
44
44
|
const onSelectType = (index) => {
|
|
@@ -51,7 +51,7 @@ const AddTypeSmart = ({ smartTypes, route }) => {
|
|
|
51
51
|
<HeaderCustom isShowClose onClose={goBack} />
|
|
52
52
|
<View style={styles.container}>
|
|
53
53
|
<Text semibold type={'H2'} style={styles.titleCreate}>
|
|
54
|
-
{
|
|
54
|
+
{id ? t('update_smart') : t('create_smart')}
|
|
55
55
|
</Text>
|
|
56
56
|
<Text type={'Body'} style={styles.titleChoose}>
|
|
57
57
|
{t('choose_the_automation_method_you_want')}
|
|
@@ -11,7 +11,7 @@ import Event from '../../../../../assets/images/Event.svg';
|
|
|
11
11
|
import Notify from '../../../../../assets/images/Notify.svg';
|
|
12
12
|
import Delay from '../../../../../assets/images/Delay.svg';
|
|
13
13
|
import { TouchableOpacity } from 'react-native';
|
|
14
|
-
import
|
|
14
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
15
15
|
import { Text } from '../../../../commons';
|
|
16
16
|
import Routes from '../../../../utils/Route';
|
|
17
17
|
import AccessibilityLabel from '../../../../configs/AccessibilityLabel';
|
|
@@ -40,6 +40,7 @@ const AddActionScript = memo(
|
|
|
40
40
|
closeScreen: currentScreenName,
|
|
41
41
|
numberActionCanAdd:
|
|
42
42
|
max_actions_per_automation - numberActionAdded,
|
|
43
|
+
routeName: unit ? null : Routes.SelectControlDevices,
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
navigate(
|
|
@@ -54,10 +55,17 @@ const AddActionScript = memo(
|
|
|
54
55
|
image: <Notify />,
|
|
55
56
|
onClick: () => {
|
|
56
57
|
setIsVisible(false);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
if (unit) {
|
|
59
|
+
navigate(Routes.SetupScriptNotify, {
|
|
60
|
+
automate,
|
|
61
|
+
unitId: unit,
|
|
62
|
+
});
|
|
63
|
+
} else {
|
|
64
|
+
navigate(Routes.SelectUnit, {
|
|
65
|
+
automate,
|
|
66
|
+
routeName: Routes.SetupScriptNotify,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
61
69
|
},
|
|
62
70
|
},
|
|
63
71
|
{
|
|
@@ -109,7 +117,7 @@ const AddActionScript = memo(
|
|
|
109
117
|
<View style={styles.wapItem}>
|
|
110
118
|
<View style={styles.imageItem}>{item.image}</View>
|
|
111
119
|
<Text style={styles.textItem}>{item.text}</Text>
|
|
112
|
-
<
|
|
120
|
+
<IconOutline name="right" />
|
|
113
121
|
</View>
|
|
114
122
|
</TouchableOpacity>
|
|
115
123
|
</View>
|
|
@@ -7,7 +7,7 @@ import React, {
|
|
|
7
7
|
} from 'react';
|
|
8
8
|
import { Image, Platform, Switch, TouchableOpacity, View } from 'react-native';
|
|
9
9
|
import { PopoverMode } from 'react-native-popover-view';
|
|
10
|
-
import
|
|
10
|
+
import { IconFill, IconOutline } from '@ant-design/icons-react-native';
|
|
11
11
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
12
12
|
|
|
13
13
|
import { useIsFocused, useNavigation } from '@react-navigation/native';
|
|
@@ -479,9 +479,9 @@ const ButtonStar = ({ automate }) => {
|
|
|
479
479
|
accessibilityLabel={AccessibilityLabel.HEADER_SCRIPT_DETAIL_BUTTON_STAR}
|
|
480
480
|
>
|
|
481
481
|
{isStarred ? (
|
|
482
|
-
<
|
|
482
|
+
<IconFill name="star" size={25} color={Colors.Yellow6} />
|
|
483
483
|
) : (
|
|
484
|
-
<
|
|
484
|
+
<IconOutline name="star" size={25} />
|
|
485
485
|
)}
|
|
486
486
|
</PreventDoubleTouch>
|
|
487
487
|
);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { IconFill } from '@ant-design/icons-react-native';
|
|
2
|
+
import {
|
|
3
|
+
useIsFocused,
|
|
4
|
+
useNavigation,
|
|
5
|
+
useRoute,
|
|
6
|
+
} from '@react-navigation/native';
|
|
1
7
|
import React, {
|
|
2
8
|
useCallback,
|
|
3
9
|
useEffect,
|
|
@@ -6,27 +12,21 @@ import React, {
|
|
|
6
12
|
useState,
|
|
7
13
|
} from 'react';
|
|
8
14
|
import { FlatList, Image, TouchableOpacity, View } from 'react-native';
|
|
9
|
-
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
10
|
-
import {
|
|
11
|
-
useIsFocused,
|
|
12
|
-
useNavigation,
|
|
13
|
-
useRoute,
|
|
14
|
-
} from '@react-navigation/native';
|
|
15
15
|
import { useSCContextSelector } from '../../context';
|
|
16
16
|
|
|
17
|
-
import
|
|
17
|
+
import ItemAddNew from '../../commons/Device/ItemAddNew';
|
|
18
|
+
import ItemOneTap from '../../commons/SubUnit/OneTap/ItemOneTap';
|
|
19
|
+
import Text from '../../commons/Text';
|
|
18
20
|
import { API, Colors, Images } from '../../configs';
|
|
21
|
+
import { AccessibilityLabel, UNIT_TYPES } from '../../configs/Constants';
|
|
22
|
+
import { useGetIdUser } from '../../hooks/Common';
|
|
23
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
19
24
|
import { axiosGet } from '../../utils/Apis/axios';
|
|
20
|
-
import
|
|
21
|
-
import ItemOneTap from '../../commons/SubUnit/OneTap/ItemOneTap';
|
|
25
|
+
import { useBackendPermission } from '../../utils/Permission/backend';
|
|
22
26
|
import Routes from '../../utils/Route';
|
|
23
|
-
import Loading from './Components/Loading';
|
|
24
|
-
import ItemAddNew from '../../commons/Device/ItemAddNew';
|
|
25
|
-
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
26
|
-
import { useGetIdUser } from '../../hooks/Common';
|
|
27
|
-
import { AccessibilityLabel, UNIT_TYPES } from '../../configs/Constants';
|
|
28
27
|
import { keyExtractor, ToastBottomHelper } from '../../utils/Utils';
|
|
29
|
-
import
|
|
28
|
+
import Loading from './Components/Loading';
|
|
29
|
+
import styles from './Styles/indexStyles';
|
|
30
30
|
|
|
31
31
|
const Automate = () => {
|
|
32
32
|
const t = useTranslations();
|
|
@@ -164,29 +164,32 @@ const Automate = () => {
|
|
|
164
164
|
<Image source={Images.arrowBack} style={styles.arrowRight} />
|
|
165
165
|
</TouchableOpacity>
|
|
166
166
|
</View>
|
|
167
|
-
{
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
isOwner={isOwner}
|
|
171
|
-
automate={automates[0]}
|
|
172
|
-
wrapSyles={styles.wrapAutomateItem}
|
|
173
|
-
onPressItem={() =>
|
|
174
|
-
onPressItem(automates[0], unit_id, type, isOwner)
|
|
175
|
-
}
|
|
176
|
-
/>
|
|
177
|
-
{!!automates[1] && (
|
|
167
|
+
<View style={styles.automatesRow}>
|
|
168
|
+
{!!automates?.length && (
|
|
169
|
+
<>
|
|
178
170
|
<ItemOneTap
|
|
179
171
|
isOwner={isOwner}
|
|
180
|
-
automate={automates[
|
|
172
|
+
automate={automates[0]}
|
|
181
173
|
wrapSyles={styles.wrapAutomateItem}
|
|
182
174
|
onPressItem={() =>
|
|
183
|
-
onPressItem(automates[
|
|
175
|
+
onPressItem(automates[0], unit_id, type, isOwner)
|
|
184
176
|
}
|
|
185
177
|
/>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
178
|
+
{!!automates[1] && (
|
|
179
|
+
<ItemOneTap
|
|
180
|
+
isOwner={isOwner}
|
|
181
|
+
automate={automates[1]}
|
|
182
|
+
wrapSyles={styles.wrapAutomateItem}
|
|
183
|
+
onPressItem={() =>
|
|
184
|
+
onPressItem(automates[1], unit_id, type, isOwner)
|
|
185
|
+
}
|
|
186
|
+
/>
|
|
187
|
+
)}
|
|
188
|
+
</>
|
|
189
|
+
)}
|
|
190
|
+
{(!automates?.length || automates.length === 1) &&
|
|
191
|
+
renderListFooterComponent(unit_id, automates)}
|
|
192
|
+
</View>
|
|
190
193
|
</View>
|
|
191
194
|
);
|
|
192
195
|
},
|
|
@@ -210,7 +213,7 @@ const Automate = () => {
|
|
|
210
213
|
/* istanbul ignore next */
|
|
211
214
|
headerRight: () => (
|
|
212
215
|
<TouchableOpacity style={styles.buttonAdd}>
|
|
213
|
-
<
|
|
216
|
+
<IconFill name={'plus-circle'} size={28} color={Colors.Orange} />
|
|
214
217
|
</TouchableOpacity>
|
|
215
218
|
),
|
|
216
219
|
});
|
|
@@ -2,7 +2,7 @@ import React, { memo, useState, useCallback } from 'react';
|
|
|
2
2
|
import { View, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
4
4
|
import { HeaderCustom } from '../../../commons/Header';
|
|
5
|
-
import
|
|
5
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
6
6
|
import { Colors } from '../../../configs';
|
|
7
7
|
import Text from '../../../commons/Text';
|
|
8
8
|
import { useRoute } from '@react-navigation/native';
|
|
@@ -92,7 +92,7 @@ const EditDevice = memo(() => {
|
|
|
92
92
|
<Text type="Body" Reugular color={Colors.Grey7}>
|
|
93
93
|
{sensorName}
|
|
94
94
|
</Text>
|
|
95
|
-
<
|
|
95
|
+
<IconOutline
|
|
96
96
|
name="right"
|
|
97
97
|
size={18}
|
|
98
98
|
color={Colors.Gray7}
|
|
@@ -3,8 +3,6 @@ import MockAdapter from 'axios-mock-adapter';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Alert, ScrollView } from 'react-native';
|
|
5
5
|
import { act, create } from 'react-test-renderer';
|
|
6
|
-
|
|
7
|
-
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
8
6
|
import { AlertAction, ButtonPopup, MenuActionMore } from '../../../commons';
|
|
9
7
|
import CurrentRainSensor from '../../../commons/Device/RainningSensor/CurrentRainSensor';
|
|
10
8
|
import { AlertSendConfirm } from '../../../commons/EmergencyButton/AlertSendConfirm';
|
|
@@ -19,6 +17,7 @@ import api from '../../../utils/Apis/axios';
|
|
|
19
17
|
import { getTranslate } from '../../../utils/I18n';
|
|
20
18
|
import Routes from '../../../utils/Route';
|
|
21
19
|
import DeviceDetail from '../detail';
|
|
20
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
22
21
|
|
|
23
22
|
const mock = new MockAdapter(api.axiosInstance);
|
|
24
23
|
|
|
@@ -352,7 +351,8 @@ describe('test DeviceDetail', () => {
|
|
|
352
351
|
const buttonPopupIcon = instance.find(
|
|
353
352
|
(el) =>
|
|
354
353
|
el.props.accessibilityLabel ===
|
|
355
|
-
AccessibilityLabel.BUTTON_POPUP_RESOLVED_ICON &&
|
|
354
|
+
AccessibilityLabel.BUTTON_POPUP_RESOLVED_ICON &&
|
|
355
|
+
el.type === IconOutline
|
|
356
356
|
);
|
|
357
357
|
expect(buttonPopupTitle.props.children).toEqual([
|
|
358
358
|
'Unit name',
|
|
@@ -8,7 +8,7 @@ import React, {
|
|
|
8
8
|
} from 'react';
|
|
9
9
|
import { View, TouchableOpacity, Platform } from 'react-native';
|
|
10
10
|
import { useNavigation, useFocusEffect } from '@react-navigation/native';
|
|
11
|
-
import
|
|
11
|
+
import { IconFill, IconOutline } from '@ant-design/icons-react-native';
|
|
12
12
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
13
13
|
import moment from 'moment';
|
|
14
14
|
|
|
@@ -685,9 +685,9 @@ const DeviceDetail = ({ route }) => {
|
|
|
685
685
|
>
|
|
686
686
|
<View style={styles.buttonStar}>
|
|
687
687
|
{isFavorite ? (
|
|
688
|
-
<
|
|
688
|
+
<IconFill name="star" size={25} color={Colors.Yellow6} />
|
|
689
689
|
) : (
|
|
690
|
-
<
|
|
690
|
+
<IconOutline name="star" size={25} />
|
|
691
691
|
)}
|
|
692
692
|
</View>
|
|
693
693
|
</TouchableOpacity>
|
|
@@ -695,7 +695,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
695
695
|
{isShowSetupEmergencyContact && (
|
|
696
696
|
<TouchableOpacity onPress={onPressSetting}>
|
|
697
697
|
<View style={styles.button}>
|
|
698
|
-
<
|
|
698
|
+
<IconOutline name="setting" size={25} color={Colors.Black} />
|
|
699
699
|
</View>
|
|
700
700
|
</TouchableOpacity>
|
|
701
701
|
)}
|
|
@@ -792,7 +792,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
792
792
|
<BottomButtonView
|
|
793
793
|
style={styles.bottomButtonEmergencyContact}
|
|
794
794
|
mainIcon={
|
|
795
|
-
<
|
|
795
|
+
<IconOutline name="plus" size={16} color={Colors.Primary} />
|
|
796
796
|
}
|
|
797
797
|
mainTitle={t('setup_my_emergency_contact')}
|
|
798
798
|
onPressMain={onSetupContacts}
|
|
@@ -827,7 +827,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
827
827
|
{isShowEmergencyResolve && !isEmergencyPopupScreen && (
|
|
828
828
|
<BottomButtonView
|
|
829
829
|
style={styles.bottomButtonEmergencyResolve}
|
|
830
|
-
mainIcon={<
|
|
830
|
+
mainIcon={<IconOutline name="tool" size={15} color={Colors.Gray6} />}
|
|
831
831
|
mainTitle={t('resolve_situation')}
|
|
832
832
|
onPressMain={onPressResolveSituationConfirm}
|
|
833
833
|
topComponent={
|
|
@@ -867,7 +867,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
867
867
|
>
|
|
868
868
|
{unit?.name} - {sensor?.station?.name}
|
|
869
869
|
</Text>
|
|
870
|
-
<
|
|
870
|
+
<IconOutline
|
|
871
871
|
accessibilityLabel={AccessibilityLabel.BUTTON_POPUP_RESOLVED_ICON}
|
|
872
872
|
name="check-circle"
|
|
873
873
|
size={42}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
2
2
|
import React, { useCallback, useContext } from 'react';
|
|
3
3
|
import {
|
|
4
4
|
Image,
|
|
@@ -59,7 +59,7 @@ const DrawerContainer = () => {
|
|
|
59
59
|
style={styles.avatar}
|
|
60
60
|
accessibilityLabel={AccessibilityLabel.SIDE_MENU_AVATAR_USER}
|
|
61
61
|
>
|
|
62
|
-
<
|
|
62
|
+
<IconOutline name={'user'} size={27} />
|
|
63
63
|
</View>
|
|
64
64
|
)}
|
|
65
65
|
<View style={styles.textContainer}>
|
|
@@ -116,7 +116,7 @@ export const Row = ({
|
|
|
116
116
|
]}
|
|
117
117
|
accessibilityLabel={accessibilityLabel}
|
|
118
118
|
>
|
|
119
|
-
<
|
|
119
|
+
<IconOutline name={image} size={24} />
|
|
120
120
|
|
|
121
121
|
<View style={styles.wrapText}>
|
|
122
122
|
<Text style={[styles.text]}>{name}</Text>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
4
|
import { useIsFocused, useNavigation } from '@react-navigation/native';
|
|
5
5
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
6
6
|
import { AlertAction, MenuActionList, Section } from '../../commons';
|
|
@@ -99,7 +99,7 @@ export const EmergencyContactsList = ({ route }) => {
|
|
|
99
99
|
: 'disable'
|
|
100
100
|
}
|
|
101
101
|
leftIcon={
|
|
102
|
-
<
|
|
102
|
+
<IconOutline name={'plus'} size={20} color={Colors.White} />
|
|
103
103
|
}
|
|
104
104
|
text={t('add_new')}
|
|
105
105
|
subtext={t('emergency_max_contacts', {
|
|
@@ -113,7 +113,7 @@ export const EmergencyContactsList = ({ route }) => {
|
|
|
113
113
|
key={contact.id}
|
|
114
114
|
index={index}
|
|
115
115
|
leftIcon={
|
|
116
|
-
<
|
|
116
|
+
<IconOutline name={'user'} size={20} color={Colors.White} />
|
|
117
117
|
}
|
|
118
118
|
text={contact.name}
|
|
119
119
|
subtext={contact.phone_number}
|
|
@@ -122,7 +122,11 @@ export const EmergencyContactsList = ({ route }) => {
|
|
|
122
122
|
style={styles.buttonRemove}
|
|
123
123
|
onPress={onPressRemoveContact(contact)}
|
|
124
124
|
>
|
|
125
|
-
<
|
|
125
|
+
<IconOutline
|
|
126
|
+
name={'minus'}
|
|
127
|
+
size={20}
|
|
128
|
+
color={Colors.Gray8}
|
|
129
|
+
/>
|
|
126
130
|
</TouchableOpacity>
|
|
127
131
|
}
|
|
128
132
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
4
|
import { useNavigation } from '@react-navigation/native';
|
|
5
5
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
6
6
|
import { Section, ViewButtonBottom } from '../../commons';
|
|
@@ -81,7 +81,7 @@ export const EmergencyContactsSelectContacts = ({ route }) => {
|
|
|
81
81
|
}
|
|
82
82
|
index={index}
|
|
83
83
|
leftIcon={
|
|
84
|
-
<
|
|
84
|
+
<IconOutline name={'user'} size={20} color={Colors.White} />
|
|
85
85
|
}
|
|
86
86
|
text={contact.name}
|
|
87
87
|
subtext={contact.phone_number}
|
|
@@ -91,7 +91,7 @@ export const EmergencyContactsSelectContacts = ({ route }) => {
|
|
|
91
91
|
{currentContacts.some(
|
|
92
92
|
(item) => item?.name === contact?.name
|
|
93
93
|
) && (
|
|
94
|
-
<
|
|
94
|
+
<IconOutline
|
|
95
95
|
name={'check-circle'}
|
|
96
96
|
size={20}
|
|
97
97
|
color={Colors.Primary}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react';
|
|
2
2
|
import { View, TouchableOpacity } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
4
|
|
|
5
5
|
import Text from '../../../commons/Text';
|
|
6
6
|
import styles from '../styles/DropDownItem';
|
|
@@ -29,7 +29,7 @@ const DropDownItem = ({ label, data, onSelectItem, isOpen, onOpen, index }) => {
|
|
|
29
29
|
<View style={styles.dropDownContainer}>
|
|
30
30
|
<TouchableOpacity style={styles.dropDownStyle} onPress={handleOnOpen}>
|
|
31
31
|
<Text>{selecteValue?.label}</Text>
|
|
32
|
-
<
|
|
32
|
+
<IconOutline name="caret-down" size={18} color={Colors.Gray8} />
|
|
33
33
|
</TouchableOpacity>
|
|
34
34
|
|
|
35
35
|
{isOpen && (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View, TouchableOpacity } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
4
|
import Text from '../../../commons/Text';
|
|
5
5
|
import styles from '../styles/indexStyles';
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ const RowGuestInfo = ({
|
|
|
19
19
|
<View style={styles.rowRight}>
|
|
20
20
|
<Text type="Body">{textRight}</Text>
|
|
21
21
|
{rightArrow && (
|
|
22
|
-
<
|
|
22
|
+
<IconOutline name="right" size={20} style={styles.icon} />
|
|
23
23
|
)}
|
|
24
24
|
</View>
|
|
25
25
|
</View>
|