@eohjsc/react-native-smart-city 0.7.0 → 0.7.3-rc1
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/README.md +2 -2
- package/assets/images/Automation-fill.svg +85 -0
- package/assets/images/Scenario-filled.svg +22 -0
- package/assets/images/schedule-fill.svg +48 -0
- package/package.json +4 -4
- package/src/commons/Action/ItemQuickAction.js +1 -1
- package/src/commons/DateTimeRangeChange/index.js +1 -1
- package/src/commons/Device/ItemDevice.js +3 -19
- 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/SubUnit/OneTap/ItemOneTap.js +3 -3
- package/src/commons/Unit/HeaderUnit/index.js +29 -21
- package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +44 -1
- package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +69 -0
- package/src/commons/WrapParallaxScrollView/index.js +9 -10
- package/src/configs/Constants.js +3 -3
- package/src/navigations/AddDeviceStack.js +2 -2
- package/src/navigations/AddGatewayStack.js +2 -2
- package/src/navigations/AddLGDeviceStack.js +2 -2
- package/src/navigations/AddMemberStack.js +2 -2
- package/src/navigations/AddSubUnitStack.js +2 -2
- package/src/navigations/AddUnitStack.js +2 -2
- package/src/navigations/AllGatewayStack.js +2 -2
- package/src/navigations/AutomateStack.js +2 -2
- package/src/navigations/EmergencyContactsStack.js +2 -2
- package/src/navigations/GatewayStack.js +2 -2
- package/src/navigations/HanetCameraStack.js +2 -2
- package/src/navigations/Main.js +2 -2
- package/src/navigations/NotificationStack.js +2 -2
- package/src/navigations/SharedStack.js +2 -2
- package/src/navigations/SmartAccountStack.js +2 -2
- package/src/navigations/SmartIrStack.js +2 -2
- package/src/navigations/SmartLockStack.js +2 -2
- package/src/navigations/SmartStack.js +2 -2
- package/src/navigations/TemplateStack.js +2 -2
- package/src/navigations/UnitStack.js +2 -2
- package/src/navigations/utils.js +1 -4
- package/src/screens/Automate/Styles/indexStyles.js +6 -0
- package/src/screens/Automate/__test__/index.test.js +3 -28
- package/src/screens/Automate/index.js +48 -31
- package/src/screens/SharedUnit/index.js +5 -0
- package/src/screens/Unit/Detail.js +1 -5
- package/src/screens/Unit/MoreMenu.js +6 -5
- package/src/screens/Unit/__test__/MoreMenu.test.js +5 -1
- package/src/screens/Unit/components/AutomateScript/index.js +3 -3
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +1 -1
- package/src/screens/UnitSummary/index.js +5 -1
- package/src/utils/Apis/axios.js +4 -2
- package/assets/images/OneTap.svg +0 -14
- package/assets/images/Schedule.svg +0 -39
- package/assets/images/ValueChange.svg +0 -49
package/src/configs/Constants.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { default as AccessibilityLabel } from './AccessibilityLabel';
|
|
2
2
|
import { Platform, Dimensions, StatusBar } from 'react-native';
|
|
3
3
|
import { RFValue } from 'react-native-responsive-fontsize';
|
|
4
|
-
import OneTap from '../../assets/images/
|
|
5
|
-
import ValueChange from '../../assets/images/
|
|
6
|
-
import Schedule from '../../assets/images/
|
|
4
|
+
import OneTap from '../../assets/images/Scenario-filled.svg';
|
|
5
|
+
import ValueChange from '../../assets/images/Automation-fill.svg';
|
|
6
|
+
import Schedule from '../../assets/images/schedule-fill.svg';
|
|
7
7
|
import Event from '../../assets/images/Event.svg';
|
|
8
8
|
|
|
9
9
|
const X_WIDTH = 375;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
|
|
4
4
|
import AddCommonSelectUnit from '../screens/AddCommon/SelectUnit';
|
|
@@ -7,7 +7,7 @@ import AddNewDevice from '../screens/AddNewDevice';
|
|
|
7
7
|
import Route from '../utils/Route';
|
|
8
8
|
import { screenOptions } from './utils';
|
|
9
9
|
|
|
10
|
-
const Stack =
|
|
10
|
+
const Stack = createNativeStackNavigator();
|
|
11
11
|
|
|
12
12
|
export const AddDeviceStack = memo(() => {
|
|
13
13
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
|
|
4
4
|
import AddNewGateway from '../screens/AddNewGateway';
|
|
@@ -21,7 +21,7 @@ import RenameNewDevices from '../screens/AddNewGateway/RenameNewDevices';
|
|
|
21
21
|
import ConnectingWifiGuide from '../screens/AddNewGateway/ConnectingWifiGuide';
|
|
22
22
|
import ZigbeeDeviceConnectGuide from '../screens/AddNewGateway/PlugAndPlay/ZigbeeDeviceConnectGuide';
|
|
23
23
|
|
|
24
|
-
const Stack =
|
|
24
|
+
const Stack = createNativeStackNavigator();
|
|
25
25
|
|
|
26
26
|
export const AddGatewayStack = memo(() => {
|
|
27
27
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
|
|
4
4
|
import AddCommonSelectUnit from '../screens/AddCommon/SelectUnit';
|
|
@@ -6,7 +6,7 @@ import AddLGDevice from '../screens/SyncLGDevice/AddLGDevice';
|
|
|
6
6
|
import Routes from '../utils/Route';
|
|
7
7
|
import { screenOptions } from './utils';
|
|
8
8
|
|
|
9
|
-
const Stack =
|
|
9
|
+
const Stack = createNativeStackNavigator();
|
|
10
10
|
|
|
11
11
|
export const AddLGDeviceStack = memo(() => {
|
|
12
12
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
|
|
4
4
|
import AddCommonSelectUnit from '../screens/AddCommon/SelectUnit';
|
|
@@ -8,7 +8,7 @@ import SharingInviteMembers from '../screens/Sharing/SelectUser';
|
|
|
8
8
|
import UpdateShareDevice from '../screens/Sharing/UpdateShareDevice';
|
|
9
9
|
import SelectShareDevice from '../screens/Sharing/SelectShareDevice';
|
|
10
10
|
|
|
11
|
-
const Stack =
|
|
11
|
+
const Stack = createNativeStackNavigator();
|
|
12
12
|
|
|
13
13
|
export const AddMemberStack = memo(() => {
|
|
14
14
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
|
|
4
4
|
import AddCommonSelectUnit from '../screens/AddCommon/SelectUnit';
|
|
@@ -6,7 +6,7 @@ import AddSubUnit from '../screens/SubUnit/AddSubUnit';
|
|
|
6
6
|
import Route from '../utils/Route';
|
|
7
7
|
import { screenOptions } from './utils';
|
|
8
8
|
|
|
9
|
-
const Stack =
|
|
9
|
+
const Stack = createNativeStackNavigator();
|
|
10
10
|
|
|
11
11
|
export const AddSubUnitStack = memo(() => {
|
|
12
12
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
|
|
4
4
|
import AddLocationMaps from '../screens/AddLocationMaps'; //containers/AddLocationMaps
|
|
@@ -6,7 +6,7 @@ import AddSubUnit from '../screens/SubUnit/AddSubUnit';
|
|
|
6
6
|
import Route from '../utils/Route'; // utils/Route
|
|
7
7
|
import { screenOptions } from './utils';
|
|
8
8
|
|
|
9
|
-
const Stack =
|
|
9
|
+
const Stack = createNativeStackNavigator();
|
|
10
10
|
|
|
11
11
|
export const AddUnitStack = memo(() => {
|
|
12
12
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
3
3
|
|
|
4
4
|
import GatewayDetail from '../screens/AllGateway/GatewayDetail';
|
|
5
5
|
import GatewayInfo from '../screens/AllGateway/GatewayInfo';
|
|
@@ -15,7 +15,7 @@ import DetailConfigActionInternal from '../screens/AllGateway/DetailConfigAction
|
|
|
15
15
|
import Route from '../utils/Route'; // utils/Route
|
|
16
16
|
import { screenOptions } from './utils';
|
|
17
17
|
|
|
18
|
-
const Stack =
|
|
18
|
+
const Stack = createNativeStackNavigator();
|
|
19
19
|
|
|
20
20
|
export const AllGatewayStack = memo(() => {
|
|
21
21
|
return (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { memo, useCallback, useEffect, useContext } from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
4
4
|
import { useNavigation } from '@react-navigation/core';
|
|
5
5
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
6
6
|
import { SCContext } from '../context';
|
|
@@ -16,7 +16,7 @@ import MultiUnits from '../screens/Automate/MultiUnits';
|
|
|
16
16
|
import { axiosGet } from '../utils/Apis/axios';
|
|
17
17
|
import { API } from '../configs';
|
|
18
18
|
|
|
19
|
-
const Stack =
|
|
19
|
+
const Stack = createNativeStackNavigator();
|
|
20
20
|
|
|
21
21
|
const AutomateStack = memo(() => {
|
|
22
22
|
const t = useTranslations();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
2
|
-
import {
|
|
2
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
3
3
|
import React, { memo } from 'react';
|
|
4
4
|
import { StyleSheet } from 'react-native';
|
|
5
5
|
|
|
@@ -10,7 +10,7 @@ import { EmergencyContactsSelectContacts } from '../screens/EmergencyContacts/Em
|
|
|
10
10
|
import Route from '../utils/Route';
|
|
11
11
|
import { screenOptions } from './utils';
|
|
12
12
|
|
|
13
|
-
const Stack =
|
|
13
|
+
const Stack = createNativeStackNavigator();
|
|
14
14
|
|
|
15
15
|
export const EmergencyContactsStack = memo(() => {
|
|
16
16
|
return (
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
3
3
|
|
|
4
4
|
import Routes from '../utils/Route';
|
|
5
5
|
import { screenOptions } from './utils';
|
|
6
6
|
import Gateway from '../screens/Gateway';
|
|
7
7
|
|
|
8
|
-
const Stack =
|
|
8
|
+
const Stack = createNativeStackNavigator();
|
|
9
9
|
|
|
10
10
|
const GatewayStack = memo(() => {
|
|
11
11
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
import HanetCameraDetail from '../screens/HanetCamera/Detail';
|
|
4
4
|
import HanetManageAccess from '../screens/HanetCamera/ManageAccess';
|
|
@@ -7,7 +7,7 @@ import HanetCaptureFaceID from '../screens/HanetCamera/CaptureFaceID';
|
|
|
7
7
|
import Route from '../utils/Route';
|
|
8
8
|
import { screenOptions } from './utils';
|
|
9
9
|
|
|
10
|
-
const Stack =
|
|
10
|
+
const Stack = createNativeStackNavigator();
|
|
11
11
|
|
|
12
12
|
export const HanetCameraStack = memo(() => {
|
|
13
13
|
return (
|
package/src/navigations/Main.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// import { createDrawerNavigator } from '@react-navigation/drawer';
|
|
11
11
|
// import { useNavigation } from '@react-navigation/native';
|
|
12
12
|
// import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
|
13
|
-
// import {
|
|
13
|
+
// import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
14
14
|
|
|
15
15
|
// import Tabbar from '../commons/Tabbar';
|
|
16
16
|
// import { Colors, Constants, Images } from '../configs';
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
// const Tab = createBottomTabNavigator();
|
|
42
42
|
// const Drawer = createDrawerNavigator();
|
|
43
|
-
// const Stack =
|
|
43
|
+
// const Stack = createNativeStackNavigator();
|
|
44
44
|
|
|
45
45
|
// const getWidth = () => {
|
|
46
46
|
// const Width = Constants.width - 12;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
3
3
|
|
|
4
4
|
import Routes from '../utils/Route';
|
|
5
5
|
import Notification from '../screens/Notification';
|
|
6
6
|
import { screenOptions } from './utils';
|
|
7
7
|
|
|
8
|
-
const Stack =
|
|
8
|
+
const Stack = createNativeStackNavigator();
|
|
9
9
|
|
|
10
10
|
const NotificationStack = memo(() => {
|
|
11
11
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
3
3
|
import { TouchableOpacity, StyleSheet } from 'react-native';
|
|
4
4
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
5
5
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
@@ -10,7 +10,7 @@ import { Colors } from '../configs';
|
|
|
10
10
|
import Routes from '../utils/Route';
|
|
11
11
|
import { screenOptions } from './utils';
|
|
12
12
|
|
|
13
|
-
const Stack =
|
|
13
|
+
const Stack = createNativeStackNavigator();
|
|
14
14
|
const SharedStack = memo(() => {
|
|
15
15
|
const t = useTranslations();
|
|
16
16
|
const { toggleDrawer, goBack } = useNavigation();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
import SmartAccount from '../screens/SmartAccount';
|
|
4
4
|
import SmartAccountConnecting from '../screens/SmartAccount/Connecting';
|
|
@@ -8,7 +8,7 @@ import SuccessfullyConnected from '../screens/SmartAccount/SuccessfullyConnected
|
|
|
8
8
|
import Route from '../utils/Route';
|
|
9
9
|
import { screenOptions } from './utils';
|
|
10
10
|
|
|
11
|
-
const Stack =
|
|
11
|
+
const Stack = createNativeStackNavigator();
|
|
12
12
|
|
|
13
13
|
export const SmartAccountStack = memo(() => {
|
|
14
14
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
|
|
4
4
|
import SelectIrDeviceType from '../screens/SmartIr/components/SelectIrDeviceType';
|
|
@@ -7,7 +7,7 @@ import GroupButtonByType from '../screens/SmartIr/components/GroupButtonByType/G
|
|
|
7
7
|
import Route from '../utils/Route';
|
|
8
8
|
import { screenOptions } from './utils';
|
|
9
9
|
|
|
10
|
-
const Stack =
|
|
10
|
+
const Stack = createNativeStackNavigator();
|
|
11
11
|
|
|
12
12
|
export const SmartIrStack = memo(() => {
|
|
13
13
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
|
|
4
4
|
import Route from '../utils/Route';
|
|
@@ -8,7 +8,7 @@ import AutoLock from '../commons/ActionGroup/OnOffSmartLock/AutoLock/index';
|
|
|
8
8
|
import PasscodeList from '../commons/ActionGroup/OnOffSmartLock/PasscodeList/index';
|
|
9
9
|
import ItemPasscode from '../commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode';
|
|
10
10
|
|
|
11
|
-
const Stack =
|
|
11
|
+
const Stack = createNativeStackNavigator();
|
|
12
12
|
|
|
13
13
|
export const SmartLockStack = memo(() => {
|
|
14
14
|
return (
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
3
3
|
|
|
4
4
|
import Routes from '../utils/Route';
|
|
5
5
|
import { screenOptions } from './utils';
|
|
6
6
|
import Smart from '../screens/Smart';
|
|
7
7
|
|
|
8
|
-
const Stack =
|
|
8
|
+
const Stack = createNativeStackNavigator();
|
|
9
9
|
|
|
10
10
|
const SmartStack = memo(() => {
|
|
11
11
|
return (
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
3
3
|
|
|
4
4
|
import Routes from '../utils/Route';
|
|
5
5
|
import { screenOptions } from './utils';
|
|
6
6
|
import Template from '../screens/Template';
|
|
7
7
|
|
|
8
|
-
const Stack =
|
|
8
|
+
const Stack = createNativeStackNavigator();
|
|
9
9
|
|
|
10
10
|
const TemplateStack = memo(() => {
|
|
11
11
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { memo, useContext, useEffect } from 'react';
|
|
2
2
|
import { AppState, View } from 'react-native';
|
|
3
3
|
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
4
|
-
import {
|
|
4
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
5
5
|
import { BleManager } from 'react-native-ble-plx';
|
|
6
6
|
import NetInfo from '@react-native-community/netinfo';
|
|
7
7
|
import { get } from 'lodash';
|
|
@@ -69,7 +69,7 @@ import SetupScriptNotify from '../screens/Automate/AddNewAction/SetupScriptNotif
|
|
|
69
69
|
import SetupScriptDelay from '../screens/Automate/AddNewAction/SetupScriptDelay';
|
|
70
70
|
import UpdateActionScript from '../screens/Automate/EditActionsList/UpdateActionScript';
|
|
71
71
|
|
|
72
|
-
const Stack =
|
|
72
|
+
const Stack = createNativeStackNavigator();
|
|
73
73
|
|
|
74
74
|
const bleManager = new BleManager();
|
|
75
75
|
|
package/src/navigations/utils.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { CardStyleInterpolators } from '@react-navigation/stack';
|
|
3
2
|
import { StackActions } from '@react-navigation/native';
|
|
4
3
|
|
|
5
4
|
// NavigationContainer is referred here - Check NavigationStack
|
|
@@ -13,9 +12,7 @@ export function goBack() {
|
|
|
13
12
|
navigationRef.current?.goBack();
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
export const screenOptions = {
|
|
17
|
-
cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS,
|
|
18
|
-
};
|
|
15
|
+
export const screenOptions = {};
|
|
19
16
|
|
|
20
17
|
export const popAction = (value) => StackActions.pop(value);
|
|
21
18
|
|
|
@@ -49,32 +49,7 @@ describe('Test Automate', () => {
|
|
|
49
49
|
data: [
|
|
50
50
|
{
|
|
51
51
|
type: 'MultiUnit',
|
|
52
|
-
automates: [
|
|
53
|
-
{
|
|
54
|
-
id: 1,
|
|
55
|
-
user: 2,
|
|
56
|
-
type: 'one_tap',
|
|
57
|
-
activate_at: '2021-09-17T05:30:00Z',
|
|
58
|
-
script: {
|
|
59
|
-
id: 1,
|
|
60
|
-
name: 'script',
|
|
61
|
-
icon: undefined,
|
|
62
|
-
icon_kit: undefined,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: 2,
|
|
67
|
-
user: 2,
|
|
68
|
-
type: 'one_tap',
|
|
69
|
-
activate_at: '2021-09-17T05:30:00Z',
|
|
70
|
-
script: {
|
|
71
|
-
id: 1,
|
|
72
|
-
name: 'script2',
|
|
73
|
-
icon: undefined,
|
|
74
|
-
icon_kit: undefined,
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
],
|
|
52
|
+
automates: [],
|
|
78
53
|
},
|
|
79
54
|
],
|
|
80
55
|
};
|
|
@@ -98,7 +73,7 @@ describe('Test Automate', () => {
|
|
|
98
73
|
|
|
99
74
|
const instance = tree.root;
|
|
100
75
|
const FlatLists = instance.findAllByType(FlatList);
|
|
101
|
-
expect(FlatLists).toHaveLength(
|
|
76
|
+
expect(FlatLists).toHaveLength(1); // only 1 flat list
|
|
102
77
|
|
|
103
78
|
const ItemAddNews = instance.findAllByType(ItemAddNew);
|
|
104
79
|
expect(ItemAddNews).toHaveLength(1);
|
|
@@ -186,7 +161,7 @@ describe('Test Automate', () => {
|
|
|
186
161
|
|
|
187
162
|
const instance = tree.root;
|
|
188
163
|
const FlatLists = instance.findAllByType(FlatList);
|
|
189
|
-
expect(FlatLists).toHaveLength(
|
|
164
|
+
expect(FlatLists).toHaveLength(1); // only 1 flat list
|
|
190
165
|
const ItemOneTaps = instance.findAllByType(ItemOneTap);
|
|
191
166
|
expect(ItemOneTaps).toHaveLength(1);
|
|
192
167
|
await act(async () => {
|
|
@@ -58,7 +58,14 @@ const Automate = () => {
|
|
|
58
58
|
setIsLoading(true);
|
|
59
59
|
const { success, data } = await axiosGet(API.AUTOMATE.GET_SMART());
|
|
60
60
|
if (success && data && data.length) {
|
|
61
|
-
|
|
61
|
+
const multiUnit = data[0];
|
|
62
|
+
const haveAutomates = data
|
|
63
|
+
.slice(1)
|
|
64
|
+
.filter((unit) => unit.automates.length);
|
|
65
|
+
const notHaveAutomates = data
|
|
66
|
+
.slice(1)
|
|
67
|
+
.filter((unit) => !unit.automates.length);
|
|
68
|
+
setAutomatesData([multiUnit, ...haveAutomates, ...notHaveAutomates]);
|
|
62
69
|
}
|
|
63
70
|
setIsLoading(false);
|
|
64
71
|
}, []);
|
|
@@ -137,16 +144,6 @@ const Automate = () => {
|
|
|
137
144
|
const isOwner = owner_unit_id
|
|
138
145
|
? owner_unit_id === idUser
|
|
139
146
|
: type === UNIT_TYPES.MULTI;
|
|
140
|
-
const renderItemAutomate = ({ item: automate }) => {
|
|
141
|
-
return (
|
|
142
|
-
<ItemOneTap
|
|
143
|
-
isOwner={isOwner}
|
|
144
|
-
automate={automate}
|
|
145
|
-
wrapSyles={styles.wrapAutomateItem}
|
|
146
|
-
onPressItem={() => onPressItem(automate, unit_id, type, isOwner)}
|
|
147
|
-
/>
|
|
148
|
-
);
|
|
149
|
-
};
|
|
150
147
|
|
|
151
148
|
return (
|
|
152
149
|
<View style={styles.wrapUniItem}>
|
|
@@ -167,16 +164,29 @@ const Automate = () => {
|
|
|
167
164
|
<Image source={Images.arrowBack} style={styles.arrowRight} />
|
|
168
165
|
</TouchableOpacity>
|
|
169
166
|
</View>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
167
|
+
{!!automates?.length && (
|
|
168
|
+
<View style={styles.automatesRow}>
|
|
169
|
+
<ItemOneTap
|
|
170
|
+
isOwner={isOwner}
|
|
171
|
+
automate={automates[0]}
|
|
172
|
+
wrapSyles={styles.wrapAutomateItem}
|
|
173
|
+
onPressItem={() =>
|
|
174
|
+
onPressItem(automates[0], unit_id, type, isOwner)
|
|
175
|
+
}
|
|
176
|
+
/>
|
|
177
|
+
{!!automates[1] && (
|
|
178
|
+
<ItemOneTap
|
|
179
|
+
isOwner={isOwner}
|
|
180
|
+
automate={automates[1]}
|
|
181
|
+
wrapSyles={styles.wrapAutomateItem}
|
|
182
|
+
onPressItem={() =>
|
|
183
|
+
onPressItem(automates[1], unit_id, type, isOwner)
|
|
184
|
+
}
|
|
185
|
+
/>
|
|
186
|
+
)}
|
|
187
|
+
</View>
|
|
188
|
+
)}
|
|
189
|
+
{!automates?.length && renderListFooterComponent(unit_id, automates)}
|
|
180
190
|
</View>
|
|
181
191
|
);
|
|
182
192
|
},
|
|
@@ -184,12 +194,15 @@ const Automate = () => {
|
|
|
184
194
|
[sortedAutomateData]
|
|
185
195
|
);
|
|
186
196
|
|
|
187
|
-
const renderListFooterComponent = (
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
const renderListFooterComponent = useCallback(
|
|
198
|
+
(unitId, automates) => (
|
|
199
|
+
<ItemAddNew
|
|
200
|
+
title={t('add_new')}
|
|
201
|
+
onAddNew={() => handleOnAddNew(unitId, automates)}
|
|
202
|
+
wrapStyle={styles.addNewItem}
|
|
203
|
+
/>
|
|
204
|
+
),
|
|
205
|
+
[handleOnAddNew, t]
|
|
193
206
|
);
|
|
194
207
|
|
|
195
208
|
useLayoutEffect(() => {
|
|
@@ -204,13 +217,12 @@ const Automate = () => {
|
|
|
204
217
|
}, [setOptions]);
|
|
205
218
|
|
|
206
219
|
useEffect(() => {
|
|
207
|
-
getAutomates();
|
|
208
|
-
|
|
209
|
-
}, [isFocused]);
|
|
220
|
+
isFocused && getAutomates();
|
|
221
|
+
}, [isFocused, getAutomates]);
|
|
210
222
|
|
|
211
223
|
return (
|
|
212
224
|
<View style={styles.wrap}>
|
|
213
|
-
{isLoading &&
|
|
225
|
+
{isLoading && <Loading />}
|
|
214
226
|
<FlatList
|
|
215
227
|
keyExtractor={keyExtractor}
|
|
216
228
|
data={sortedAutomateData}
|
|
@@ -220,6 +232,11 @@ const Automate = () => {
|
|
|
220
232
|
refreshing={false}
|
|
221
233
|
onRefresh={getAutomates}
|
|
222
234
|
scrollIndicatorInsets={{ right: 1 }}
|
|
235
|
+
getItemLayout={(data, index) => ({
|
|
236
|
+
length: 180,
|
|
237
|
+
offset: 180 * index,
|
|
238
|
+
index,
|
|
239
|
+
})}
|
|
223
240
|
/>
|
|
224
241
|
</View>
|
|
225
242
|
);
|
|
@@ -144,6 +144,11 @@ const Shared = () => {
|
|
|
144
144
|
ItemSeparatorComponent={() => <View style={styles.seperator} />}
|
|
145
145
|
contentContainerStyle={styles.scrollView}
|
|
146
146
|
scrollIndicatorInsets={{ right: 1 }}
|
|
147
|
+
getItemLayout={(data, index) => ({
|
|
148
|
+
length: 52,
|
|
149
|
+
offset: 52 * index,
|
|
150
|
+
index,
|
|
151
|
+
})}
|
|
147
152
|
/>
|
|
148
153
|
) : (
|
|
149
154
|
<FlatList
|
|
@@ -325,11 +325,7 @@ const UnitDetail = ({ route }) => {
|
|
|
325
325
|
}, [isFirstOpenCamera, isIOS]);
|
|
326
326
|
|
|
327
327
|
return (
|
|
328
|
-
<WrapParallaxScrollView
|
|
329
|
-
unit={unit}
|
|
330
|
-
unitData={unitData}
|
|
331
|
-
onRefresh={onRefresh}
|
|
332
|
-
>
|
|
328
|
+
<WrapParallaxScrollView unit={unit} onRefresh={onRefresh}>
|
|
333
329
|
{isFirstOpenCamera && isIOS && (
|
|
334
330
|
<MediaPlayerDetail
|
|
335
331
|
uri={Constants.URL_STREAM_CAMERA_DEMO}
|
|
@@ -14,6 +14,7 @@ const MoreMenu = ({
|
|
|
14
14
|
idLabelScrollView,
|
|
15
15
|
idLabelItem,
|
|
16
16
|
}) => {
|
|
17
|
+
const { id } = unit;
|
|
17
18
|
const t = useTranslations();
|
|
18
19
|
const navigation = useNavigation();
|
|
19
20
|
|
|
@@ -30,25 +31,25 @@ const MoreMenu = ({
|
|
|
30
31
|
id: 'mange-unit',
|
|
31
32
|
route: Routes.ManageUnit,
|
|
32
33
|
text: t('manage_unit'),
|
|
33
|
-
data: { unitId:
|
|
34
|
+
data: { unitId: id, unit },
|
|
34
35
|
};
|
|
35
36
|
const RouteUnitMemberList = {
|
|
36
37
|
id: 'unit-member',
|
|
37
38
|
route: Routes.UnitMemberList,
|
|
38
39
|
text: t('members'),
|
|
39
|
-
data: { unitId:
|
|
40
|
+
data: { unitId: id, unit },
|
|
40
41
|
};
|
|
41
42
|
const ListSmartAccount = {
|
|
42
43
|
id: 'smart-account',
|
|
43
44
|
route: Routes.ListSmartAccount,
|
|
44
45
|
text: t('smart_account'),
|
|
45
|
-
data: { unitId:
|
|
46
|
+
data: { unitId: id, unit },
|
|
46
47
|
};
|
|
47
48
|
const RouteAllGateway = {
|
|
48
49
|
id: 'all-gateway',
|
|
49
50
|
route: Routes.AllGateway,
|
|
50
51
|
text: t('all_gateway'),
|
|
51
|
-
data: { unitId:
|
|
52
|
+
data: { unitId: id, unit },
|
|
52
53
|
};
|
|
53
54
|
return isOwner
|
|
54
55
|
? [
|
|
@@ -58,7 +59,7 @@ const MoreMenu = ({
|
|
|
58
59
|
RouteAllGateway,
|
|
59
60
|
]
|
|
60
61
|
: [RouteUnitMemberList];
|
|
61
|
-
}, [t, unit, isOwner]);
|
|
62
|
+
}, [t, id, unit, isOwner]);
|
|
62
63
|
|
|
63
64
|
return (
|
|
64
65
|
<MenuActionMore
|
|
@@ -9,7 +9,11 @@ const mockHidePopover = jest.fn();
|
|
|
9
9
|
|
|
10
10
|
const wrapComponent = (showingPopover) => (
|
|
11
11
|
<SCProvider initState={mockSCStore({})}>
|
|
12
|
-
<MoreMenu
|
|
12
|
+
<MoreMenu
|
|
13
|
+
showingPopover={showingPopover}
|
|
14
|
+
hidePopover={mockHidePopover}
|
|
15
|
+
unit={{ id: 1 }}
|
|
16
|
+
/>
|
|
13
17
|
</SCProvider>
|
|
14
18
|
);
|
|
15
19
|
|
|
@@ -4,9 +4,9 @@ import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
|
4
4
|
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
5
5
|
import Text from '../../../../commons/Text';
|
|
6
6
|
import FImage from '../../../../commons/FImage';
|
|
7
|
-
import OneTap from '../../../../../assets/images/
|
|
8
|
-
import ValueChange from '../../../../../assets/images/
|
|
9
|
-
import Schedule from '../../../../../assets/images/
|
|
7
|
+
import OneTap from '../../../../../assets/images/Scenario-filled.svg';
|
|
8
|
+
import ValueChange from '../../../../../assets/images/Automation-fill.svg';
|
|
9
|
+
import Schedule from '../../../../../assets/images/schedule-fill.svg';
|
|
10
10
|
import Event from '../../../../../assets/images/Event.svg';
|
|
11
11
|
import styles from './styles';
|
|
12
12
|
import {
|
|
@@ -25,7 +25,7 @@ const Item = memo(({ id, svgMain, title, measure, des, color, waterType }) => {
|
|
|
25
25
|
<TouchableOpacity onPress={goToDetail} style={styles.buttonInfo}>
|
|
26
26
|
<AntDesign
|
|
27
27
|
style={styles.row}
|
|
28
|
-
name="
|
|
28
|
+
name="infocirlceo"
|
|
29
29
|
size={20}
|
|
30
30
|
color={Colors.Black}
|
|
31
31
|
/>
|