@eohjsc/react-native-smart-city 0.7.3-rc2 → 0.7.3-rc20
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 +17 -15
- 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/ActionTemplate/__test__/index.test.js +4 -4
- package/src/commons/Automate/ItemAutomate.js +8 -7
- package/src/commons/Automate/__test__/ItemAutomate.test.js +2 -2
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/ButtonPopup/index.js +2 -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/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 +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/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/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 +3 -4
- 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 +3 -3
- package/src/commons/Unit/SharedUnit.js +7 -7
- package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +9 -13
- 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__/useWatchConfigs.test.js +3 -3
- package/src/hooks/IoT/useRemoteControl.js +6 -6
- package/src/hooks/useMqtt.js +2 -2
- package/src/iot/RemoteControl/Internet.js +2 -2
- 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 +55 -54
- 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 +15 -15
- 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 +13 -13
- 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 +42 -34
- 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 +12 -11
- 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 -9
- 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 +3 -1
- package/src/screens/Automate/ScriptDetail/__test__/useStarredScript.test.js +6 -6
- package/src/screens/Automate/ScriptDetail/index.js +48 -38
- 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 +9 -9
- package/src/screens/Device/EditDevice/index.js +2 -2
- 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/SensorDisplayItem.js +5 -5
- package/src/screens/Device/detail.js +7 -7
- 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 +2 -4
- package/src/screens/SubUnit/EditSubUnit.js +2 -2
- package/src/screens/SubUnit/ManageSubUnit.js +3 -3
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -11
- 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/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__/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 +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/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 +6 -6
- package/src/screens/UnitSummary/index.js +3 -3
- package/src/utils/I18n/translations/en.js +3 -1
- package/src/utils/I18n/translations/vi.js +5 -2
- package/src/utils/__test__/Utils.test.js +16 -16
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import Toast from 'react-native-toast-message';
|
|
2
1
|
import MockAdapter from 'axios-mock-adapter';
|
|
3
|
-
import
|
|
4
|
-
import api from '../../../utils/Apis/axios';
|
|
2
|
+
import Toast from 'react-native-toast-message';
|
|
5
3
|
import { API } from '../../../configs';
|
|
4
|
+
import api from '../../../utils/Apis/axios';
|
|
5
|
+
import { sendCommandOverInternet } from '../Internet';
|
|
6
6
|
|
|
7
7
|
const mock = new MockAdapter(api.axiosInstance);
|
|
8
8
|
|
|
@@ -14,24 +14,24 @@ describe('Test IOT Remote Control Internet', () => {
|
|
|
14
14
|
it('Trigger action via request POST', async () => {
|
|
15
15
|
mock.onPost(API.DEVICE.TRIGGER_ACTION()).reply(200);
|
|
16
16
|
await sendCommandOverInternet({}, {}, 'internet');
|
|
17
|
-
expect(Toast.show).
|
|
17
|
+
expect(Toast.show).toHaveBeenCalledTimes(2);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
it('Trigger action via request POST with data isInteger', async () => {
|
|
21
21
|
mock.onPost(API.DEVICE.TRIGGER_ACTION()).reply(200);
|
|
22
22
|
await sendCommandOverInternet({}, {}, 1);
|
|
23
|
-
expect(Toast.show).
|
|
23
|
+
expect(Toast.show).toHaveBeenCalledTimes(2);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
it('Trigger action via request POST with data is null', async () => {
|
|
27
27
|
mock.onPost(API.DEVICE.TRIGGER_ACTION()).reply(200);
|
|
28
28
|
await sendCommandOverInternet({}, {}, null);
|
|
29
|
-
expect(Toast.show).
|
|
29
|
+
expect(Toast.show).toHaveBeenCalledTimes(2);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
it('Trigger action fail show error', async () => {
|
|
33
33
|
mock.onPost(API.DEVICE.TRIGGER_ACTION()).reply(400);
|
|
34
34
|
await sendCommandOverInternet({}, {}, 'internet');
|
|
35
|
-
expect(Toast.show).
|
|
35
|
+
expect(Toast.show).toHaveBeenCalled();
|
|
36
36
|
});
|
|
37
37
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
2
2
|
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
3
3
|
import React, { memo } from 'react';
|
|
4
4
|
import { StyleSheet } from 'react-native';
|
|
@@ -19,7 +19,7 @@ export const EmergencyContactsStack = memo(() => {
|
|
|
19
19
|
...screenOptions,
|
|
20
20
|
headerTitleAlign: 'center',
|
|
21
21
|
headerBackImage: () => (
|
|
22
|
-
<
|
|
22
|
+
<IconOutline
|
|
23
23
|
name="left"
|
|
24
24
|
size={27}
|
|
25
25
|
color={Colors.Black}
|
|
@@ -32,7 +32,8 @@ export const EmergencyContactsStack = memo(() => {
|
|
|
32
32
|
borderBottomWidth: Device.isIOS === 'android' ? 1 : 0,
|
|
33
33
|
borderColor: Colors.Gray4,
|
|
34
34
|
},
|
|
35
|
-
|
|
35
|
+
headerTintColor: Colors.Black,
|
|
36
|
+
headerBackTitleVisible: false,
|
|
36
37
|
}}
|
|
37
38
|
>
|
|
38
39
|
<Stack.Screen
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
2
|
+
import NetInfo from '@react-native-community/netinfo';
|
|
3
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
4
|
+
import { get } from 'lodash';
|
|
1
5
|
import React, { memo, useContext, useEffect } from 'react';
|
|
2
6
|
import { AppState, View } from 'react-native';
|
|
3
|
-
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
4
|
-
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
5
7
|
import { BleManager } from 'react-native-ble-plx';
|
|
6
|
-
import NetInfo from '@react-native-community/netinfo';
|
|
7
|
-
import { get } from 'lodash';
|
|
8
8
|
|
|
9
9
|
import Text from '../commons/Text';
|
|
10
|
+
import { API, Colors, Device } from '../configs';
|
|
11
|
+
import { SCContext } from '../context';
|
|
12
|
+
import { Action } from '../context/actionType';
|
|
10
13
|
import { useTranslations } from '../hooks/Common/useTranslations';
|
|
11
14
|
import { unwatchAllConfigs } from '../iot/Monitor';
|
|
12
|
-
import { API, Colors, Device } from '../configs';
|
|
13
|
-
import Route from '../utils/Route';
|
|
14
15
|
import ActivityLogScreen from '../screens/ActivityLog';
|
|
16
|
+
import Route from '../utils/Route';
|
|
15
17
|
import { screenOptions } from './utils';
|
|
16
|
-
import { SCContext } from '../context';
|
|
17
|
-
import { Action } from '../context/actionType';
|
|
18
18
|
|
|
19
|
+
import { useBluetoothConnection } from '../hooks/IoT';
|
|
20
|
+
import { realScanBluetoothDevices } from '../iot/RemoteControl/Bluetooth';
|
|
21
|
+
import AllCamera from '../screens/AllCamera';
|
|
22
|
+
import AllGateway from '../screens/AllGateway';
|
|
19
23
|
import AQIGuide from '../screens/AQIGuide';
|
|
20
|
-
import
|
|
24
|
+
import ChooseAction from '../screens/Automate/AddNewAction/ChooseAction';
|
|
25
|
+
import ChooseConfig from '../screens/Automate/AddNewAction/ChooseConfig';
|
|
26
|
+
import SelectControlDevices from '../screens/Automate/AddNewAction/SelectControlDevices';
|
|
27
|
+
import SelectMonitorDevices from '../screens/Automate/AddNewAction/SelectMonitorDevices';
|
|
28
|
+
import SetupConfigCondition from '../screens/Automate/AddNewAction/SetupConfigCondition';
|
|
29
|
+
import SetupScriptDelay from '../screens/Automate/AddNewAction/SetupScriptDelay';
|
|
30
|
+
import SetupScriptNotify from '../screens/Automate/AddNewAction/SetupScriptNotify';
|
|
31
|
+
import AddAutomationTypeSmart from '../screens/Automate/AddNewAutoSmart/AddAutomationTypeSmart';
|
|
32
|
+
import AddUnknownTypeSmart from '../screens/Automate/AddNewAutoSmart/AddUnknownTypeSmart';
|
|
33
|
+
import EditActionsList from '../screens/Automate/EditActionsList';
|
|
34
|
+
import UpdateActionScript from '../screens/Automate/EditActionsList/UpdateActionScript';
|
|
35
|
+
import AddNewOneTap from '../screens/Automate/OneTap';
|
|
36
|
+
import ScenarioName from '../screens/Automate/Scenario/ScenarioName';
|
|
37
|
+
import ScriptDetail from '../screens/Automate/ScriptDetail';
|
|
38
|
+
import SetSchedule from '../screens/Automate/SetSchedule';
|
|
39
|
+
import ValueChangeName from '../screens/Automate/ValueChange/ValueChangeName';
|
|
21
40
|
import ChangePosition from '../screens/ChangePosition';
|
|
41
|
+
import ConfirmUnitDeletion from '../screens/ConfirmUnitDeletion';
|
|
42
|
+
import DeviceDetail from '../screens/Device/detail';
|
|
43
|
+
import EditDevice from '../screens/Device/EditDevice/index';
|
|
44
|
+
import DeviceInfo from '../screens/DeviceInfo';
|
|
45
|
+
import EmergencySetting from '../screens/EmergencySetting';
|
|
46
|
+
import EnterPassword from '../screens/EnterPassword';
|
|
47
|
+
import GuestInfo from '../screens/GuestInfo';
|
|
48
|
+
import ManageAccessScreen from '../screens/ManageAccess';
|
|
49
|
+
import MoveToAnotherSubUnit from '../screens/MoveToAnotherSubUnit';
|
|
50
|
+
import PlaybackCamera from '../screens/PlayBackCamera';
|
|
51
|
+
import SelectUnit from '../screens/SelectUnit';
|
|
52
|
+
import InfoMemberUnit from '../screens/Sharing/InfoMemberUnit';
|
|
22
53
|
import UnitMemberList from '../screens/Sharing/UnitMemberList';
|
|
54
|
+
import SideMenuDetail from '../screens/SideMenuDetail';
|
|
55
|
+
import EditSubUnit from '../screens/SubUnit/EditSubUnit';
|
|
23
56
|
import ManageSubUnit from '../screens/SubUnit/ManageSubUnit';
|
|
24
|
-
import
|
|
57
|
+
import TDSGuide from '../screens/TDSGuide';
|
|
25
58
|
import ChooseLocation from '../screens/Unit/ChooseLocation';
|
|
59
|
+
import UnitDetail from '../screens/Unit/Detail';
|
|
26
60
|
import ManageUnit from '../screens/Unit/ManageUnit';
|
|
61
|
+
import SelectAddress from '../screens/Unit/SelectAddress';
|
|
62
|
+
import SelectAddToFavorites from '../screens/Unit/SelectAddToFavorites';
|
|
27
63
|
import ListSmartAccount from '../screens/Unit/SmartAccount';
|
|
28
|
-
import UnitDetail from '../screens/Unit/Detail';
|
|
29
64
|
import UnitSummary from '../screens/UnitSummary';
|
|
30
65
|
import UVIndexGuide from '../screens/UVIndexGuide';
|
|
31
|
-
import TDSGuide from '../screens/TDSGuide';
|
|
32
66
|
import WaterQualityGuide from '../screens/WaterQualityGuide';
|
|
33
|
-
import DeviceInfo from '../screens/DeviceInfo';
|
|
34
|
-
import AddNewOneTap from '../screens/Automate/OneTap';
|
|
35
|
-
import AddUnknownTypeSmart from '../screens/Automate/AddNewAutoSmart/AddUnknownTypeSmart';
|
|
36
|
-
import PlaybackCamera from '../screens/PlayBackCamera';
|
|
37
|
-
import AllCamera from '../screens/AllCamera';
|
|
38
|
-
import ManageAccessScreen from '../screens/ManageAccess';
|
|
39
|
-
import MoveToAnotherSubUnit from '../screens/MoveToAnotherSubUnit';
|
|
40
|
-
import GuestInfo from '../screens/GuestInfo';
|
|
41
|
-
import ScriptDetail from '../screens/Automate/ScriptDetail';
|
|
42
|
-
import EditActionsList from '../screens/Automate/EditActionsList';
|
|
43
|
-
import SelectUnit from '../screens/SelectUnit';
|
|
44
|
-
import SetSchedule from '../screens/Automate/SetSchedule';
|
|
45
|
-
import SelectMonitorDevices from '../screens/Automate/AddNewAction/SelectMonitorDevices';
|
|
46
|
-
import EditSubUnit from '../screens/SubUnit/EditSubUnit';
|
|
47
|
-
import SetupConfigCondition from '../screens/Automate/AddNewAction/SetupConfigCondition';
|
|
48
|
-
import EditDevice from '../screens/Device/EditDevice/index';
|
|
49
|
-
import EmergencySetting from '../screens/EmergencySetting';
|
|
50
|
-
import ConfirmUnitDeletion from '../screens/ConfirmUnitDeletion';
|
|
51
|
-
import InfoMemberUnit from '../screens/Sharing/InfoMemberUnit';
|
|
52
|
-
import EnterPassword from '../screens/EnterPassword';
|
|
53
|
-
import AllGateway from '../screens/AllGateway';
|
|
54
|
-
import SelectAddToFavorites from '../screens/Unit/SelectAddToFavorites';
|
|
55
|
-
import { HanetCameraStack } from './HanetCameraStack';
|
|
56
67
|
import { axiosGet, fetchWithCache } from '../utils/Apis/axios';
|
|
57
|
-
import SideMenuDetail from '../screens/SideMenuDetail';
|
|
58
|
-
import { styles } from './UnitStackStyles';
|
|
59
|
-
import { useBluetoothConnection } from '../hooks/IoT';
|
|
60
|
-
import { realScanBluetoothDevices } from '../iot/RemoteControl/Bluetooth';
|
|
61
68
|
import { ToastBottomHelper } from '../utils/Utils';
|
|
62
|
-
import
|
|
63
|
-
import
|
|
64
|
-
import ChooseAction from '../screens/Automate/AddNewAction/ChooseAction';
|
|
65
|
-
import ScenarioName from '../screens/Automate/Scenario/ScenarioName';
|
|
66
|
-
import ValueChangeName from '../screens/Automate/ValueChange/ValueChangeName';
|
|
67
|
-
import AddAutomationTypeSmart from '../screens/Automate/AddNewAutoSmart/AddAutomationTypeSmart';
|
|
68
|
-
import SetupScriptNotify from '../screens/Automate/AddNewAction/SetupScriptNotify';
|
|
69
|
-
import SetupScriptDelay from '../screens/Automate/AddNewAction/SetupScriptDelay';
|
|
70
|
-
import UpdateActionScript from '../screens/Automate/EditActionsList/UpdateActionScript';
|
|
69
|
+
import { HanetCameraStack } from './HanetCameraStack';
|
|
70
|
+
import { styles } from './UnitStackStyles';
|
|
71
71
|
|
|
72
72
|
const Stack = createNativeStackNavigator();
|
|
73
73
|
|
|
@@ -173,7 +173,7 @@ export const UnitStack = memo((props) => {
|
|
|
173
173
|
...screenOptions,
|
|
174
174
|
headerTitleAlign: 'center',
|
|
175
175
|
headerBackImage: () => (
|
|
176
|
-
<
|
|
176
|
+
<IconOutline
|
|
177
177
|
name="left"
|
|
178
178
|
size={27}
|
|
179
179
|
color={Colors.Black}
|
|
@@ -186,7 +186,8 @@ export const UnitStack = memo((props) => {
|
|
|
186
186
|
borderBottomWidth: Device.isIOS === 'android' ? 1 : 0,
|
|
187
187
|
borderColor: Colors.Gray4,
|
|
188
188
|
},
|
|
189
|
-
|
|
189
|
+
headerTintColor: Colors.Black,
|
|
190
|
+
headerBackTitleVisible: false,
|
|
190
191
|
}}
|
|
191
192
|
>
|
|
192
193
|
<Stack.Screen
|
|
@@ -286,28 +287,28 @@ export const UnitStack = memo((props) => {
|
|
|
286
287
|
name={Route.UVIndexGuide}
|
|
287
288
|
component={UVIndexGuide}
|
|
288
289
|
options={{
|
|
289
|
-
|
|
290
|
+
headerTitle: t('uv_index_guide'),
|
|
290
291
|
}}
|
|
291
292
|
/>
|
|
292
293
|
<Stack.Screen
|
|
293
294
|
name={Route.TDSGuide}
|
|
294
295
|
component={TDSGuide}
|
|
295
296
|
options={{
|
|
296
|
-
|
|
297
|
+
headerTitle: t('tds_information'),
|
|
297
298
|
}}
|
|
298
299
|
/>
|
|
299
300
|
<Stack.Screen
|
|
300
301
|
name={Route.AQIGuide}
|
|
301
302
|
component={AQIGuide}
|
|
302
303
|
options={{
|
|
303
|
-
|
|
304
|
+
headerTitle: t('aqi_guide'),
|
|
304
305
|
}}
|
|
305
306
|
/>
|
|
306
307
|
<Stack.Screen
|
|
307
308
|
name={Route.WaterQualityGuide}
|
|
308
309
|
component={WaterQualityGuide}
|
|
309
310
|
options={{
|
|
310
|
-
|
|
311
|
+
headerTitle: t('water_quality_guide'),
|
|
311
312
|
}}
|
|
312
313
|
/>
|
|
313
314
|
<Stack.Screen
|
|
@@ -4,7 +4,6 @@ import { getBottomSpace } from 'react-native-iphone-x-helper';
|
|
|
4
4
|
|
|
5
5
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
6
6
|
import { Colors, Theme } from '../../configs';
|
|
7
|
-
import useTitleHeader from '../../hooks/Common/useTitleHeader';
|
|
8
7
|
import { AccessibilityLabel } from '../../configs/Constants';
|
|
9
8
|
import Text from '../../commons/Text';
|
|
10
9
|
import SvgSmile from '../../../assets/images/Feeling/smile.svg';
|
|
@@ -16,7 +15,6 @@ import { useSCContextSelector } from '../../context';
|
|
|
16
15
|
|
|
17
16
|
const AQIGuide = memo(() => {
|
|
18
17
|
const t = useTranslations();
|
|
19
|
-
useTitleHeader(t('AQI Guide'));
|
|
20
18
|
const language = useSCContextSelector((state) => state.language);
|
|
21
19
|
const data = useMemo(
|
|
22
20
|
() => ({
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
TouchableOpacity,
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
10
|
-
import
|
|
10
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
11
11
|
import { Colors } from '../../configs';
|
|
12
12
|
import { HeaderCustom } from '../../commons/Header';
|
|
13
13
|
import ItemLog from './ItemLog';
|
|
@@ -83,7 +83,7 @@ const ActivityLogScreen = ({ route }) => {
|
|
|
83
83
|
onPress={setShowFilterPopup}
|
|
84
84
|
accessibilityLabel={AccessibilityLabel.FILTER_BUTTON}
|
|
85
85
|
>
|
|
86
|
-
<
|
|
86
|
+
<IconOutline name={'filter'} size={27} color={Colors.Black} />
|
|
87
87
|
</TouchableOpacity>
|
|
88
88
|
),
|
|
89
89
|
[setShowFilterPopup]
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { Alert } from 'react-native';
|
|
3
|
-
import { act, create } from 'react-test-renderer';
|
|
4
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
5
|
-
import RNP from 'react-native-permissions';
|
|
6
4
|
import RNAndroidLocationEnabler from 'react-native-android-location-enabler';
|
|
5
|
+
import RNP from 'react-native-permissions';
|
|
6
|
+
import { act, create } from 'react-test-renderer';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import AddLocationMaps from '../index';
|
|
8
|
+
import { useNavigation } from '@react-navigation/native';
|
|
9
|
+
import { RESULTS } from 'react-native-permissions';
|
|
11
10
|
import { API } from '../../../configs';
|
|
12
11
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
12
|
+
import { SCProvider } from '../../../context';
|
|
13
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
13
14
|
import api from '../../../utils/Apis/axios';
|
|
14
15
|
import {
|
|
15
16
|
GEOLOCATION_ERROR,
|
|
16
17
|
OpenSetting,
|
|
17
18
|
} from '../../../utils/Permission/common';
|
|
18
|
-
import
|
|
19
|
-
import { useNavigation } from '@react-navigation/native';
|
|
19
|
+
import AddLocationMaps from '../index';
|
|
20
20
|
|
|
21
21
|
const wrapComponent = (route) => (
|
|
22
22
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -171,7 +171,7 @@ describe('Test SelectAddress', () => {
|
|
|
171
171
|
});
|
|
172
172
|
expect(
|
|
173
173
|
RNAndroidLocationEnabler.promptForEnableLocationIfNeeded
|
|
174
|
-
).
|
|
174
|
+
).toHaveBeenCalled();
|
|
175
175
|
|
|
176
176
|
RNAndroidLocationEnabler.promptForEnableLocationIfNeeded.mockClear();
|
|
177
177
|
|
|
@@ -184,7 +184,7 @@ describe('Test SelectAddress', () => {
|
|
|
184
184
|
});
|
|
185
185
|
expect(
|
|
186
186
|
RNAndroidLocationEnabler.promptForEnableLocationIfNeeded
|
|
187
|
-
).
|
|
187
|
+
).toHaveBeenCalled();
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
it('test get current location failed location not enabled ios', async () => {
|
|
@@ -233,7 +233,7 @@ describe('Test SelectAddress', () => {
|
|
|
233
233
|
await act(async () => {
|
|
234
234
|
await button.props.onPress();
|
|
235
235
|
});
|
|
236
|
-
expect(OpenSetting).
|
|
236
|
+
expect(OpenSetting).toHaveBeenCalledTimes(0);
|
|
237
237
|
OpenSetting.mockClear();
|
|
238
238
|
});
|
|
239
239
|
|
|
@@ -249,6 +249,6 @@ describe('Test SelectAddress', () => {
|
|
|
249
249
|
await act(async () => {
|
|
250
250
|
await button.props.onPress();
|
|
251
251
|
});
|
|
252
|
-
expect(navigate).
|
|
252
|
+
expect(navigate).toHaveBeenCalled();
|
|
253
253
|
});
|
|
254
254
|
});
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { View, ScrollView, TouchableOpacity } from 'react-native';
|
|
3
|
-
import MapView, { Marker, Circle, PROVIDER_GOOGLE } from 'react-native-maps';
|
|
1
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
2
|
import { useNavigation } from '@react-navigation/native';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { ScrollView, TouchableOpacity, View } from 'react-native';
|
|
5
|
+
import MapView, { Circle, Marker, PROVIDER_GOOGLE } from 'react-native-maps';
|
|
7
6
|
import { check, RESULTS } from 'react-native-permissions';
|
|
7
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
8
8
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
9
9
|
|
|
10
|
-
import Text from '../../commons/Text';
|
|
11
10
|
import { FullLoading } from '../../commons';
|
|
11
|
+
import BottomButtonView from '../../commons/BottomButtonView';
|
|
12
12
|
import SearchBarLocation from '../../commons/SearchLocation';
|
|
13
13
|
import RowLocation from '../../commons/SearchLocation/RowLocation';
|
|
14
|
-
import
|
|
14
|
+
import Text from '../../commons/Text';
|
|
15
15
|
import { API, Colors, SCConfig } from '../../configs';
|
|
16
16
|
import {
|
|
17
17
|
AccessibilityLabel,
|
|
18
|
-
MAP_INITIAL_REGION,
|
|
19
18
|
EOH_LOCATION,
|
|
19
|
+
MAP_INITIAL_REGION,
|
|
20
20
|
} from '../../configs/Constants';
|
|
21
|
-
import
|
|
22
|
-
import Routes from '../../utils/Route';
|
|
21
|
+
import { axiosGet } from '../../utils/Apis/axios';
|
|
23
22
|
import {
|
|
24
23
|
GEOLOCATION_ERROR,
|
|
25
24
|
keyPermission,
|
|
26
25
|
OpenSetting,
|
|
27
26
|
} from '../../utils/Permission/common';
|
|
27
|
+
import Routes from '../../utils/Route';
|
|
28
28
|
import { openPromptEnableLocation } from '../../utils/Setting/Location';
|
|
29
|
-
import
|
|
29
|
+
import styles from './indexStyle';
|
|
30
30
|
|
|
31
31
|
navigator.geolocation = require('@react-native-community/geolocation');
|
|
32
32
|
|
|
@@ -225,8 +225,8 @@ const AddLocationMaps = memo(() => {
|
|
|
225
225
|
style={styles.button}
|
|
226
226
|
accessibilityLabel={AccessibilityLabel.BUTTON_CHOOSE_ON_MAP}
|
|
227
227
|
>
|
|
228
|
-
<
|
|
229
|
-
name="
|
|
228
|
+
<IconOutline
|
|
229
|
+
name="environment"
|
|
230
230
|
size={27}
|
|
231
231
|
color={Colors.Primary}
|
|
232
232
|
/>
|
|
@@ -274,8 +274,8 @@ const AddLocationMaps = memo(() => {
|
|
|
274
274
|
}}
|
|
275
275
|
tracksViewChanges={false}
|
|
276
276
|
>
|
|
277
|
-
<
|
|
278
|
-
name="
|
|
277
|
+
<IconOutline
|
|
278
|
+
name="environment"
|
|
279
279
|
size={27}
|
|
280
280
|
color={Colors.Blue10}
|
|
281
281
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { memo, useCallback, useEffect, useState, useMemo } from 'react';
|
|
2
2
|
import { ScrollView, TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
4
|
import { CommonActions, useNavigation } from '@react-navigation/native';
|
|
5
5
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
6
6
|
import { Colors } from '../../configs';
|
|
@@ -357,7 +357,7 @@ const RenameNewDevices = memo(({ route }) => {
|
|
|
357
357
|
/>
|
|
358
358
|
<View style={styles.content}>
|
|
359
359
|
<View style={styles.viewIconSuccess}>
|
|
360
|
-
<
|
|
360
|
+
<IconOutline name="check-circle" size={28} color={Colors.Green6} />
|
|
361
361
|
<Text
|
|
362
362
|
semibold
|
|
363
363
|
color={Colors.Black}
|
|
@@ -192,7 +192,7 @@ const SelectDeviceType = ({ route }) => {
|
|
|
192
192
|
useEffect(() => {
|
|
193
193
|
const fetchCountSummary = async () => {
|
|
194
194
|
const { success, data } = await axiosGet(API.DEV_MODE.GATEWAY.COUNT(), {
|
|
195
|
-
unit: unit?.id,
|
|
195
|
+
params: { unit: unit?.id },
|
|
196
196
|
});
|
|
197
197
|
if (success) {
|
|
198
198
|
setUnitCountSummary(data);
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
+
import NetInfo from '@react-native-community/netinfo';
|
|
2
|
+
import { useIsFocused, useNavigation } from '@react-navigation/native';
|
|
3
|
+
import LottieView from 'lottie-react-native';
|
|
1
4
|
import React, {
|
|
2
5
|
useCallback,
|
|
3
|
-
useRef,
|
|
4
|
-
useState,
|
|
5
6
|
useEffect,
|
|
6
7
|
useMemo,
|
|
8
|
+
useRef,
|
|
9
|
+
useState,
|
|
7
10
|
} from 'react';
|
|
8
11
|
import {
|
|
9
12
|
Alert,
|
|
10
|
-
TouchableOpacity,
|
|
11
|
-
View,
|
|
12
13
|
FlatList,
|
|
13
14
|
Platform,
|
|
15
|
+
TouchableOpacity,
|
|
16
|
+
View,
|
|
14
17
|
} from 'react-native';
|
|
15
18
|
import dgram from 'react-native-udp';
|
|
16
|
-
import { useNavigation, useIsFocused } from '@react-navigation/native';
|
|
17
|
-
import LottieView from 'lottie-react-native';
|
|
18
19
|
import { v4 as uuidv4 } from 'uuid';
|
|
19
|
-
import NetInfo from '@react-native-community/netinfo';
|
|
20
20
|
|
|
21
|
-
import { ToastBottomHelper } from '../../utils/Utils';
|
|
22
|
-
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
23
|
-
import { HeaderCustom } from '../../commons/Header';
|
|
24
|
-
import Text from '../../commons/Text';
|
|
25
21
|
import WifiIcon from '../../../assets/images/wifi.svg';
|
|
26
22
|
import ButtonPopup from '../../commons/ButtonPopup';
|
|
27
|
-
import AccessibilityLabel from '../../configs/AccessibilityLabel';
|
|
28
|
-
import { Colors } from '../../configs';
|
|
29
23
|
import TextInputPassword from '../../commons/Form/TextInputPassword';
|
|
30
|
-
import styles from './ShareWifiPasswordStyles';
|
|
31
|
-
import Routes from '../../utils/Route';
|
|
32
24
|
import FullLoading from '../../commons/FullLoading';
|
|
25
|
+
import { HeaderCustom } from '../../commons/Header';
|
|
26
|
+
import Text from '../../commons/Text';
|
|
27
|
+
import { Colors } from '../../configs';
|
|
28
|
+
import AccessibilityLabel from '../../configs/AccessibilityLabel';
|
|
29
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
33
30
|
import LoadingCircle from '../../Images/Common/loading-circle.json';
|
|
31
|
+
import Routes from '../../utils/Route';
|
|
32
|
+
import { ToastBottomHelper } from '../../utils/Utils';
|
|
34
33
|
import { useWifiManage } from './hooks/useWifiManage';
|
|
34
|
+
import styles from './ShareWifiPasswordStyles';
|
|
35
35
|
|
|
36
36
|
let socket;
|
|
37
37
|
let wifiOrGatewaySSID;
|
|
@@ -112,6 +112,7 @@ const ShareWifiPassword = ({ route }) => {
|
|
|
112
112
|
'192.168.27.1',
|
|
113
113
|
undefined
|
|
114
114
|
);
|
|
115
|
+
|
|
115
116
|
if (i > 0) {
|
|
116
117
|
shareWifiToDevice(socket, i);
|
|
117
118
|
clearTimeout(timeoutSendConnect);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { act, create } from 'react-test-renderer';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { useNavigation } from '@react-navigation/native';
|
|
6
|
+
import { TextInput } from 'react-native';
|
|
7
|
+
import { ViewButtonBottom } from '../../../commons';
|
|
6
8
|
import GroupCheckBox from '../../../commons/GroupCheckBox';
|
|
7
9
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
8
|
-
import { ViewButtonBottom } from '../../../commons';
|
|
9
|
-
import { TextInput } from 'react-native';
|
|
10
|
-
import { getTranslate } from '../../../utils/I18n';
|
|
11
10
|
import { SCProvider } from '../../../context';
|
|
12
11
|
import { mockSCStore } from '../../../context/mockStore';
|
|
13
12
|
import api from '../../../utils/Apis/axios';
|
|
14
|
-
import {
|
|
13
|
+
import { getTranslate } from '../../../utils/I18n';
|
|
14
|
+
import AddNewGateway from '../index';
|
|
15
15
|
|
|
16
16
|
const wrapComponent = (route) => (
|
|
17
17
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -147,6 +147,6 @@ describe('Test AddNewGateway', () => {
|
|
|
147
147
|
await act(async () => {
|
|
148
148
|
viewButtonBottom.props.onRightClick();
|
|
149
149
|
});
|
|
150
|
-
expect(global.mockedNavigate).not.
|
|
150
|
+
expect(global.mockedNavigate).not.toHaveBeenCalled();
|
|
151
151
|
});
|
|
152
152
|
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import NetInfo from '@react-native-community/netinfo';
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { Alert } from 'react-native';
|
|
3
5
|
import { act, create } from 'react-test-renderer';
|
|
4
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
5
|
-
import NetInfo from '@react-native-community/netinfo';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import { useNavigation } from '@react-navigation/native';
|
|
8
|
+
import Processing from '../../../commons/Processing';
|
|
9
|
+
import { API } from '../../../configs';
|
|
8
10
|
import { SCProvider } from '../../../context';
|
|
9
11
|
import { mockSCStore } from '../../../context/mockStore';
|
|
10
12
|
import api from '../../../utils/Apis/axios';
|
|
11
|
-
import Processing from '../../../commons/Processing';
|
|
12
13
|
import ConnectingDevice from '../ConnectingDevice';
|
|
13
|
-
import
|
|
14
|
-
import { useNavigation } from '@react-navigation/native';
|
|
14
|
+
import ConnectingWifiDevice from '../ConnectingWifiDevice';
|
|
15
15
|
|
|
16
16
|
const wrapComponent = (route) => (
|
|
17
17
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -59,7 +59,7 @@ describe('Test connecting wifi device', () => {
|
|
|
59
59
|
await act(async () => {
|
|
60
60
|
jest.runAllTimers();
|
|
61
61
|
});
|
|
62
|
-
expect(NetInfo.addEventListener).
|
|
62
|
+
expect(NetInfo.addEventListener).toHaveBeenCalled();
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
it('onReady call api scan chip', async () => {
|
|
@@ -81,6 +81,6 @@ describe('Test connecting wifi device', () => {
|
|
|
81
81
|
await act(async () => {
|
|
82
82
|
Alert.alert.mock.calls[1][2][0].onPress();
|
|
83
83
|
});
|
|
84
|
-
expect(goBack).
|
|
84
|
+
expect(goBack).toHaveBeenCalled();
|
|
85
85
|
});
|
|
86
86
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
3
|
+
import { Alert } from 'react-native';
|
|
2
4
|
import { act, create } from 'react-test-renderer';
|
|
3
|
-
import
|
|
4
|
-
import { getPusher } from '../../../utils/Pusher';
|
|
5
|
-
import Routes from '../../../utils/Route';
|
|
6
|
-
import ConnectingZigbeeDevice from '../ConnectingZigbeeDevice';
|
|
5
|
+
import Processing from '../../../commons/Processing';
|
|
7
6
|
import { SCProvider } from '../../../context';
|
|
8
7
|
import { mockSCStore } from '../../../context/mockStore';
|
|
9
8
|
import api from '../../../utils/Apis/axios';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
9
|
+
import { getPusher } from '../../../utils/Pusher';
|
|
10
|
+
import Routes from '../../../utils/Route';
|
|
11
|
+
import ConnectingZigbeeDevice from '../ConnectingZigbeeDevice';
|
|
12
12
|
|
|
13
13
|
const wrapComponent = (route) => (
|
|
14
14
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -61,7 +61,7 @@ describe('Test connecting modbus device', () => {
|
|
|
61
61
|
await act(async () => {
|
|
62
62
|
jest.runOnlyPendingTimers();
|
|
63
63
|
});
|
|
64
|
-
expect(Alert.alert).
|
|
64
|
+
expect(Alert.alert).toHaveBeenCalled();
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
it('receive sensor-id from channel then rename sensor-id', async () => {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { TouchableOpacity } from 'react-native';
|
|
3
4
|
import { act, create } from 'react-test-renderer';
|
|
4
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import { useNavigation } from '@react-navigation/native';
|
|
7
|
+
import _TextInput from '../../../commons/Form/TextInput';
|
|
8
|
+
import Text from '../../../commons/Text';
|
|
9
|
+
import AccessibilityLabel from '../../../configs/AccessibilityLabel';
|
|
10
|
+
import API from '../../../configs/API';
|
|
7
11
|
import { SCProvider } from '../../../context';
|
|
8
12
|
import { mockSCStore } from '../../../context/mockStore';
|
|
9
13
|
import api from '../../../utils/Apis/axios';
|
|
10
|
-
import AccessibilityLabel from '../../../configs/AccessibilityLabel';
|
|
11
|
-
import Text from '../../../commons/Text';
|
|
12
|
-
import _TextInput from '../../../commons/Form/TextInput';
|
|
13
|
-
import API from '../../../configs/API';
|
|
14
14
|
import { CheckBoxCustom } from '../../Sharing/Components';
|
|
15
|
-
import
|
|
15
|
+
import RenameNewDevices from '../RenameNewDevices';
|
|
16
16
|
|
|
17
17
|
const wrapComponent = (route) => (
|
|
18
18
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -61,7 +61,7 @@ describe('Test rename new devices', () => {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
const mockedDispatchNavigate = () => {
|
|
64
|
-
expect(global.mockedDispatch).
|
|
64
|
+
expect(global.mockedDispatch).toHaveBeenCalledWith({
|
|
65
65
|
payload: {
|
|
66
66
|
index: 0,
|
|
67
67
|
routes: [
|