@eohjsc/react-native-smart-city 0.7.3 → 0.7.4
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/assets/images/Automation-fill.svg +85 -0
- package/assets/images/Map/LocationPin.svg +10 -0
- package/assets/images/Scenario-filled.svg +22 -0
- package/assets/images/schedule-fill.svg +48 -0
- package/package.json +20 -17
- package/src/commons/Action/ItemQuickAction.js +1 -1
- package/src/commons/Action/__test__/ItemQuickAction.test.js +6 -6
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +5 -5
- 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/SliderRangeTemplate.js +7 -7
- 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/ThreeButtonTemplate/__test__/ThreeButtonCircle.test.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonDefault.test.js +2 -2
- package/src/commons/ActionGroup/TimerActionTemplate.js +6 -3
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
- package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +9 -10
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +5 -5
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +5 -5
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +8 -8
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +6 -6
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +1 -1
- package/src/commons/ActionGroup/__test__/index.test.js +6 -6
- package/src/commons/ActionGroup/index.js +2 -2
- package/src/commons/ActionTemplate/__test__/index.test.js +4 -4
- package/src/commons/Automate/ItemAutomate.js +9 -41
- package/src/commons/Automate/ItemConditionScriptDetail.js +109 -0
- package/src/commons/Automate/ItemConditionScriptDetailStyles.js +46 -0
- package/src/commons/Automate/__test__/ItemAutomate.test.js +0 -21
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/BottomButtonView/index.js +1 -0
- package/src/commons/ButtonPopup/index.js +3 -2
- package/src/commons/ChartAggregationOption/__test__/FourButtonFilterHistory.test.js +2 -2
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +8 -9
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +7 -7
- package/src/commons/DateTimeRangeChange/DateTimeButton.js +3 -3
- package/src/commons/DateTimeRangeChange/index.js +1 -1
- package/src/commons/Device/ConnectedViewHeader.js +2 -2
- package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +1 -1
- package/src/commons/Device/FlatListItems.js +20 -19
- package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -3
- package/src/commons/Device/HorizontalBarChart.js +54 -34
- package/src/commons/Device/ItemAddNew/index.js +2 -2
- package/src/commons/Device/ItemDevice.js +5 -21
- 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/FieldTemplate/PasscodeField/__test__/index.test.js +3 -3
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +6 -6
- package/src/commons/FlatListDnD/__test__/index.test.js +4 -4
- package/src/commons/FlatListDnD/index.js +12 -9
- package/src/commons/Grid/GridItem.js +10 -2
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +3 -3
- package/src/commons/Header/HeaderCustom.js +2 -2
- package/src/commons/Header/__test__/HeaderCT.test.js +3 -3
- package/src/commons/HeaderAni/index.js +2 -2
- package/src/commons/IconComponent/index.js +3 -3
- package/src/commons/ImagePicker/__test__/ImagePicker.test.js +5 -5
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +6 -4
- package/src/commons/MenuActionMore/MenuActionMoreStyles.js +2 -1
- package/src/commons/MenuActionMore/index.js +1 -1
- package/src/commons/NavBar/NavBarStyles.js +1 -1
- package/src/commons/NavBar/index.js +2 -2
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +1 -1
- package/src/commons/Popover/__test__/index.test.js +3 -3
- package/src/commons/Processing/__test__/Connecting.test.js +4 -4
- 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/SelectUnit/__test__/SelectUnit.test.js +5 -5
- 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 +6 -7
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +0 -2
- package/src/commons/SubUnit/OneTap/index.js +9 -8
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +8 -8
- package/src/commons/Unit/HeaderUnit/index.js +30 -22
- package/src/commons/Unit/SharedUnit.js +7 -7
- package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +9 -13
- package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +34 -2
- package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +88 -8
- package/src/commons/WrapParallaxScrollView/index.js +9 -10
- package/src/configs/API.js +1 -1
- package/src/configs/AccessibilityLabel.js +1 -0
- package/src/configs/Constants.js +3 -3
- package/src/configs/Theme.js +1 -1
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +5 -5
- package/src/hooks/IoT/__test__/useHomeAssistantConnection.test.js +12 -12
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +14 -7
- package/src/hooks/IoT/__test__/useWatchConfigs.test.js +3 -3
- package/src/hooks/IoT/useRemoteControl.js +24 -13
- package/src/hooks/useMqtt.js +2 -2
- package/src/iot/RemoteControl/Bluetooth.js +19 -22
- package/src/iot/RemoteControl/Internet.js +13 -5
- package/src/iot/RemoteControl/__test__/Internet.test.js +7 -7
- package/src/navigations/EmergencyContactsStack.js +4 -3
- package/src/navigations/SharedStack.js +2 -0
- package/src/navigations/UnitStack.js +56 -57
- package/src/screens/AQIGuide/index.js +0 -2
- package/src/screens/ActivityLog/index.js +2 -2
- package/src/screens/AddLocationMaps/__test__/index.test.js +12 -12
- package/src/screens/AddLocationMaps/index.js +16 -19
- package/src/screens/AddLocationMaps/indexStyle.js +1 -0
- package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
- package/src/screens/AddNewGateway/SelectDeviceType.js +1 -1
- package/src/screens/AddNewGateway/ShareWifiPassword.js +16 -15
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -7
- package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +8 -8
- package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +7 -7
- package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +8 -8
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +5 -5
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +4 -4
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -6
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -6
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +0 -4
- package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +2 -2
- package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +19 -17
- package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +19 -17
- package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +18 -16
- package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +43 -35
- package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +38 -22
- package/src/screens/AllGateway/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/components/Detail/__test__/index.test.js +3 -5
- package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +3 -3
- package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/hooks/__test__/index.test.js +2 -2
- package/src/screens/AllGateway/test-utils.js +3 -4
- 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 +8 -8
- package/src/screens/Automate/AddNewAction/SelectControlDevices.js +30 -20
- package/src/screens/Automate/AddNewAction/SelectMonitorDevices.js +17 -10
- package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +58 -44
- package/src/screens/Automate/AddNewAction/SetupScriptDelay.js +1 -1
- package/src/screens/Automate/AddNewAction/SetupScriptNotify.js +3 -3
- package/src/screens/Automate/AddNewAction/Styles/SetupSensorStyles.js +20 -4
- package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +12 -12
- package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +14 -8
- package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +13 -7
- package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +54 -15
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptDelay.test.js +9 -9
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +39 -10
- package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +10 -10
- package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +13 -8
- package/src/screens/Automate/Components/InputName.js +10 -7
- package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +8 -8
- package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +6 -6
- package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +7 -7
- package/src/screens/Automate/EditActionsList/index.js +19 -17
- package/src/screens/Automate/MultiUnits.js +19 -22
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +18 -8
- package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +15 -7
- package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +14 -6
- package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +4 -7
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +42 -17
- package/src/screens/Automate/ScriptDetail/__test__/useStarredScript.test.js +6 -6
- package/src/screens/Automate/ScriptDetail/index.js +51 -40
- package/src/screens/Automate/SetSchedule/__test__/SelectWeekday.test.js +4 -4
- package/src/screens/Automate/SetSchedule/__test__/index.test.js +29 -18
- package/src/screens/Automate/SetSchedule/components/RowItem.js +5 -5
- package/src/screens/Automate/SetSchedule/index.js +8 -7
- package/src/screens/Automate/Styles/indexStyles.js +1 -1
- package/src/screens/Automate/__test__/MultiUnits.test.js +1 -4
- package/src/screens/Automate/__test__/index.test.js +0 -1
- package/src/screens/Automate/index.js +36 -34
- package/src/screens/ChangePosition/__test__/index.test.js +6 -6
- package/src/screens/ChangePosition/index.js +2 -1
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +13 -13
- package/src/screens/Device/EditDevice/index.js +4 -4
- package/src/screens/Device/__test__/BluetoothDevice.test.js +300 -0
- package/src/screens/Device/__test__/detail.test.js +14 -14
- package/src/screens/Device/__test__/mqttDetail.test.js +9 -9
- package/src/screens/Device/components/BluetoothDevice.js +135 -0
- package/src/screens/Device/components/SensorDisplayItem.js +9 -8
- package/src/screens/Device/detail.js +70 -62
- package/src/screens/Device/hooks/useEvaluateValue.js +1 -1
- package/src/screens/Drawer/Drawer.test.js +2 -2
- 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/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -7
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +8 -8
- package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
- package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +3 -3
- 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/__test__/Detail.test.js +9 -9
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -10
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
- package/src/screens/ManageAccess/index.js +3 -3
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +9 -9
- package/src/screens/Notification/__test__/Notification.test.js +9 -9
- package/src/screens/Notification/components/NotificationItem.js +3 -4
- package/src/screens/Notification/index.js +3 -3
- package/src/screens/Notification/styles/NotificationItemStyles.js +0 -1
- package/src/screens/PlayBackCamera/__test__/index.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
- package/src/screens/SelectUnit/__test__/index.test.js +8 -8
- package/src/screens/SelectUnit/index.js +4 -4
- 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/Sharing/__test__/UpdateShareDevice.test.js +7 -7
- package/src/screens/SideMenuDetail/__test__/index.test.js +8 -8
- package/src/screens/SmartAccount/Connecting/index.js +5 -5
- package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +8 -8
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +7 -7
- package/src/screens/SmartAccount/SuccessfullyConnected/index.js +2 -2
- package/src/screens/SmartAccount/__test__/Connecting.test.js +6 -6
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +10 -10
- 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/AddSubUnit.js +28 -26
- package/src/screens/SubUnit/AddSubUnitStyles.js +10 -4
- package/src/screens/SubUnit/EditSubUnit.js +12 -11
- package/src/screens/SubUnit/ManageSubUnit.js +3 -3
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +13 -13
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +3 -3
- package/src/screens/Template/EditTemplate.js +6 -4
- package/src/screens/Template/__test__/EditTemplate.test.js +7 -7
- package/src/screens/Template/__test__/detail.test.js +4 -4
- package/src/screens/Template/__test__/index.test.js +1 -1
- package/src/screens/UVIndexGuide/index.js +2 -4
- package/src/screens/Unit/Detail.js +1 -5
- package/src/screens/Unit/MoreMenu.js +6 -5
- package/src/screens/Unit/SelectAddToFavorites.js +2 -2
- package/src/screens/Unit/SelectAddress.js +16 -12
- package/src/screens/Unit/Station/__test__/index.test.js +1 -1
- package/src/screens/Unit/__test__/MoreMenu.test.js +5 -1
- package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +9 -9
- package/src/screens/Unit/__test__/SelectAddress.test.js +11 -17
- package/src/screens/Unit/__test__/Summaries.test.js +7 -7
- package/src/screens/Unit/components/AutomateScript/index.js +5 -5
- 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/Unit/components/__test__/AutomateScript.test.js +3 -3
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +8 -8
- package/src/screens/Unit/hook/__test__/useUnitConnectRemoteDevices.test.js +2 -2
- package/src/screens/UnitSummary/components/AirQuality/index.js +6 -11
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +5 -5
- package/src/screens/UnitSummary/index.js +6 -2
- package/src/utils/Apis/axios.js +5 -5
- package/src/utils/Functions/ShortEmail.js +1 -0
- package/src/utils/I18n/translations/en.js +6 -3
- package/src/utils/I18n/translations/vi.js +8 -4
- package/src/utils/__test__/Utils.test.js +16 -16
- package/src/utils/bluetooth.js +3 -0
- package/assets/images/OneTap.svg +0 -14
- package/assets/images/Schedule.svg +0 -39
- package/assets/images/ValueChange.svg +0 -49
|
@@ -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
|
|
|
@@ -60,6 +60,7 @@ import { useReceiveNotifications } from '../../hooks';
|
|
|
60
60
|
import useChipJsonConfiguration, {
|
|
61
61
|
useConnectChipMqtt,
|
|
62
62
|
} from '../../hooks/useMqtt';
|
|
63
|
+
import { useBluetoothDevice } from './components/BluetoothDevice';
|
|
63
64
|
|
|
64
65
|
const DeviceDetail = ({ route }) => {
|
|
65
66
|
const configIdsTemp = useRef([]);
|
|
@@ -81,13 +82,14 @@ const DeviceDetail = ({ route }) => {
|
|
|
81
82
|
});
|
|
82
83
|
const [lastEvent, setLastEvent] = useState({ id: 0, reportedAt: 0 });
|
|
83
84
|
|
|
84
|
-
const { unitData, unitId,
|
|
85
|
+
const { unitData, unitId, sensorId, sensorData, isMyUnitDeviceScreen } =
|
|
85
86
|
route?.params || {};
|
|
87
|
+
|
|
86
88
|
const [unit, setUnit] = useState(unitData || { id: unitId });
|
|
87
|
-
const [
|
|
88
|
-
const [station, setStation] = useState(
|
|
89
|
+
const [device, setDevice] = useState(sensorData || { id: sensorId });
|
|
90
|
+
const [station, setStation] = useState(device?.station);
|
|
89
91
|
const { isOwner } = useIsOwnerOfUnit(unit?.user_id);
|
|
90
|
-
const [sensorName, setSensorName] = useState(
|
|
92
|
+
const [sensorName, setSensorName] = useState(device?.name);
|
|
91
93
|
const [lockShowing, acquireLockShowing, releaseLockShowing] = useBoolean();
|
|
92
94
|
const [showPreventAccess, setShowPreventAccess, setHidePreventAccess] =
|
|
93
95
|
useBoolean(false);
|
|
@@ -112,15 +114,15 @@ const DeviceDetail = ({ route }) => {
|
|
|
112
114
|
});
|
|
113
115
|
|
|
114
116
|
const { isConnected: isEoHBackendConnected } =
|
|
115
|
-
useEoHBackendDeviceConnected(
|
|
117
|
+
useEoHBackendDeviceConnected(device);
|
|
116
118
|
|
|
117
119
|
const {
|
|
118
120
|
isConnected: isHomeAssistantConnected,
|
|
119
121
|
isConnecting: isHomeAssistantConnecting,
|
|
120
|
-
} = useHomeAssistantDeviceConnected(
|
|
122
|
+
} = useHomeAssistantDeviceConnected(device);
|
|
121
123
|
|
|
122
124
|
const { isConnected: isBluetoothConnected } =
|
|
123
|
-
useBluetoothDeviceConnected(
|
|
125
|
+
useBluetoothDeviceConnected(device);
|
|
124
126
|
|
|
125
127
|
const isDeviceHasBle = useMemo(() => {
|
|
126
128
|
if (display.items.length === 0) {
|
|
@@ -147,11 +149,11 @@ const DeviceDetail = ({ route }) => {
|
|
|
147
149
|
const { chips } = useChipJsonConfiguration(unit?.id);
|
|
148
150
|
|
|
149
151
|
const chipFiltered = useMemo(() => {
|
|
150
|
-
return chips?.filter((item) => item?.id ===
|
|
151
|
-
}, [chips,
|
|
152
|
+
return chips?.filter((item) => item?.id === device?.chip_id);
|
|
153
|
+
}, [chips, device?.chip_id]);
|
|
152
154
|
|
|
153
155
|
const { mqttConfigs } = useConnectChipMqtt(chipFiltered);
|
|
154
|
-
useDeviceWatchConfigControl(
|
|
156
|
+
useDeviceWatchConfigControl(device, display, mqttConfigs);
|
|
155
157
|
|
|
156
158
|
const isShowSetupEmergencyContact = useMemo(
|
|
157
159
|
() =>
|
|
@@ -171,7 +173,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
171
173
|
);
|
|
172
174
|
|
|
173
175
|
const { isFavorite, addToFavorites, removeFromFavorites } =
|
|
174
|
-
useFavoriteDevice(
|
|
176
|
+
useFavoriteDevice(device);
|
|
175
177
|
|
|
176
178
|
const currentUserId = useSCContextSelector(
|
|
177
179
|
(state) => state.auth.account.user.id
|
|
@@ -181,6 +183,8 @@ const DeviceDetail = ({ route }) => {
|
|
|
181
183
|
return Number(currentUserId) === Number(unit?.user_id);
|
|
182
184
|
}, [currentUserId, unit]);
|
|
183
185
|
|
|
186
|
+
const bluetoothDevice = useBluetoothDevice(device);
|
|
187
|
+
|
|
184
188
|
const fetchUnitDetail = useCallback(async () => {
|
|
185
189
|
const { success, data } = await axiosGet(API.UNIT.UNIT_DETAIL(unitId));
|
|
186
190
|
if (success) {
|
|
@@ -233,43 +237,40 @@ const DeviceDetail = ({ route }) => {
|
|
|
233
237
|
|
|
234
238
|
const fetchSensorDetail = useCallback(async () => {
|
|
235
239
|
const { success, data, resp_status } = await axiosGet(
|
|
236
|
-
API.DEVICE.
|
|
240
|
+
API.DEVICE.DEVICE_DETAIL(sensorId || sensorData?.id)
|
|
237
241
|
);
|
|
238
242
|
if (success) {
|
|
239
|
-
|
|
243
|
+
setDevice(data);
|
|
240
244
|
setSensorName(data.name);
|
|
241
245
|
setStation(data.station);
|
|
242
246
|
} else if (resp_status === 404) {
|
|
243
247
|
setShowPreventAccess();
|
|
244
248
|
}
|
|
245
|
-
}, [
|
|
249
|
+
}, [sensorId, sensorData?.id, setShowPreventAccess]);
|
|
246
250
|
|
|
247
251
|
useEffect(() => {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
252
|
-
}, [sensorId, sensorData]);
|
|
252
|
+
fetchSensorDetail();
|
|
253
|
+
}, [fetchSensorDetail]);
|
|
253
254
|
|
|
254
255
|
const fetchRemoteControlOptions = useCallback(async () => {
|
|
255
256
|
const { success, data } = await axiosGet(
|
|
256
|
-
API.DEVICE.REMOTE_CONTROL_OPTIONS(
|
|
257
|
+
API.DEVICE.REMOTE_CONTROL_OPTIONS(device?.id),
|
|
257
258
|
{},
|
|
258
259
|
true
|
|
259
260
|
);
|
|
260
261
|
success && setControlOptions(data);
|
|
261
|
-
}, [
|
|
262
|
+
}, [device]);
|
|
262
263
|
|
|
263
264
|
const fetchDataDeviceDetail = useCallback(async () => {
|
|
264
265
|
if (!token) {
|
|
265
266
|
return;
|
|
266
267
|
}
|
|
267
|
-
if (!
|
|
268
|
+
if (!device) {
|
|
268
269
|
return;
|
|
269
270
|
}
|
|
270
271
|
|
|
271
272
|
const { success, data } = await axiosGet(
|
|
272
|
-
API.DEVICE.DISPLAY(
|
|
273
|
+
API.DEVICE.DISPLAY(device?.id),
|
|
273
274
|
{},
|
|
274
275
|
true
|
|
275
276
|
);
|
|
@@ -302,7 +303,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
302
303
|
(item) => item.template.toLowerCase().search('action') !== -1
|
|
303
304
|
) &&
|
|
304
305
|
(await fetchRemoteControlOptions());
|
|
305
|
-
}, [token,
|
|
306
|
+
}, [token, device, setDeviceId, fetchRemoteControlOptions]);
|
|
306
307
|
|
|
307
308
|
const {
|
|
308
309
|
deviceId: emergencyDeviceId,
|
|
@@ -336,7 +337,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
336
337
|
menuItems.push({
|
|
337
338
|
route: Routes.ActivityLog,
|
|
338
339
|
data: {
|
|
339
|
-
id:
|
|
340
|
+
id: device?.id,
|
|
340
341
|
type: 'action',
|
|
341
342
|
share: unit,
|
|
342
343
|
filterEnabled: {
|
|
@@ -352,21 +353,21 @@ const DeviceDetail = ({ route }) => {
|
|
|
352
353
|
text: t('edit'),
|
|
353
354
|
route: Routes.EditDevice,
|
|
354
355
|
data: {
|
|
355
|
-
sensor,
|
|
356
|
+
sensor: device,
|
|
356
357
|
setSensorNameDetail: setSensorName,
|
|
357
358
|
sensorNameDetail: sensorName,
|
|
358
|
-
setSensorDetail:
|
|
359
|
+
setSensorDetail: setDevice,
|
|
359
360
|
},
|
|
360
361
|
});
|
|
361
362
|
menuItems.push({
|
|
362
363
|
route: Routes.ManageAccess,
|
|
363
|
-
data: { unit, sensor },
|
|
364
|
+
data: { unit, sensor: device },
|
|
364
365
|
text: t('manage_access'),
|
|
365
366
|
});
|
|
366
367
|
menuItems.push({
|
|
367
368
|
route: Routes.ChangePosition,
|
|
368
369
|
data: {
|
|
369
|
-
sensor,
|
|
370
|
+
sensor: device,
|
|
370
371
|
display,
|
|
371
372
|
setDisplay,
|
|
372
373
|
evaluate,
|
|
@@ -378,7 +379,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
378
379
|
menuItems.push({
|
|
379
380
|
text: t('move_to_another_sub_unit'),
|
|
380
381
|
route: Routes.MoveToAnotherSubUnit,
|
|
381
|
-
data: { unit, sensor, station, isMyUnitDeviceScreen },
|
|
382
|
+
data: { unit, sensor: device, station, isMyUnitDeviceScreen },
|
|
382
383
|
});
|
|
383
384
|
}
|
|
384
385
|
if (isShowSetupEmergencyContact) {
|
|
@@ -401,7 +402,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
401
402
|
route: Routes.SideMenuDetail,
|
|
402
403
|
data: {
|
|
403
404
|
unit,
|
|
404
|
-
sensor,
|
|
405
|
+
sensor: device,
|
|
405
406
|
side_menu: el,
|
|
406
407
|
},
|
|
407
408
|
text: el.name,
|
|
@@ -462,7 +463,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
462
463
|
t,
|
|
463
464
|
isShowSetUpSmartLock,
|
|
464
465
|
isFavorite,
|
|
465
|
-
|
|
466
|
+
device,
|
|
466
467
|
unit,
|
|
467
468
|
sensorName,
|
|
468
469
|
evaluate,
|
|
@@ -479,11 +480,11 @@ const DeviceDetail = ({ route }) => {
|
|
|
479
480
|
|
|
480
481
|
useEffect(() => {
|
|
481
482
|
fetchDataDeviceDetail();
|
|
482
|
-
}, [
|
|
483
|
+
}, [device, isNetworkConnected, fetchDataDeviceDetail]);
|
|
483
484
|
|
|
484
|
-
const onRefresh = useCallback(() => {
|
|
485
|
-
fetchSensorDetail();
|
|
486
|
-
fetchDataDeviceDetail();
|
|
485
|
+
const onRefresh = useCallback(async () => {
|
|
486
|
+
await fetchSensorDetail();
|
|
487
|
+
await fetchDataDeviceDetail();
|
|
487
488
|
if (
|
|
488
489
|
unit.remote_control_options &&
|
|
489
490
|
unit.remote_control_options.googlehome?.length &&
|
|
@@ -493,9 +494,15 @@ const DeviceDetail = ({ route }) => {
|
|
|
493
494
|
await connectHomeAssistant(unit.remote_control_options.googlehome);
|
|
494
495
|
})();
|
|
495
496
|
}
|
|
496
|
-
checkScanDevicesBLE();
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
await checkScanDevicesBLE();
|
|
498
|
+
}, [
|
|
499
|
+
fetchSensorDetail,
|
|
500
|
+
fetchDataDeviceDetail,
|
|
501
|
+
unit?.remote_control_options,
|
|
502
|
+
isNetworkConnected,
|
|
503
|
+
checkScanDevicesBLE,
|
|
504
|
+
connectHomeAssistant,
|
|
505
|
+
]);
|
|
499
506
|
|
|
500
507
|
useFocusEffect(
|
|
501
508
|
useCallback(() => {
|
|
@@ -537,7 +544,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
537
544
|
|
|
538
545
|
const fetchValues = async () => {
|
|
539
546
|
const { success, data, resp_status } = await axiosGet(
|
|
540
|
-
API.DEVICE.DISPLAY_VALUES_V2(
|
|
547
|
+
API.DEVICE.DISPLAY_VALUES_V2(device?.id),
|
|
541
548
|
{
|
|
542
549
|
params: params,
|
|
543
550
|
}
|
|
@@ -557,7 +564,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
557
564
|
setDisplayValuesData((prevState) => {
|
|
558
565
|
if (prevState.isConnected !== data.is_connected) {
|
|
559
566
|
setAction(Action.SET_DEVICES_STATUS, [
|
|
560
|
-
{ id:
|
|
567
|
+
{ id: device?.id, is_connected: data.is_connected },
|
|
561
568
|
]);
|
|
562
569
|
}
|
|
563
570
|
const lastUpdated = data.last_updated && moment(data.last_updated);
|
|
@@ -603,16 +610,16 @@ const DeviceDetail = ({ route }) => {
|
|
|
603
610
|
};
|
|
604
611
|
if (
|
|
605
612
|
isNetworkConnected &&
|
|
606
|
-
|
|
607
|
-
|
|
613
|
+
device?.is_managed_by_backend &&
|
|
614
|
+
device?.device_type !== DEVICE_TYPE.LG_THINQ
|
|
608
615
|
) {
|
|
609
616
|
fetchValues();
|
|
610
617
|
} else {
|
|
611
|
-
Object.keys(
|
|
618
|
+
Object.keys(device).length > 1 &&
|
|
612
619
|
setLoading((preState) => ({ ...preState, isConnected: false }));
|
|
613
620
|
}
|
|
614
621
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
615
|
-
}, [display.items, isNetworkConnected,
|
|
622
|
+
}, [display.items, isNetworkConnected, device, mqttConfigs])
|
|
616
623
|
);
|
|
617
624
|
|
|
618
625
|
useWatchConfigs(chipFiltered.length ? [] : configIdsTemp.current);
|
|
@@ -638,12 +645,12 @@ const DeviceDetail = ({ route }) => {
|
|
|
638
645
|
|
|
639
646
|
const getDataFromLocal = async () => {
|
|
640
647
|
const displayData = await getLocalData(
|
|
641
|
-
`@CACHE_REQUEST_${API.DEVICE.DISPLAY(
|
|
648
|
+
`@CACHE_REQUEST_${API.DEVICE.DISPLAY(device?.id)}`
|
|
642
649
|
);
|
|
643
650
|
displayData && setDisplay(JSON.parse(displayData));
|
|
644
651
|
|
|
645
652
|
const controlOptionData = await getLocalData(
|
|
646
|
-
`@CACHE_REQUEST_${API.DEVICE.REMOTE_CONTROL_OPTIONS(
|
|
653
|
+
`@CACHE_REQUEST_${API.DEVICE.REMOTE_CONTROL_OPTIONS(device?.id)}`
|
|
647
654
|
);
|
|
648
655
|
controlOptionData && setControlOptions(JSON.parse(controlOptionData));
|
|
649
656
|
setLoading((preState) => ({ ...preState, displayTemplate: false }));
|
|
@@ -685,9 +692,9 @@ const DeviceDetail = ({ route }) => {
|
|
|
685
692
|
>
|
|
686
693
|
<View style={styles.buttonStar}>
|
|
687
694
|
{isFavorite ? (
|
|
688
|
-
<
|
|
695
|
+
<IconFill name="star" size={25} color={Colors.Yellow6} />
|
|
689
696
|
) : (
|
|
690
|
-
<
|
|
697
|
+
<IconOutline name="star" size={25} />
|
|
691
698
|
)}
|
|
692
699
|
</View>
|
|
693
700
|
</TouchableOpacity>
|
|
@@ -695,7 +702,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
695
702
|
{isShowSetupEmergencyContact && (
|
|
696
703
|
<TouchableOpacity onPress={onPressSetting}>
|
|
697
704
|
<View style={styles.button}>
|
|
698
|
-
<
|
|
705
|
+
<IconOutline name="setting" size={25} color={Colors.Black} />
|
|
699
706
|
</View>
|
|
700
707
|
</TouchableOpacity>
|
|
701
708
|
)}
|
|
@@ -721,8 +728,8 @@ const DeviceDetail = ({ route }) => {
|
|
|
721
728
|
);
|
|
722
729
|
|
|
723
730
|
useEffect(() => {
|
|
724
|
-
SCConfig.setCurrentSensorDisplay(
|
|
725
|
-
}, [
|
|
731
|
+
SCConfig.setCurrentSensorDisplay(device);
|
|
732
|
+
}, [device]);
|
|
726
733
|
|
|
727
734
|
const shouldRender =
|
|
728
735
|
loading.displayTemplate === false &&
|
|
@@ -740,7 +747,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
740
747
|
<View style={styles.wrapTemplate}>
|
|
741
748
|
{shouldRender && (
|
|
742
749
|
<SensorConnectStatusViewHeader
|
|
743
|
-
sensor={
|
|
750
|
+
sensor={device}
|
|
744
751
|
connectedViaNetwork={isEoHBackendConnected}
|
|
745
752
|
connectedViaBle={isBluetoothConnected}
|
|
746
753
|
connectedViaHomeAssistant={isHomeAssistantConnected}
|
|
@@ -751,7 +758,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
751
758
|
}
|
|
752
759
|
showWindDirection={showWindDirection}
|
|
753
760
|
isDeviceHasBle={isDeviceHasBle}
|
|
754
|
-
key={`sensor${
|
|
761
|
+
key={`sensor${device.id}`}
|
|
755
762
|
>
|
|
756
763
|
{display.items.map((item, index) => {
|
|
757
764
|
return (
|
|
@@ -773,7 +780,8 @@ const DeviceDetail = ({ route }) => {
|
|
|
773
780
|
item={item}
|
|
774
781
|
evaluate={evaluate}
|
|
775
782
|
emergency={onEmergencyButtonPress}
|
|
776
|
-
sensor={
|
|
783
|
+
sensor={device}
|
|
784
|
+
bluetoothDevice={bluetoothDevice}
|
|
777
785
|
offsetTitle={offsetTitle}
|
|
778
786
|
setOffsetTitle={setOffsetTitle}
|
|
779
787
|
setShowWindDirection={setShowWindDirection}
|
|
@@ -792,7 +800,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
792
800
|
<BottomButtonView
|
|
793
801
|
style={styles.bottomButtonEmergencyContact}
|
|
794
802
|
mainIcon={
|
|
795
|
-
<
|
|
803
|
+
<IconOutline name="plus" size={16} color={Colors.Primary} />
|
|
796
804
|
}
|
|
797
805
|
mainTitle={t('setup_my_emergency_contact')}
|
|
798
806
|
onPressMain={onSetupContacts}
|
|
@@ -807,7 +815,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
807
815
|
onSendNowAlert={onSendNowAlert}
|
|
808
816
|
onHide={releaseLockShowing}
|
|
809
817
|
unit={unit}
|
|
810
|
-
station={
|
|
818
|
+
station={device?.station}
|
|
811
819
|
/>
|
|
812
820
|
|
|
813
821
|
<AlertSent
|
|
@@ -816,7 +824,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
816
824
|
onPressMain={onViewDetails}
|
|
817
825
|
onHide={releaseLockShowing}
|
|
818
826
|
unit={unit}
|
|
819
|
-
station={
|
|
827
|
+
station={device?.station}
|
|
820
828
|
/>
|
|
821
829
|
<PreventAccess
|
|
822
830
|
visible={showPreventAccess}
|
|
@@ -827,7 +835,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
827
835
|
{isShowEmergencyResolve && !isEmergencyPopupScreen && (
|
|
828
836
|
<BottomButtonView
|
|
829
837
|
style={styles.bottomButtonEmergencyResolve}
|
|
830
|
-
mainIcon={<
|
|
838
|
+
mainIcon={<IconOutline name="tool" size={15} color={Colors.Gray6} />}
|
|
831
839
|
mainTitle={t('resolve_situation')}
|
|
832
840
|
onPressMain={onPressResolveSituationConfirm}
|
|
833
841
|
topComponent={
|
|
@@ -865,9 +873,9 @@ const DeviceDetail = ({ route }) => {
|
|
|
865
873
|
type="H4"
|
|
866
874
|
style={styles.textName}
|
|
867
875
|
>
|
|
868
|
-
{unit?.name} - {
|
|
876
|
+
{unit?.name} - {device?.station?.name}
|
|
869
877
|
</Text>
|
|
870
|
-
<
|
|
878
|
+
<IconOutline
|
|
871
879
|
accessibilityLabel={AccessibilityLabel.BUTTON_POPUP_RESOLVED_ICON}
|
|
872
880
|
name="check-circle"
|
|
873
881
|
size={42}
|
|
@@ -129,7 +129,7 @@ export const useGetEvaluateValue = (configId, unitId) => {
|
|
|
129
129
|
if (configId && valueEvaluations[configId] === undefined) {
|
|
130
130
|
(async () => {
|
|
131
131
|
const { success, data } = await axiosGet(API.VALUE_EVALUATIONS(), {
|
|
132
|
-
configs__id: configId,
|
|
132
|
+
params: { configs__id: configId },
|
|
133
133
|
});
|
|
134
134
|
if (success) {
|
|
135
135
|
setAction(Action.INIT_VALUE_EVALUATIONS, {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import renderer, { act } from 'react-test-renderer';
|
|
3
4
|
import AccessibilityLabel from '../../configs/AccessibilityLabel';
|
|
4
5
|
import { SCProvider } from '../../context';
|
|
5
6
|
import { mockSCStore } from '../../context/mockStore';
|
|
6
7
|
import Drawer, { Row } from './index';
|
|
7
|
-
import { useNavigation } from '@react-navigation/native';
|
|
8
8
|
|
|
9
9
|
const wrapComponent = (initState = mockSCStore({})) => (
|
|
10
10
|
<SCProvider initState={initState}>
|
|
@@ -35,7 +35,7 @@ describe('Drawer', () => {
|
|
|
35
35
|
await act(async () => {
|
|
36
36
|
await rows[2].props.onPress();
|
|
37
37
|
});
|
|
38
|
-
expect(dispatch).
|
|
38
|
+
expect(dispatch).toHaveBeenCalledWith({
|
|
39
39
|
payload: { index: 0, routes: [{ name: 'Main' }] },
|
|
40
40
|
type: 'RESET',
|
|
41
41
|
});
|
|
@@ -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,16 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { act, create } from 'react-test-renderer';
|
|
3
1
|
import MockAdapter from 'axios-mock-adapter';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import Toast from 'react-native-toast-message';
|
|
4
|
+
import { act, create } from 'react-test-renderer';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ViewButtonBottom } from '../../../commons';
|
|
7
|
+
import { API } from '../../../configs';
|
|
7
8
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
8
9
|
import { SCProvider } from '../../../context';
|
|
9
10
|
import { mockSCStore } from '../../../context/mockStore';
|
|
10
|
-
import { API } from '../../../configs';
|
|
11
|
-
import { ViewButtonBottom } from '../../../commons';
|
|
12
11
|
import api from '../../../utils/Apis/axios';
|
|
13
12
|
import { getTranslate } from '../../../utils/I18n';
|
|
13
|
+
import { EmergencyContactsSelectContacts } from '../EmergencyContactsSelectContacts';
|
|
14
14
|
|
|
15
15
|
const mock = new MockAdapter(api.axiosInstance);
|
|
16
16
|
|
|
@@ -79,7 +79,7 @@ describe('test EmergencyContactsSelectContacts', () => {
|
|
|
79
79
|
await act(async () => {
|
|
80
80
|
viewButtonBottom.props.onRightClick();
|
|
81
81
|
});
|
|
82
|
-
expect(Toast.show).
|
|
82
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
83
83
|
type: 'success',
|
|
84
84
|
position: 'bottom',
|
|
85
85
|
text1: getTranslate('en', 'saving_contact_successful'),
|
|
@@ -98,7 +98,7 @@ describe('test EmergencyContactsSelectContacts', () => {
|
|
|
98
98
|
await act(async () => {
|
|
99
99
|
viewButtonBottom.props.onRightClick();
|
|
100
100
|
});
|
|
101
|
-
expect(Toast.show).
|
|
101
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
102
102
|
type: 'error',
|
|
103
103
|
position: 'bottom',
|
|
104
104
|
text1: getTranslate('en', 'create_contact_failed'),
|
|
@@ -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,15 +1,15 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
3
|
import { TouchableOpacity } from 'react-native';
|
|
4
|
-
import
|
|
4
|
+
import { act, create } from 'react-test-renderer';
|
|
5
5
|
|
|
6
|
+
import { useNavigation } from '@react-navigation/native';
|
|
7
|
+
import { API } from '../../../configs';
|
|
8
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
6
9
|
import { SCProvider } from '../../../context';
|
|
7
10
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
|
-
import EnterPassword from '../index';
|
|
9
|
-
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
10
|
-
import { API } from '../../../configs';
|
|
11
11
|
import api from '../../../utils/Apis/axios';
|
|
12
|
-
import
|
|
12
|
+
import EnterPassword from '../index';
|
|
13
13
|
|
|
14
14
|
const mock = new MockAdapter(api.axiosInstance);
|
|
15
15
|
|
|
@@ -103,7 +103,7 @@ describe('Test EnterPassword', () => {
|
|
|
103
103
|
await act(async () => {
|
|
104
104
|
await button[0].props.onPress();
|
|
105
105
|
});
|
|
106
|
-
expect(navigate).
|
|
106
|
+
expect(navigate).toHaveBeenCalled();
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
it('test EnterPassword button failure', async () => {
|
|
@@ -125,6 +125,6 @@ describe('Test EnterPassword', () => {
|
|
|
125
125
|
await act(async () => {
|
|
126
126
|
await button[0].props.onPress();
|
|
127
127
|
});
|
|
128
|
-
expect(navigate).not.
|
|
128
|
+
expect(navigate).not.toHaveBeenCalled();
|
|
129
129
|
});
|
|
130
130
|
});
|
|
@@ -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>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { act, create } from 'react-test-renderer';
|
|
3
3
|
|
|
4
|
+
import BottomSheet from '../../../../commons/BottomSheet';
|
|
4
5
|
import { SCProvider } from '../../../../context';
|
|
5
6
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
7
|
import AccessScheduleSheet from '../AccessScheduleSheet';
|
|
7
|
-
import BottomSheet from '../../../../commons/BottomSheet';
|
|
8
8
|
|
|
9
9
|
const wrapComponent = (props) => (
|
|
10
10
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -47,6 +47,6 @@ describe('AccessScheduleSheet', () => {
|
|
|
47
47
|
await act(async () => {
|
|
48
48
|
bottomSheet[0].props.onBackdropPress();
|
|
49
49
|
});
|
|
50
|
-
expect(mockOnHide).
|
|
50
|
+
expect(mockOnHide).toHaveBeenCalled();
|
|
51
51
|
});
|
|
52
52
|
});
|