@eohjsc/react-native-smart-city 0.3.90 → 0.3.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +1 -1
- package/src/commons/ActionTemplate/CurtainAction.js +2 -2
- package/src/commons/ActionTemplate/OnOffButtonAction.js +2 -2
- package/src/commons/ActionTemplate/OnOffSimpleAction.js +2 -2
- package/src/commons/ActionTemplate/OnOffSmartLockAction.js +2 -2
- package/src/commons/ActionTemplate/OneButtonAction.js +2 -2
- package/src/commons/ActionTemplate/ThreeButtonAction.js +2 -2
- package/src/commons/ActionTemplate/__test__/CurtainAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/OnOffSimpleAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/OnOffSmartLockAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/OneButtonAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/ThreeButtonAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/index.test.js +21 -70
- package/src/commons/ActionTemplate/index.js +19 -55
- package/src/commons/Alert/__test__/Alert.test.js +1 -1
- package/src/commons/Auth/__test__/OtpInputList.test.js +4 -2
- package/src/commons/Auth/__test__/SocialButton.test.js +4 -2
- package/src/commons/BackDefault/__test__/BackDefault.test.js +1 -1
- package/src/commons/Button/__test__/Button.test.js +1 -1
- package/src/commons/ButtonPopup/__test__/ButtonPopup.test.js +1 -1
- package/src/commons/Calendar/__test__/Calendar.test.js +1 -1
- package/src/commons/ChartLoading/__test__/ChartLoading.test.js +1 -1
- package/src/commons/CircleButton/__test__/CircleButton.test.js +1 -1
- package/src/commons/CircleView/__test__/CircleView.test.js +1 -1
- package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -2
- package/src/commons/DateTimeRangeChange/index.js +31 -48
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +2 -2
- package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +1 -1
- package/src/commons/Device/FlatListItems.js +1 -1
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +2 -2
- package/src/commons/Device/HistoryChart.js +6 -49
- package/src/commons/Device/LinearChart/LinearChart.test.js +1 -1
- package/src/commons/Device/ProgressBar/__test__/ProgressBar.test.js +1 -1
- package/src/commons/Device/RainningSensor/__test__/CurrentRainSensor.test.js +5 -5
- package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +3 -3
- package/src/commons/Device/WindDirection/Compass/Compass.test.js +2 -2
- package/src/commons/Device/WindSpeed/LinearChart/index.js +1 -1
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +3 -3
- package/src/commons/Device/__test__/DisconnectedView.test.js +2 -2
- package/src/commons/Device/__test__/FlatListItems.test.js +1 -1
- package/src/commons/Device/__test__/SensorConnectedStatus.test.js +1 -1
- package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +1 -1
- package/src/commons/Form/__test__/CurrencyInput.test.js +2 -2
- package/src/commons/Form/__test__/TextInput.test.js +2 -2
- package/src/commons/Form/__test__/TextInputPassword.test.js +2 -2
- package/src/commons/FullLoading/__test__/index.test.js +2 -2
- package/src/commons/ImageButton/__test__/ImageButton.test.js +1 -1
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +2 -2
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +4 -4
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +4 -4
- package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +2 -2
- package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +1 -1
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +2 -2
- package/src/commons/RowItem/__test__/RowItem.test.js +1 -1
- package/src/commons/RowUser/__test__/RowUser.test.js +1 -1
- package/src/commons/Section/Section.test.js +2 -2
- package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -1
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +3 -3
- package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +1 -1
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -1
- package/src/commons/Sharing/__test__/MemberList.test.js +6 -4
- package/src/commons/Sharing/__test__/RowMember.test.js +2 -2
- package/src/commons/Sharing/__test__/StationDevicePermission.test.js +3 -3
- package/src/commons/Sharing/__test__/WrapHeaderScrollable.test.js +4 -2
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +2 -10
- package/src/commons/SubUnit/OneTap/index.js +3 -1
- package/src/commons/TextButton/__test__/TextButton.test.js +2 -2
- package/src/commons/Today/__test__/Today.test.js +1 -1
- package/src/commons/TouchableScale/__test__/TouchableScale.test.js +1 -1
- package/src/commons/UnitSummary/AirQuality/index.js +2 -2
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +0 -6
- package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +1 -1
- package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +1 -1
- package/src/commons/ViewButtonBottom/__test__/ViewButtonBottom.test.js +1 -1
- package/src/configs/API.js +9 -32
- package/src/configs/Constants.js +2 -30
- package/src/context/reducer.ts +3 -1
- package/src/hoc/__test__/withRemoteControl.test.js +1 -1
- package/src/navigations/UnitStack.js +23 -13
- package/src/screens/ActivityLog/FilterPopup.js +4 -4
- package/src/screens/ActivityLog/__test__/FilterPopup.test.js +2 -2
- package/src/screens/ActivityLog/__test__/index.test.js +2 -2
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +3 -3
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +5 -5
- package/src/screens/AddNewAction/ChooseAction.js +180 -0
- package/src/screens/AddNewAction/ChooseConfig.js +207 -0
- package/src/screens/AddNewAction/Components/SelectDevices.js +75 -0
- package/src/screens/AddNewAction/Device/__test__/index.test.js +1 -1
- package/src/screens/AddNewAction/NewActionWrapper.js +55 -0
- package/src/screens/AddNewAction/SelectControlDevices.js +107 -0
- package/src/screens/AddNewAction/SelectMonitorDevices.js +142 -0
- package/src/screens/AddNewAction/SetupConfigCondition.js +245 -0
- package/src/screens/AddNewAction/Styles/SetupSensorStyles.js +1 -1
- package/src/screens/AddNewAction/__test__/{SelectAction.test.js → ChooseAction.test.js} +94 -114
- package/src/screens/AddNewAction/__test__/ChooseConfig.test.js +211 -0
- package/src/screens/AddNewAction/__test__/{SelectSensorDevices.test.js → SelectControlDevices.test.js} +32 -83
- package/src/screens/AddNewAction/__test__/SelectMonitorDevices.test.js +92 -0
- package/src/screens/AddNewAction/__test__/SetupSensor.test.js +9 -22
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +2 -3
- package/src/screens/AddNewAutoSmart/index.js +13 -33
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectRouterGuide.test.js +1 -1
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +1 -1
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +1 -1
- package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +1 -1
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +2 -2
- package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +3 -3
- package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +2 -2
- package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +3 -3
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +1 -1
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +1 -1
- package/src/screens/AddNewOneTap/index.js +16 -7
- package/src/screens/AllCamera/__test__/index.test.js +18 -57
- package/src/screens/AllCamera/index.js +98 -30
- package/src/screens/Automate/MultiUnits.js +2 -2
- package/src/screens/Automate/__test__/MultiUnits.test.js +2 -2
- package/src/screens/Automate/__test__/index.test.js +19 -38
- package/src/screens/Automate/index.js +8 -3
- package/src/screens/Device/__test__/DetailHistoryChart.test.js +2 -2
- package/src/screens/Device/__test__/EmergencyCountdown.test.js +4 -2
- package/src/screens/Device/__test__/sensorDisplayItem.test.js +10 -10
- package/src/screens/Device/components/ChartWrapper.js +3 -3
- package/src/screens/Device/components/VisualChart.js +1 -1
- package/src/screens/Device/components/__test__/VisualChart.test.js +1 -1
- package/src/screens/Device/hooks/useEvaluateValue.js +8 -0
- package/src/screens/DeviceInfo/__test__/index.test.js +16 -18
- package/src/screens/DeviceInfo/index.js +6 -5
- package/src/screens/EditActionsList/__tests__/index.test.js +14 -6
- package/src/screens/Notification/__test__/Notification.test.js +65 -74
- package/src/screens/Notification/index.js +14 -14
- package/src/screens/ScriptDetail/__test__/index.test.js +2 -8
- package/src/screens/ScriptDetail/index.js +9 -88
- package/src/screens/ScriptDetail/utils.js +112 -0
- package/src/screens/SelectUnit/__test__/index.test.js +0 -5
- package/src/screens/SelectUnit/index.js +1 -2
- package/src/screens/Sharing/Components/TitleCheckBox.js +2 -2
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +3 -3
- package/src/screens/SmartAccount/__test__/Connecting.test.js +1 -1
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +3 -3
- package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +1 -1
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +5 -5
- package/src/screens/SmartIr/__test__/SelectBrand.test.js +2 -2
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +2 -2
- package/src/screens/SmartIr/__test__/SmartIr.test.js +2 -2
- package/src/screens/Template/__test__/detail.test.js +10 -2
- package/src/screens/Unit/__test__/Detail.test.js +7 -13
- package/src/screens/Unit/components/__test__/Header.test.js +4 -4
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +1 -1
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +14 -6
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +1 -1
- package/src/screens/UnitSummary/components/Temperature/index.js +2 -2
- package/src/screens/UnitSummary/components/UvIndex/index.js +2 -2
- package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -2
- package/src/screens/UnitSummary/components/__test__/TotalPowerBox.test.js +1 -1
- package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +1 -1
- package/src/screens/UnitSummary/components/__test__/index.test.js +2 -2
- package/src/utils/Apis/axios.js +3 -0
- package/src/utils/I18n/translations/en.json +1 -0
- package/src/utils/I18n/translations/vi.json +1 -0
- package/src/utils/Route/index.js +6 -3
- package/src/screens/AddNewAction/SelectAction.js +0 -570
- package/src/screens/AddNewAction/SelectSensorDevices.js +0 -236
- package/src/screens/AddNewAction/SetupSensor.js +0 -263
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
3
|
import Text from '../Text';
|
|
4
4
|
import styles from './CurtainActionStyles';
|
|
@@ -57,4 +57,4 @@ const CurtainAction = ({ configuration, onPress, template }) => {
|
|
|
57
57
|
);
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
export default
|
|
60
|
+
export default CurtainAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
3
|
import AccessibilityLabel from '../../configs/AccessibilityLabel';
|
|
4
4
|
import Text from '../Text';
|
|
@@ -52,4 +52,4 @@ const OnOffButtonAction = ({ title, configuration, onPress, template }) => {
|
|
|
52
52
|
);
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
export default
|
|
55
|
+
export default OnOffButtonAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
3
|
import Text from '../Text';
|
|
4
4
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
@@ -49,4 +49,4 @@ const OnOffSimpleAction = ({ configuration, onPress, template }) => {
|
|
|
49
49
|
);
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
export default
|
|
52
|
+
export default OnOffSimpleAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
3
|
import Text from '../Text';
|
|
4
4
|
import styles from './OnOffSmartLockActionStyles';
|
|
@@ -45,4 +45,4 @@ const OnOffSmartLockAction = ({ configuration, onPress, template }) => {
|
|
|
45
45
|
);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
export default
|
|
48
|
+
export default OnOffSmartLockAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
3
|
import Text from '../Text';
|
|
4
4
|
import styles from './OneButtonActionStyles';
|
|
@@ -24,4 +24,4 @@ const OneButtonAction = ({ configuration, onPress, template }) => {
|
|
|
24
24
|
</>
|
|
25
25
|
);
|
|
26
26
|
};
|
|
27
|
-
export default
|
|
27
|
+
export default OneButtonAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
3
|
import Text from '../Text';
|
|
4
4
|
import styles from './ThreeButtonActionStyles';
|
|
@@ -55,4 +55,4 @@ const ThreeButtonAction = ({ configuration, onPress, template }) => {
|
|
|
55
55
|
);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
export default
|
|
58
|
+
export default ThreeButtonAction;
|
|
@@ -26,7 +26,7 @@ describe('Test CurtainAction', () => {
|
|
|
26
26
|
};
|
|
27
27
|
const mockFuntion = jest.fn();
|
|
28
28
|
await act(async () => {
|
|
29
|
-
tree = renderer.create(wrapComponent(configuration, mockFuntion));
|
|
29
|
+
tree = await renderer.create(wrapComponent(configuration, mockFuntion));
|
|
30
30
|
});
|
|
31
31
|
const instance = tree.root;
|
|
32
32
|
const touchOpacity = instance.findAllByType(TouchableOpacity);
|
|
@@ -31,7 +31,7 @@ describe('Test OnOffButtonAction', () => {
|
|
|
31
31
|
};
|
|
32
32
|
const mockFuntion = jest.fn();
|
|
33
33
|
await act(async () => {
|
|
34
|
-
tree = renderer.create(wrapComponent(configuration, mockFuntion));
|
|
34
|
+
tree = await renderer.create(wrapComponent(configuration, mockFuntion));
|
|
35
35
|
});
|
|
36
36
|
const instance = tree.root;
|
|
37
37
|
const touchOpacity = instance.findAllByType(TouchableOpacity);
|
|
@@ -19,7 +19,7 @@ describe('Test OnOffSimpleAction', () => {
|
|
|
19
19
|
const configuration = {};
|
|
20
20
|
const mockFuntion = jest.fn();
|
|
21
21
|
await act(async () => {
|
|
22
|
-
tree = renderer.create(wrapComponent(configuration, mockFuntion));
|
|
22
|
+
tree = await renderer.create(wrapComponent(configuration, mockFuntion));
|
|
23
23
|
});
|
|
24
24
|
const instance = tree.root;
|
|
25
25
|
const touchOpacity = instance.findAllByType(TouchableOpacity);
|
|
@@ -24,7 +24,7 @@ describe('Test OnOffSmartLockAction', () => {
|
|
|
24
24
|
};
|
|
25
25
|
const mockFuntion = jest.fn();
|
|
26
26
|
await act(async () => {
|
|
27
|
-
tree = renderer.create(wrapComponent(configuration, mockFuntion));
|
|
27
|
+
tree = await renderer.create(wrapComponent(configuration, mockFuntion));
|
|
28
28
|
});
|
|
29
29
|
const instance = tree.root;
|
|
30
30
|
const touchOpacity = instance.findAllByType(TouchableOpacity);
|
|
@@ -19,7 +19,7 @@ describe('Test OneButtonAction', () => {
|
|
|
19
19
|
const configuration = {};
|
|
20
20
|
const mockFuntion = jest.fn();
|
|
21
21
|
await act(async () => {
|
|
22
|
-
tree = renderer.create(wrapComponent(configuration, mockFuntion));
|
|
22
|
+
tree = await renderer.create(wrapComponent(configuration, mockFuntion));
|
|
23
23
|
});
|
|
24
24
|
const instance = tree.root;
|
|
25
25
|
const touchOpacity = instance.findAllByType(TouchableOpacity);
|
|
@@ -19,7 +19,7 @@ describe('Test ThreeButtonAction', () => {
|
|
|
19
19
|
const configuration = {};
|
|
20
20
|
const mockFuntion = jest.fn();
|
|
21
21
|
await act(async () => {
|
|
22
|
-
tree = renderer.create(wrapComponent(configuration, mockFuntion));
|
|
22
|
+
tree = await renderer.create(wrapComponent(configuration, mockFuntion));
|
|
23
23
|
});
|
|
24
24
|
const instance = tree.root;
|
|
25
25
|
const touchOpacity = instance.findAllByType(TouchableOpacity);
|
|
@@ -10,84 +10,35 @@ import ThreeButtonAction from '../ThreeButtonAction';
|
|
|
10
10
|
|
|
11
11
|
const mockOnSelectAction = jest.fn();
|
|
12
12
|
|
|
13
|
-
const wrapComponent = (
|
|
13
|
+
const wrapComponent = (item) => (
|
|
14
14
|
<SCProvider initState={mockSCStore({})}>
|
|
15
|
-
<ActionTemplate
|
|
15
|
+
<ActionTemplate item={item} onSelectAction={mockOnSelectAction} />
|
|
16
16
|
</SCProvider>
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
describe('Test ActionTemplate', () => {
|
|
20
20
|
let tree;
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
is_display_lock: true,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
title: '',
|
|
41
|
-
template: 'on_off_button_action_template',
|
|
42
|
-
configuration: {
|
|
43
|
-
action_on: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
44
|
-
action_off: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
45
|
-
text_on: 'On',
|
|
46
|
-
text_off: 'Off',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
title: '',
|
|
51
|
-
template: 'one_button_action_template',
|
|
52
|
-
configuration: {
|
|
53
|
-
action: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
54
|
-
text: 'One',
|
|
55
|
-
},
|
|
21
|
+
let item = {
|
|
22
|
+
title: '',
|
|
23
|
+
template: 'three_button_action_template',
|
|
24
|
+
configuration: {
|
|
25
|
+
action1: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
26
|
+
action2: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
27
|
+
action3: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
28
|
+
icon1: 'up',
|
|
29
|
+
icon2: 'stop',
|
|
30
|
+
icon3: 'down',
|
|
31
|
+
text1: 'OPEN',
|
|
32
|
+
text2: 'STOP',
|
|
33
|
+
text3: 'CLOSE',
|
|
34
|
+
text_lock: 'Door lock',
|
|
35
|
+
is_display_lock: true,
|
|
56
36
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
template: 'OnOffSimpleActionTemplate',
|
|
60
|
-
configuration: {
|
|
61
|
-
action_on: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
62
|
-
action_off: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
title: '',
|
|
67
|
-
template: 'curtain_action_template',
|
|
68
|
-
configuration: {
|
|
69
|
-
open_action: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
70
|
-
close_action: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
71
|
-
stop_action: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
72
|
-
text1: 'One',
|
|
73
|
-
text2: 'Two',
|
|
74
|
-
text3: 'Three',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
title: '',
|
|
79
|
-
template: 'OnOffSmartLockActionTemplate',
|
|
80
|
-
configuration: {
|
|
81
|
-
action_on: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
82
|
-
action_off: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
83
|
-
text_on: 'on',
|
|
84
|
-
text_off: 'off',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
];
|
|
37
|
+
};
|
|
38
|
+
|
|
88
39
|
it('test onPress SelectActionCard', async () => {
|
|
89
40
|
await act(async () => {
|
|
90
|
-
tree = renderer.create(wrapComponent(
|
|
41
|
+
tree = await renderer.create(wrapComponent(item));
|
|
91
42
|
});
|
|
92
43
|
const instance = tree.root;
|
|
93
44
|
const selectActionCard = instance.findByType(SelectActionCard);
|
|
@@ -100,7 +51,7 @@ describe('Test ActionTemplate', () => {
|
|
|
100
51
|
|
|
101
52
|
it('test onPressSelectAction', async () => {
|
|
102
53
|
await act(async () => {
|
|
103
|
-
tree = renderer.create(wrapComponent(
|
|
54
|
+
tree = await renderer.create(wrapComponent(item));
|
|
104
55
|
});
|
|
105
56
|
const instance = tree.root;
|
|
106
57
|
|
|
@@ -13,7 +13,7 @@ import CurtainAction from './CurtainAction';
|
|
|
13
13
|
import OnOffSmartLockAction from './OnOffSmartLockAction';
|
|
14
14
|
import { DEVICE_TYPE } from '../../configs/Constants';
|
|
15
15
|
|
|
16
|
-
const ActionTemplate = memo(({ device,
|
|
16
|
+
const ActionTemplate = memo(({ device, item, onSelectAction }) => {
|
|
17
17
|
const t = useTranslations();
|
|
18
18
|
const [visible, setVisible] = useState(false);
|
|
19
19
|
const onClose = () => setVisible(false);
|
|
@@ -47,66 +47,30 @@ const ActionTemplate = memo(({ device, data, onSelectAction }) => {
|
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
const renderAction = useMemo(() => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
);
|
|
68
|
-
case 'three_button_action_template':
|
|
69
|
-
return (
|
|
70
|
-
<ThreeButtonAction
|
|
71
|
-
{...item}
|
|
72
|
-
onPress={onPressSelectAction}
|
|
73
|
-
key={index}
|
|
74
|
-
/>
|
|
75
|
-
);
|
|
76
|
-
case 'OnOffSimpleActionTemplate':
|
|
77
|
-
return (
|
|
78
|
-
<OnOffSimpleAction
|
|
79
|
-
{...item}
|
|
80
|
-
onPress={onPressSelectAction}
|
|
81
|
-
key={index}
|
|
82
|
-
/>
|
|
83
|
-
);
|
|
84
|
-
case 'curtain_action_template':
|
|
85
|
-
return (
|
|
86
|
-
<CurtainAction
|
|
87
|
-
{...item}
|
|
88
|
-
onPress={onPressSelectAction}
|
|
89
|
-
key={index}
|
|
90
|
-
/>
|
|
91
|
-
);
|
|
92
|
-
case 'OnOffSmartLockActionTemplate':
|
|
93
|
-
return (
|
|
94
|
-
<OnOffSmartLockAction
|
|
95
|
-
{...item}
|
|
96
|
-
onPress={onPressSelectAction}
|
|
97
|
-
key={index}
|
|
98
|
-
/>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}, [data, onPressSelectAction]);
|
|
50
|
+
switch (item.template) {
|
|
51
|
+
case 'on_off_button_action_template':
|
|
52
|
+
return <OnOffButtonAction {...item} onPress={onPressSelectAction} />;
|
|
53
|
+
case 'one_button_action_template':
|
|
54
|
+
return <OneButtonAction {...item} onPress={onPressSelectAction} />;
|
|
55
|
+
case 'three_button_action_template':
|
|
56
|
+
return <ThreeButtonAction {...item} onPress={onPressSelectAction} />;
|
|
57
|
+
case 'OnOffSimpleActionTemplate':
|
|
58
|
+
return <OnOffSimpleAction {...item} onPress={onPressSelectAction} />;
|
|
59
|
+
case 'curtain_action_template':
|
|
60
|
+
return <CurtainAction {...item} onPress={onPressSelectAction} />;
|
|
61
|
+
case 'OnOffSmartLockActionTemplate':
|
|
62
|
+
return <OnOffSmartLockAction {...item} onPress={onPressSelectAction} />;
|
|
63
|
+
default:
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}, [item, onPressSelectAction]);
|
|
103
67
|
|
|
104
68
|
return (
|
|
105
69
|
<>
|
|
106
70
|
<SelectActionCard
|
|
107
71
|
onPress={onPress}
|
|
108
72
|
action={actionName}
|
|
109
|
-
title={t(
|
|
73
|
+
title={t(item?.title === 'Power' ? 'power' : 'action')}
|
|
110
74
|
/>
|
|
111
75
|
|
|
112
76
|
<ModalCustom
|
|
@@ -7,7 +7,7 @@ describe('Test Alert', () => {
|
|
|
7
7
|
let tree;
|
|
8
8
|
it('create Alert', async () => {
|
|
9
9
|
await act(async () => {
|
|
10
|
-
tree = renderer.create(<Alert />);
|
|
10
|
+
tree = await renderer.create(<Alert />);
|
|
11
11
|
});
|
|
12
12
|
const instance = tree.root;
|
|
13
13
|
const Modals = instance.findAllByType(Modal);
|
|
@@ -12,7 +12,9 @@ describe('Test OtpInputList', () => {
|
|
|
12
12
|
for (const code of list_code) {
|
|
13
13
|
test(`create OtpInputList ${code} onfinishInputCode is func`, async () => {
|
|
14
14
|
await act(async () => {
|
|
15
|
-
tree = renderer.create(
|
|
15
|
+
tree = await renderer.create(
|
|
16
|
+
<OtpInputList onfinishInputCode={mockFunc} />
|
|
17
|
+
);
|
|
16
18
|
});
|
|
17
19
|
|
|
18
20
|
const instance = tree.root;
|
|
@@ -31,7 +33,7 @@ describe('Test OtpInputList', () => {
|
|
|
31
33
|
|
|
32
34
|
it('create OtpInputList not parameter', async () => {
|
|
33
35
|
await act(async () => {
|
|
34
|
-
tree = renderer.create(<OtpInputList />);
|
|
36
|
+
tree = await renderer.create(<OtpInputList />);
|
|
35
37
|
});
|
|
36
38
|
const instance = tree.root;
|
|
37
39
|
const textInputs = instance.findAllByType(TextInput);
|
|
@@ -11,7 +11,7 @@ describe('Test OtpInputList', () => {
|
|
|
11
11
|
|
|
12
12
|
it('create SocialButton', async () => {
|
|
13
13
|
await act(async () => {
|
|
14
|
-
tree = renderer.create(
|
|
14
|
+
tree = await renderer.create(
|
|
15
15
|
<SocialButton icon={'apple'} onPress={mockFunc} />
|
|
16
16
|
);
|
|
17
17
|
});
|
|
@@ -29,7 +29,9 @@ describe('Test OtpInputList', () => {
|
|
|
29
29
|
|
|
30
30
|
it('create SocialButton icon null', async () => {
|
|
31
31
|
await act(async () => {
|
|
32
|
-
tree = renderer.create(
|
|
32
|
+
tree = await renderer.create(
|
|
33
|
+
<SocialButton icon={''} onPress={mockFunc} />
|
|
34
|
+
);
|
|
33
35
|
});
|
|
34
36
|
|
|
35
37
|
const instance = tree.root;
|
|
@@ -10,7 +10,7 @@ describe('Test BackDefault', () => {
|
|
|
10
10
|
let color = { color: 'fff' };
|
|
11
11
|
let fixedHeight = { Height: 50 };
|
|
12
12
|
await act(async () => {
|
|
13
|
-
tree = renderer.create(
|
|
13
|
+
tree = await renderer.create(
|
|
14
14
|
<BackDefault goBack={goBack} color={color} fixedHeight={fixedHeight} />
|
|
15
15
|
);
|
|
16
16
|
});
|
|
@@ -22,7 +22,7 @@ describe('Test Calendar component', () => {
|
|
|
22
22
|
|
|
23
23
|
it('create Calendar', async () => {
|
|
24
24
|
await act(async () => {
|
|
25
|
-
tree = renderer.create(wrapComponent({ isVisible: true }));
|
|
25
|
+
tree = await renderer.create(wrapComponent({ isVisible: true }));
|
|
26
26
|
});
|
|
27
27
|
const instance = tree.root;
|
|
28
28
|
const calendar = instance.findAllByType(Calendar);
|
|
@@ -16,7 +16,7 @@ describe('Test chart loading', () => {
|
|
|
16
16
|
|
|
17
17
|
it('create chart message null', async () => {
|
|
18
18
|
await act(async () => {
|
|
19
|
-
tree = renderer.create(wrapComponent());
|
|
19
|
+
tree = await renderer.create(wrapComponent());
|
|
20
20
|
});
|
|
21
21
|
const instance = tree.root;
|
|
22
22
|
const textInputs = instance.findAllByType(Text);
|
|
@@ -7,7 +7,7 @@ describe('Test circle button', () => {
|
|
|
7
7
|
let tree;
|
|
8
8
|
it('create circle button', async () => {
|
|
9
9
|
await act(async () => {
|
|
10
|
-
tree = renderer.create(<CircleButton size={5} />);
|
|
10
|
+
tree = await renderer.create(<CircleButton size={5} />);
|
|
11
11
|
});
|
|
12
12
|
const instance = tree.root;
|
|
13
13
|
const TouchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
@@ -7,7 +7,7 @@ describe('Test circle view', () => {
|
|
|
7
7
|
let tree;
|
|
8
8
|
it('create circle view', async () => {
|
|
9
9
|
await act(async () => {
|
|
10
|
-
tree = renderer.create(<CircleView size={5} />);
|
|
10
|
+
tree = await renderer.create(<CircleView size={5} />);
|
|
11
11
|
});
|
|
12
12
|
const instance = tree.root;
|
|
13
13
|
const Views = instance.findAllByType(View);
|
|
@@ -10,7 +10,7 @@ describe('Test DateTimeButton', () => {
|
|
|
10
10
|
|
|
11
11
|
it('render DateTimeButton formatType = "date"', async () => {
|
|
12
12
|
await act(async () => {
|
|
13
|
-
tree = renderer.create(
|
|
13
|
+
tree = await renderer.create(
|
|
14
14
|
<DateTimeButton onPress={() => {}} time={time} formatType="date" />
|
|
15
15
|
);
|
|
16
16
|
});
|
|
@@ -21,7 +21,9 @@ describe('Test DateTimeButton', () => {
|
|
|
21
21
|
|
|
22
22
|
it('render DateTimeButton formatType is undefined', async () => {
|
|
23
23
|
await act(async () => {
|
|
24
|
-
tree = renderer.create(
|
|
24
|
+
tree = await renderer.create(
|
|
25
|
+
<DateTimeButton onPress={() => {}} time={time} />
|
|
26
|
+
);
|
|
25
27
|
});
|
|
26
28
|
const instance = tree.root;
|
|
27
29
|
const TouchableOpacities = instance.findAllByType(TouchableOpacity);
|