@eohjsc/react-native-smart-city 0.7.36 → 0.7.38
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/Device/ItemDevice.js +1 -1
- package/src/commons/Header/Styles/HeaderCustomStyles.js +1 -1
- package/src/commons/HeaderAni/index.js +1 -1
- package/src/commons/MenuActionAddnew/index.js +20 -32
- package/src/commons/Unit/HeaderUnit/index.js +2 -3
- package/src/commons/WrapParallaxScrollView/index.js +2 -3
- package/src/configs/Device.js +1 -1
- package/src/screens/Automate/AddNewAction/ChooseAction.js +1 -1
- package/src/screens/Automate/AddNewAction/SetupScriptDelay.js +2 -2
- package/src/screens/Automate/AddNewAction/SetupScriptReceiverEmail.js +2 -2
- package/src/screens/Automate/AddNewAction/SetupScriptReceiverNotify.js +2 -2
- package/src/screens/Automate/AddNewAction/SetupScriptReceiverSms.js +2 -2
- package/src/screens/Automate/EditActionsList/UpdateReceiverEmailScript.js +1 -1
- package/src/screens/Automate/EditActionsList/UpdateReceiverSmsScript.js +1 -1
- package/src/screens/Automate/EditActionsList/index.js +4 -3
- package/src/screens/Automate/ScriptDetail/index.js +3 -1
- package/src/screens/Automate/index.js +5 -6
- package/src/screens/Notification/index.js +6 -2
- package/src/screens/SharedUnit/index.js +2 -1
- package/src/screens/SubUnit/AddSubUnitStyles.js +1 -1
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import { AccessibilityLabel } from '../../configs/Constants';
|
|
|
10
10
|
|
|
11
11
|
const screenHeight = Constants.height;
|
|
12
12
|
const default_height = 45;
|
|
13
|
-
const paddingIos = getStatusBarHeight() +
|
|
13
|
+
const paddingIos = getStatusBarHeight() + 30;
|
|
14
14
|
export const title_height = 44;
|
|
15
15
|
export const heightHeader = default_height + title_height + paddingIos;
|
|
16
16
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { memo, useCallback } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
4
|
|
|
5
5
|
import { Colors } from '../../configs';
|
|
@@ -8,7 +8,6 @@ import ImageButton from '../ImageButton';
|
|
|
8
8
|
import { ModalCustom } from '../Modal';
|
|
9
9
|
import packageJson from '../../../package.json';
|
|
10
10
|
|
|
11
|
-
const keyExtractor = (item) => item.id.toString();
|
|
12
11
|
const MenuActionAddnew = memo(
|
|
13
12
|
({ visible, hideModal, dataActions, onItemClick }) => {
|
|
14
13
|
const t = useTranslations();
|
|
@@ -21,25 +20,6 @@ const MenuActionAddnew = memo(
|
|
|
21
20
|
[onItemClick]
|
|
22
21
|
);
|
|
23
22
|
|
|
24
|
-
const renderItem = useCallback(
|
|
25
|
-
({ item }) => {
|
|
26
|
-
return (
|
|
27
|
-
<View
|
|
28
|
-
style={{
|
|
29
|
-
...styles.action,
|
|
30
|
-
flexBasis: `${100 / numColumns}%`,
|
|
31
|
-
}}
|
|
32
|
-
>
|
|
33
|
-
<ImageButton onPress={() => onPress(item)} image={item.image} />
|
|
34
|
-
<View style={styles.actionTextWrap}>
|
|
35
|
-
<Text styles={styles.actionText}>{item.text}</Text>
|
|
36
|
-
</View>
|
|
37
|
-
</View>
|
|
38
|
-
);
|
|
39
|
-
},
|
|
40
|
-
[numColumns, onPress]
|
|
41
|
-
);
|
|
42
|
-
|
|
43
23
|
return (
|
|
44
24
|
<ModalCustom
|
|
45
25
|
isVisible={visible}
|
|
@@ -53,15 +33,23 @@ const MenuActionAddnew = memo(
|
|
|
53
33
|
<Text style={styles.modalHeaderText}>{t('add_new')}</Text>
|
|
54
34
|
</View>
|
|
55
35
|
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
36
|
+
<View style={styles.actionWrapper}>
|
|
37
|
+
{dataActions.map((item) => (
|
|
38
|
+
<View
|
|
39
|
+
key={item.id.toString()}
|
|
40
|
+
style={[styles.action, { width: `${100 / numColumns}%` }]}
|
|
41
|
+
>
|
|
42
|
+
<ImageButton
|
|
43
|
+
onPress={() => onPress(item)}
|
|
44
|
+
image={item.image}
|
|
45
|
+
/>
|
|
46
|
+
<View style={styles.actionTextWrap}>
|
|
47
|
+
<Text style={styles.actionText}>{item.text}</Text>
|
|
48
|
+
</View>
|
|
49
|
+
</View>
|
|
50
|
+
))}
|
|
51
|
+
</View>
|
|
52
|
+
|
|
65
53
|
<View style={styles.modalHeader}>
|
|
66
54
|
<Text
|
|
67
55
|
style={styles.modalHeaderText}
|
|
@@ -88,7 +76,6 @@ const styles = StyleSheet.create({
|
|
|
88
76
|
borderRadius: 10,
|
|
89
77
|
},
|
|
90
78
|
modalWrapper: {
|
|
91
|
-
flex: 1,
|
|
92
79
|
flexDirection: 'column',
|
|
93
80
|
backgroundColor: Colors.White,
|
|
94
81
|
borderRadius: 10,
|
|
@@ -110,7 +97,8 @@ const styles = StyleSheet.create({
|
|
|
110
97
|
},
|
|
111
98
|
actionWrapper: {
|
|
112
99
|
padding: 16,
|
|
113
|
-
|
|
100
|
+
flexDirection: 'row',
|
|
101
|
+
flexWrap: 'wrap',
|
|
114
102
|
},
|
|
115
103
|
action: {
|
|
116
104
|
marginBottom: 25,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { memo, useCallback, useMemo, useRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
4
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
5
5
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
@@ -106,8 +106,7 @@ const HeaderUnit = memo(({ transparent, unit }) => {
|
|
|
106
106
|
|
|
107
107
|
export default HeaderUnit;
|
|
108
108
|
|
|
109
|
-
const stickyHeaderHeight =
|
|
110
|
-
Device.TopbarHeight + (Device.isIOS ? 0 : StatusBar.currentHeight);
|
|
109
|
+
const stickyHeaderHeight = Device.TopbarHeight + (Device.isIOS ? 0 : 30);
|
|
111
110
|
|
|
112
111
|
const styles = StyleSheet.create({
|
|
113
112
|
container: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { View, StyleSheet, RefreshControl } from 'react-native';
|
|
3
3
|
import LinearGradient from 'react-native-linear-gradient';
|
|
4
4
|
|
|
5
5
|
import { Colors, Device, Images, SCConfig } from '../../configs';
|
|
@@ -10,8 +10,7 @@ import FImage from '../FImage';
|
|
|
10
10
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
11
11
|
import ParallaxScrollView from '../../libs/react-native-parallax-scroll-view';
|
|
12
12
|
|
|
13
|
-
const stickyHeaderHeight =
|
|
14
|
-
Device.TopbarHeight + (Device.isIOS ? 0 : StatusBar.currentHeight);
|
|
13
|
+
const stickyHeaderHeight = Device.TopbarHeight + (Device.isIOS ? 0 : 30);
|
|
15
14
|
|
|
16
15
|
const WrapParallaxScrollView = ({ children, unit, onRefresh }) => {
|
|
17
16
|
const { name = '', background } = unit;
|
package/src/configs/Device.js
CHANGED
|
@@ -17,6 +17,6 @@ export default {
|
|
|
17
17
|
isIOS: Platform.OS === 'ios',
|
|
18
18
|
isIphoneX,
|
|
19
19
|
ToolbarHeight: isIphoneX ? 44 : Platform.OS === 'ios' ? 20 : 0,
|
|
20
|
-
TopbarHeight: isIphoneX ? 88 : Platform.OS === 'ios' ? 64 :
|
|
20
|
+
TopbarHeight: isIphoneX ? 88 : Platform.OS === 'ios' ? 64 : 50, //incule toolbar
|
|
21
21
|
androidSmallHeight: Platform.OS === 'android' && height < 600,
|
|
22
22
|
};
|
|
@@ -37,12 +37,12 @@ const SetupScriptDelay = ({ route }) => {
|
|
|
37
37
|
navigate({
|
|
38
38
|
name: Routes.ScriptDetail,
|
|
39
39
|
merge: true,
|
|
40
|
-
params: { saveAt: moment().valueOf() },
|
|
40
|
+
params: { saveAt: moment().valueOf(), automate },
|
|
41
41
|
});
|
|
42
42
|
} else {
|
|
43
43
|
ToastBottomHelper.error(t('error_please_try_later'));
|
|
44
44
|
}
|
|
45
|
-
}, [automateId, navigate, delay, t]);
|
|
45
|
+
}, [automateId, navigate, delay, t, automate]);
|
|
46
46
|
|
|
47
47
|
const canSave = useMemo(() => {
|
|
48
48
|
const value = parseInt(delay, 10);
|
|
@@ -27,12 +27,12 @@ const SetupScriptReceiverEmail = ({ route }) => {
|
|
|
27
27
|
navigate({
|
|
28
28
|
name: Routes.ScriptDetail,
|
|
29
29
|
merge: true,
|
|
30
|
-
params: { saveAt: moment().valueOf() },
|
|
30
|
+
params: { saveAt: moment().valueOf(), automate },
|
|
31
31
|
});
|
|
32
32
|
} else {
|
|
33
33
|
ToastBottomHelper.error(t('error_please_try_later'));
|
|
34
34
|
}
|
|
35
|
-
}, [automateId, formData, listUser, navigate, t]);
|
|
35
|
+
}, [automate, automateId, formData, listUser, navigate, t]);
|
|
36
36
|
|
|
37
37
|
const onLoadOption = useCallback(
|
|
38
38
|
(item) => {
|
|
@@ -27,12 +27,12 @@ const SetupScriptReceiverNotify = ({ route }) => {
|
|
|
27
27
|
navigate({
|
|
28
28
|
name: Routes.ScriptDetail,
|
|
29
29
|
merge: true,
|
|
30
|
-
params: { saveAt: moment().valueOf() },
|
|
30
|
+
params: { saveAt: moment().valueOf(), automate },
|
|
31
31
|
});
|
|
32
32
|
} else {
|
|
33
33
|
ToastBottomHelper.error(t('error_please_try_later'));
|
|
34
34
|
}
|
|
35
|
-
}, [automateId, formData, listUser, navigate, t]);
|
|
35
|
+
}, [automate, automateId, formData, listUser, navigate, t]);
|
|
36
36
|
|
|
37
37
|
const onLoadOption = useCallback(
|
|
38
38
|
(item) => {
|
|
@@ -27,12 +27,12 @@ const SetupScriptReceiverSms = ({ route }) => {
|
|
|
27
27
|
navigate({
|
|
28
28
|
name: Routes.ScriptDetail,
|
|
29
29
|
merge: true,
|
|
30
|
-
params: { saveAt: moment().valueOf() },
|
|
30
|
+
params: { saveAt: moment().valueOf(), automate },
|
|
31
31
|
});
|
|
32
32
|
} else {
|
|
33
33
|
ToastBottomHelper.error(t('error_please_try_later'));
|
|
34
34
|
}
|
|
35
|
-
}, [automateId, formData, listUser, navigate, t]);
|
|
35
|
+
}, [automate, automateId, formData, listUser, navigate, t]);
|
|
36
36
|
|
|
37
37
|
const onLoadOption = useCallback(
|
|
38
38
|
(item) => {
|
|
@@ -58,15 +58,16 @@ const EditActionsList = () => {
|
|
|
58
58
|
[id, t]
|
|
59
59
|
);
|
|
60
60
|
|
|
61
|
-
const
|
|
61
|
+
const onGoBack = useCallback(() => {
|
|
62
62
|
navigate({
|
|
63
63
|
name: Routes.ScriptDetail,
|
|
64
64
|
merge: true,
|
|
65
65
|
params: {
|
|
66
66
|
newActionsList: actionsList,
|
|
67
|
+
automate: { id: id },
|
|
67
68
|
},
|
|
68
69
|
});
|
|
69
|
-
}, [actionsList, navigate]);
|
|
70
|
+
}, [actionsList, navigate, id]);
|
|
70
71
|
|
|
71
72
|
const onPressRemove = (item) => {
|
|
72
73
|
setIsVisible(true);
|
|
@@ -478,7 +479,7 @@ const EditActionsList = () => {
|
|
|
478
479
|
|
|
479
480
|
return (
|
|
480
481
|
<GestureHandlerRootView style={styles.wrap}>
|
|
481
|
-
<HeaderCustom title={t('edit_actions_list')} onGoBack={
|
|
482
|
+
<HeaderCustom title={t('edit_actions_list')} onGoBack={onGoBack} />
|
|
482
483
|
<View style={styles.wrapContent}>
|
|
483
484
|
<Text type="Body" color={Colors.Gray8}>
|
|
484
485
|
{t('des_edit_actions_list')}
|
|
@@ -143,7 +143,7 @@ const ScriptDetail = ({ route }) => {
|
|
|
143
143
|
const index = state.routes.findIndex((r) => r.name === closeScreen);
|
|
144
144
|
let routes = [];
|
|
145
145
|
if (!closeScreen) {
|
|
146
|
-
routes = state.routes;
|
|
146
|
+
routes = [...state.routes];
|
|
147
147
|
} else if (index >= 0) {
|
|
148
148
|
routes = state.routes.slice(0, index + 1);
|
|
149
149
|
}
|
|
@@ -328,6 +328,8 @@ const ScriptDetail = ({ route }) => {
|
|
|
328
328
|
name: closeScreen,
|
|
329
329
|
merge: true,
|
|
330
330
|
});
|
|
331
|
+
} else if (closeScreen === Routes.ScriptDetail) {
|
|
332
|
+
navigate(Routes.UnitDetail, { unitId: unit });
|
|
331
333
|
} else {
|
|
332
334
|
goBack();
|
|
333
335
|
}
|
|
@@ -25,7 +25,6 @@ import { axiosGet } from '../../utils/Apis/axios';
|
|
|
25
25
|
import { useBackendPermission } from '../../utils/Permission/backend';
|
|
26
26
|
import Routes from '../../utils/Route';
|
|
27
27
|
import { keyExtractor, ToastBottomHelper } from '../../utils/Utils';
|
|
28
|
-
import Loading from './Components/Loading';
|
|
29
28
|
import styles from './Styles/indexStyles';
|
|
30
29
|
|
|
31
30
|
const Automate = () => {
|
|
@@ -34,7 +33,6 @@ const Automate = () => {
|
|
|
34
33
|
const isFocused = useIsFocused();
|
|
35
34
|
const { setOptions, navigate } = useNavigation();
|
|
36
35
|
const [automatesData, setAutomatesData] = useState([]);
|
|
37
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
38
36
|
const { name: currentRouteName } = useRoute();
|
|
39
37
|
const starredScriptIds = useSCContextSelector(
|
|
40
38
|
(state) => state.automate.starredScriptIds
|
|
@@ -55,8 +53,11 @@ const Automate = () => {
|
|
|
55
53
|
}, [automatesData, starredScriptIds]);
|
|
56
54
|
|
|
57
55
|
const getAutomates = useCallback(async () => {
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
const { success, data } = await axiosGet(
|
|
57
|
+
API.AUTOMATE.GET_SMART(),
|
|
58
|
+
{},
|
|
59
|
+
true
|
|
60
|
+
);
|
|
60
61
|
if (success && data && data.length) {
|
|
61
62
|
const multiUnit = data[0];
|
|
62
63
|
const haveAutomates = data
|
|
@@ -67,7 +68,6 @@ const Automate = () => {
|
|
|
67
68
|
.filter((unit) => !unit.automates.length);
|
|
68
69
|
setAutomatesData([multiUnit, ...haveAutomates, ...notHaveAutomates]);
|
|
69
70
|
}
|
|
70
|
-
setIsLoading(false);
|
|
71
71
|
}, []);
|
|
72
72
|
|
|
73
73
|
const onPressItem = useCallback(
|
|
@@ -224,7 +224,6 @@ const Automate = () => {
|
|
|
224
224
|
|
|
225
225
|
return (
|
|
226
226
|
<View style={styles.wrap}>
|
|
227
|
-
{isLoading && <Loading />}
|
|
228
227
|
<FlatList
|
|
229
228
|
keyExtractor={keyExtractor}
|
|
230
229
|
data={sortedAutomateData}
|
|
@@ -51,7 +51,9 @@ const Notification = memo(() => {
|
|
|
51
51
|
|
|
52
52
|
const fetchNotifications = useCallback(async (pageParam) => {
|
|
53
53
|
const { success, data } = await axiosGet(
|
|
54
|
-
API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(pageParam)
|
|
54
|
+
API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(pageParam),
|
|
55
|
+
{},
|
|
56
|
+
true
|
|
55
57
|
);
|
|
56
58
|
if (success) {
|
|
57
59
|
setNotifications((preState) => preState.concat(data.results));
|
|
@@ -69,7 +71,9 @@ const Notification = memo(() => {
|
|
|
69
71
|
const onRefresh = useCallback(async () => {
|
|
70
72
|
setPage(1);
|
|
71
73
|
const { success, data } = await axiosGet(
|
|
72
|
-
API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1)
|
|
74
|
+
API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1),
|
|
75
|
+
{},
|
|
76
|
+
true
|
|
73
77
|
);
|
|
74
78
|
if (success) {
|
|
75
79
|
setNotifications(data.results);
|