@eohjsc/react-native-smart-city 0.4.21 → 0.4.23
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/screens/AllCamera/index.js +1 -0
- package/src/screens/Automate/AddNewAction/NewActionWrapper.js +7 -13
- package/src/screens/Automate/AddNewAction/Styles/SelectActionStyles.js +5 -1
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +19 -0
- package/src/screens/Automate/ScriptDetail/index.js +7 -1
- package/src/utils/I18n/translations/vi.js +2 -1
package/package.json
CHANGED
|
@@ -3,12 +3,12 @@ import { TouchableOpacity, View } from 'react-native';
|
|
|
3
3
|
import { KeyboardAwareScrollView } from '@eohjsc/react-native-keyboard-aware-scroll-view';
|
|
4
4
|
|
|
5
5
|
import styles from './Styles/SelectActionStyles';
|
|
6
|
-
import WrapHeaderScrollable from '../../../commons/Sharing/WrapHeaderScrollable';
|
|
7
6
|
import { Icon } from '@ant-design/react-native';
|
|
8
7
|
import { Colors } from '../../../configs';
|
|
9
8
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
10
9
|
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
11
10
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
11
|
+
import { HeaderCustom } from '../../../commons';
|
|
12
12
|
|
|
13
13
|
const NewActionWrapper = ({ name, children, canNext, onNext, nextTitle }) => {
|
|
14
14
|
const { navigate } = useNavigation();
|
|
@@ -34,20 +34,14 @@ const NewActionWrapper = ({ name, children, canNext, onNext, nextTitle }) => {
|
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
36
|
<View style={styles.wrap}>
|
|
37
|
-
<
|
|
37
|
+
<HeaderCustom
|
|
38
38
|
title={name}
|
|
39
|
-
headerAniStyle={styles.headerAniStyle}
|
|
40
39
|
rightComponent={rightComponent}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
>
|
|
47
|
-
{children}
|
|
48
|
-
</KeyboardAwareScrollView>
|
|
49
|
-
</WrapHeaderScrollable>
|
|
50
|
-
|
|
40
|
+
headerStyles={styles.headerAniStyle}
|
|
41
|
+
isShowSeparator
|
|
42
|
+
wrapTitleStyle={styles.wrapTitleStyle}
|
|
43
|
+
/>
|
|
44
|
+
<KeyboardAwareScrollView>{children}</KeyboardAwareScrollView>
|
|
51
45
|
<BottomButtonView
|
|
52
46
|
style={styles.bottomButtonView}
|
|
53
47
|
mainTitle={nextTitle}
|
|
@@ -27,7 +27,7 @@ export default StyleSheet.create({
|
|
|
27
27
|
marginTop: 32,
|
|
28
28
|
},
|
|
29
29
|
headerAniStyle: {
|
|
30
|
-
|
|
30
|
+
marginTop: 10,
|
|
31
31
|
},
|
|
32
32
|
closeButton: {
|
|
33
33
|
width: 40,
|
|
@@ -63,4 +63,8 @@ export default StyleSheet.create({
|
|
|
63
63
|
paddingHorizontal: 16,
|
|
64
64
|
marginTop: Constants.height * 0.3,
|
|
65
65
|
},
|
|
66
|
+
wrapTitleStyle: {
|
|
67
|
+
alignItems: 'flex-start',
|
|
68
|
+
paddingLeft: 20,
|
|
69
|
+
},
|
|
66
70
|
});
|
|
@@ -146,6 +146,24 @@ describe('Test ScriptDetail', () => {
|
|
|
146
146
|
);
|
|
147
147
|
});
|
|
148
148
|
|
|
149
|
+
it('test cannot change type script', async () => {
|
|
150
|
+
route.params.preAutomate.can_edit = false;
|
|
151
|
+
const spyToastError = jest.spyOn(ToastBottomHelper, 'error');
|
|
152
|
+
|
|
153
|
+
await act(async () => {
|
|
154
|
+
tree = await create(wrapComponent(route));
|
|
155
|
+
});
|
|
156
|
+
const instance = tree.root;
|
|
157
|
+
const itemAutomate = instance.findByType(ItemAutomate);
|
|
158
|
+
|
|
159
|
+
await act(async () => {
|
|
160
|
+
await itemAutomate.props.onPress();
|
|
161
|
+
});
|
|
162
|
+
expect(spyToastError).toBeCalledWith(
|
|
163
|
+
getTranslate('en', 'only_owner_has_permission_to_edit_this_script')
|
|
164
|
+
);
|
|
165
|
+
});
|
|
166
|
+
|
|
149
167
|
it('test delete script', async () => {
|
|
150
168
|
await act(async () => {
|
|
151
169
|
tree = await create(wrapComponent(route));
|
|
@@ -367,6 +385,7 @@ describe('Test ScriptDetail', () => {
|
|
|
367
385
|
route.params = {
|
|
368
386
|
...route.params,
|
|
369
387
|
preAutomate: {
|
|
388
|
+
can_edit: true,
|
|
370
389
|
type: AUTOMATE_TYPE.VALUE_CHANGE,
|
|
371
390
|
value_change: {
|
|
372
391
|
config_name: 'Light Value',
|
|
@@ -130,11 +130,17 @@ const ScriptDetail = ({ route }) => {
|
|
|
130
130
|
}, [id, t]);
|
|
131
131
|
|
|
132
132
|
const handleUpdateAutomate = useCallback(async () => {
|
|
133
|
+
if (!automate?.can_edit) {
|
|
134
|
+
ToastBottomHelper.error(
|
|
135
|
+
t('only_owner_has_permission_to_edit_this_script')
|
|
136
|
+
);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
133
139
|
navigate(Routes.AddUnknownTypeSmart, {
|
|
134
140
|
automate,
|
|
135
141
|
closeScreen: route.name,
|
|
136
142
|
});
|
|
137
|
-
}, [
|
|
143
|
+
}, [automate, navigate, route.name, t]);
|
|
138
144
|
|
|
139
145
|
useEffect(() => {
|
|
140
146
|
fetchAutomate();
|
|
@@ -1012,8 +1012,10 @@ export default {
|
|
|
1012
1012
|
lg_sync_failed: 'Đồng bộ thiết bị LG thất bại!',
|
|
1013
1013
|
lg_sync_success: 'Đồng bộ thiết bị LG thành công!',
|
|
1014
1014
|
setting_at: 'Thiết lập tại',
|
|
1015
|
+
name_your_scenario: 'Đặt tên cho kịch bản của bạn',
|
|
1015
1016
|
name_your_button: 'Đặt tên cho nút nhấn của bạn',
|
|
1016
1017
|
name_your_script: 'Đặt tên cho kịch bản của bạn',
|
|
1018
|
+
name_your_automation: 'Đặt tên cho kịch bản của bạn',
|
|
1017
1019
|
continue: 'Tiếp tục',
|
|
1018
1020
|
tap_to_run: 'Nhấn để chạy',
|
|
1019
1021
|
how_to_start: 'Cách khởi động',
|
|
@@ -1434,5 +1436,4 @@ export default {
|
|
|
1434
1436
|
you_can_only_add_more: 'Bạn chỉ có thể thêm {number}',
|
|
1435
1437
|
actions: 'hành động',
|
|
1436
1438
|
value_must_be_less_than_8_character: 'Giá trị phải ít hơn hoặc bằng 8 kí tự',
|
|
1437
|
-
name_your_automation: 'Đặt tên cho kịch bản của bạn',
|
|
1438
1439
|
};
|