@eohjsc/react-native-smart-city 0.4.3 → 0.4.22

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.4.03",
4
+ "version": "0.4.22",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -146,6 +146,7 @@ const AllCamera = () => {
146
146
  item={item[2]}
147
147
  width={Constants.width / 2}
148
148
  height={112}
149
+ goToPlayBack={goToPlayBack}
149
150
  />
150
151
  <CameraItem
151
152
  key={item?.id}
@@ -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
- <WrapHeaderScrollable
37
+ <HeaderCustom
38
38
  title={name}
39
- headerAniStyle={styles.headerAniStyle}
40
39
  rightComponent={rightComponent}
41
- >
42
- <KeyboardAwareScrollView
43
- enableOnAndroid
44
- extraScrollHeight={100}
45
- nestedScrollEnabled
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
- borderBottomWidth: 0,
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
- }, [navigate, automate, route.name]);
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
  };