@eohjsc/react-native-smart-city 0.7.7 → 0.7.9

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.
Files changed (90) hide show
  1. package/assets/images/AddNewDevice/add-scan-device-icon.svg +13 -0
  2. package/assets/images/Email.svg +9 -0
  3. package/assets/images/lan.svg +3 -0
  4. package/assets/images/wifi-open.svg +3 -0
  5. package/package.json +4 -3
  6. package/src/commons/ActionGroup/StatesGridActionTemplate.js +7 -3
  7. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +7 -3
  8. package/src/commons/AlertAction/index.js +1 -0
  9. package/src/commons/Auth/AccountItem.js +17 -3
  10. package/src/commons/Auth/AccountList.js +3 -7
  11. package/src/commons/ConnectWifi/__test__/ConnectWifi.test.js +373 -0
  12. package/src/commons/ConnectWifi/index.js +201 -0
  13. package/src/commons/ConnectWifi/styles.js +69 -0
  14. package/src/commons/Device/LabelValue/__test__/LabelValue.test.js +74 -0
  15. package/src/commons/Device/LabelValue/index.js +49 -0
  16. package/src/commons/Device/LabelValue/styles.js +33 -0
  17. package/src/commons/Form/TextInputPassword.js +1 -1
  18. package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +6 -2
  19. package/src/configs/API.js +12 -0
  20. package/src/configs/AccessibilityLabel.js +7 -0
  21. package/src/configs/Constants.js +1 -0
  22. package/src/hooks/Common/index.js +2 -2
  23. package/src/hooks/Common/useBlockBack.js +36 -0
  24. package/src/hooks/useMqtt.js +10 -5
  25. package/src/navigations/AddGatewayStack.js +2 -0
  26. package/src/navigations/AllGatewayStack.js +4 -0
  27. package/src/navigations/Main.js +2 -2
  28. package/src/navigations/UnitStack.js +32 -0
  29. package/src/screens/AddNewGateway/ConnectingWifiDevice.js +7 -6
  30. package/src/screens/AddNewGateway/ScanDeviceLocal.js +267 -0
  31. package/src/screens/AddNewGateway/ScanDeviceLocalStyles.js +58 -0
  32. package/src/screens/AddNewGateway/SelectDeviceSubUnit.js +10 -2
  33. package/src/screens/AddNewGateway/SelectDeviceType.js +19 -2
  34. package/src/screens/AddNewGateway/__test__/ScanDeviceLocal.test.js +475 -0
  35. package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +2 -2
  36. package/src/screens/AddNewGateway/configs/API.js +8 -0
  37. package/src/screens/AddNewGateway/hooks/useConnectDevice.js +59 -0
  38. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +58 -1
  39. package/src/screens/AllGateway/GatewayInfo/index.js +8 -6
  40. package/src/screens/AllGateway/GatewayWifi/__test__/index.test.js +319 -0
  41. package/src/screens/AllGateway/GatewayWifi/index.js +107 -0
  42. package/src/screens/AllGateway/Successfully/__test__/index.test.js +77 -0
  43. package/src/screens/AllGateway/Successfully/index.js +66 -0
  44. package/src/screens/AllGateway/Successfully/styles.js +35 -0
  45. package/src/screens/AllGateway/components/Information/index.js +17 -1
  46. package/src/screens/AllGateway/components/RowItem/index.js +12 -1
  47. package/src/screens/AllGateway/hooks/__test__/index.test.js +18 -0
  48. package/src/screens/AllGateway/hooks/useGateway.js +13 -0
  49. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +3 -3
  50. package/src/screens/Automate/AddNewAction/SetupScriptEmail.js +79 -0
  51. package/src/screens/Automate/AddNewAction/SetupScriptReceiverEmail.js +166 -0
  52. package/src/screens/Automate/AddNewAction/Styles/SetupScriptEmailStyles.js +37 -0
  53. package/src/screens/Automate/AddNewAction/Styles/SetupScriptReceiverEmailStyles.js +79 -0
  54. package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +1 -1
  55. package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +13 -5
  56. package/src/screens/Automate/AddNewAction/__test__/SetupScriptEmail.test.js +76 -0
  57. package/src/screens/Automate/AddNewAction/__test__/SetupScriptReceiverEmail.test.js +105 -0
  58. package/src/screens/Automate/EditActionsList/Styles/UpdateReceiverEmailScriptStyles.js +78 -0
  59. package/src/screens/Automate/EditActionsList/UpdateEmailScript.js +80 -0
  60. package/src/screens/Automate/EditActionsList/UpdateReceiverEmailScript.js +179 -0
  61. package/src/screens/Automate/EditActionsList/__tests__/UpdateEmailScript.test.js +81 -0
  62. package/src/screens/Automate/EditActionsList/__tests__/UpdateReceiverEmailScript.test.js +83 -0
  63. package/src/screens/Automate/EditActionsList/__tests__/index.test.js +38 -5
  64. package/src/screens/Automate/EditActionsList/index.js +59 -2
  65. package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +20 -0
  66. package/src/screens/Automate/ScriptDetail/Styles/indexStyles.js +5 -3
  67. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +127 -21
  68. package/src/screens/Automate/ScriptDetail/index.js +57 -14
  69. package/src/screens/Device/__test__/sensorDisplayItem.test.js +22 -0
  70. package/src/screens/Device/components/SensorDisplayItem.js +10 -0
  71. package/src/screens/SharedUnit/index.js +2 -2
  72. package/src/screens/Sharing/SelectUser.js +47 -47
  73. package/src/screens/Sharing/__test__/SelectUser.test.js +57 -103
  74. package/src/screens/SubUnit/ManageSubUnit.js +94 -90
  75. package/src/screens/SubUnit/ManageSubUnitStyles.js +4 -6
  76. package/src/screens/SubUnit/RearrageSubUnit.js +90 -0
  77. package/src/screens/SubUnit/RearrrageSubUnitStyle.js +65 -0
  78. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +35 -19
  79. package/src/screens/SubUnit/__test__/RearrangeSubUnit.test.js +129 -0
  80. package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +6 -7
  81. package/src/screens/SubUnit/hooks/useManageSubUnit.js +8 -16
  82. package/src/screens/Unit/Detail.js +2 -6
  83. package/src/screens/Unit/ManageUnit.js +1 -1
  84. package/src/utils/Functions/__test__/ShortEmail.test.js +5 -0
  85. package/src/utils/I18n/translations/en.js +46 -8
  86. package/src/utils/I18n/translations/vi.js +37 -4
  87. package/src/utils/Route/index.js +7 -0
  88. package/src/commons/Auth/__test__/AccountItem.test.js +0 -31
  89. package/src/hooks/Common/useBlockBackAndroid.js +0 -21
  90. package/src/screens/SubUnit/DetailStyles.js +0 -46
@@ -93,6 +93,7 @@ export default {
93
93
  'báo cho người dùng thay lõi.',
94
94
  verify: 'Xác nhận',
95
95
  text_new_unit: 'Địa điểm',
96
+ text_unit: 'Địa điểm',
96
97
  text_sub_units: 'Khu vực',
97
98
  is_equal: 'bằng',
98
99
  is_below: 'dưới',
@@ -178,6 +179,7 @@ export default {
178
179
  'bạn kiểm soát dịch vụ và các thiết bị được kết nối của từng khu vực ' +
179
180
  'sẽ được chia sẻ với các thành viên khác cùng địa điểm.',
180
181
  add_user_invitation_sent: 'Lời mời đã được gửi',
182
+ check: 'Kiểm tra',
181
183
  text_temperature: 'Nhiệt độ',
182
184
  text_wind: 'Gió',
183
185
  text_rain: 'Mưa',
@@ -745,9 +747,14 @@ export default {
745
747
  notifications: 'Thông báo',
746
748
  notification: 'Thông báo',
747
749
  send_notification: 'Gửi thông báo',
748
- title_notification: 'Chủ đề: “Cảnh báo”',
750
+ title_notification: 'Tiêu đề: “Cảnh báo”',
749
751
  update_title_notification: 'Cập nhật tiêu đề',
750
752
  update_message_notification: 'Cập nhật nội dung cảnh báo',
753
+ email_content: 'Nội dung E-mail',
754
+ email_to: 'Gửi E-mail tới',
755
+ subject: 'Tiêu đè',
756
+ message: 'Tin nhắn...',
757
+ no_email: 'Không có địa chỉ email',
751
758
  update_action: 'Cập nhật hành động',
752
759
  updated_action_order: 'Đã cập nhật thứ tự hành động',
753
760
  message_notification:
@@ -1161,10 +1168,29 @@ export default {
1161
1168
  connecting: 'Đang kết nối',
1162
1169
  connect_device: 'Kết nối thiết bị',
1163
1170
  connect: 'Kết nối',
1171
+ failed: 'Thất bại',
1172
+ other: 'Khác',
1164
1173
  server_error: 'Lỗi hệ thống',
1174
+ change_wifi: 'Thay đổi Wi-Fi',
1175
+ change_wifi_success: 'Thay đổi Wi-Fi thành công',
1176
+ change_wifi_failed: 'Thay đổi Wi-Fi thất bại',
1177
+ gateway_need_to_be_connected:
1178
+ 'Gateway cần được kết nối để thực hiện thay đổi Wi-Fi',
1165
1179
  set_network: 'Chọn mạng',
1166
- select_wifi: 'Chọn mạng wifi của bạn',
1167
- enter_wifi_password: 'Nhập mật khẩu wifi',
1180
+ select_wifi: 'Chọn mạng Wi-Fi của bạn',
1181
+ enter_wifi_password: 'Nhập mật khẩu Wi-Fi',
1182
+ enter_wifi_name_password: 'Nhập tên và mật khẩu Wi-Fi',
1183
+ connect_wifi: 'Kết nối Wi-Fi',
1184
+ connect_to_wifi: 'Kết nối đến Wi-Fi',
1185
+ please_enter_wifi_name: 'Vui lòng nhập tên Wi-Fi',
1186
+ please_enter_wifi_password: 'Vui lòng nhập mật khẩu Wi-Fi',
1187
+ password_must_be_at_least_8_characters: 'Mật khẩu phải có ít nhất 8 ký tự',
1188
+ connection_timeout: 'Kết nối đã hết thời gian',
1189
+ you_have_successfully_connected_wifi:
1190
+ 'Bạn đã kết nối thành công với Wi-Fi có tên (SSID)',
1191
+ device_scaned: 'Thiết bị đã được quét',
1192
+ select_device_and_connect: 'Chọn thiết bị và nhấn kết nối',
1193
+ error_sending_data_to_local_device: 'Lỗi gửi dữ liệu đến thiết bị cục bộ',
1168
1194
  gateway_warning_content_1: 'Để mang đến cho bạn những trải nghiệm tốt, ',
1169
1195
  gateway_warning_content_2: 'thiết bị cần kết nối wifi thường trực.',
1170
1196
  gateway_warning_content_3:
@@ -1305,6 +1331,8 @@ export default {
1305
1331
  zigbee: 'Zigbee',
1306
1332
  device_connect_remotely_to_the_gateway:
1307
1333
  'Thiết bị được kết nối từ xa với gateway',
1334
+ scan: 'Quét',
1335
+ device_connected_to_local_network: 'Thiết bị được kết nối với mạng cục bộ',
1308
1336
  connect_wifi_asking:
1309
1337
  'Bằng việc tiếp tục, {appName} cần kết nối với Wifi của thiết bị. Một thông báo sẽ hiện lên và yêu cầu ' +
1310
1338
  'bạn kết nối.',
@@ -1356,6 +1384,7 @@ export default {
1356
1384
  connection_methods: 'Các phương thức kết nối',
1357
1385
  delete_gateway: 'Xoá cửa ngõ',
1358
1386
  connection_time: 'Thời gian kết nối',
1387
+ board: 'Board',
1359
1388
  device_id: 'ID thiết bị',
1360
1389
  auth_token: 'Mã xác thực',
1361
1390
  activate_date: 'Ngày kích hoạt',
@@ -1497,7 +1526,11 @@ export default {
1497
1526
  uri_invalid: 'URI không hợp lệ',
1498
1527
  when_value_is: 'Kích hoạt khi giá trị "{config_name}"',
1499
1528
  template_not_supported: 'Tiện ích "{template}" chưa được hỗ trợ',
1500
- invited_user: 'Đã mời người dùng {user}',
1529
+ invited_user: 'Đã mời người dùng',
1501
1530
  enter_value: 'Nhập giá trị',
1502
1531
  enter_parameters: 'Nhập thông số',
1532
+ rearrange_sub_unit_hint:
1533
+ 'Nhấn giữ vào số thứ tự và di chuyển để sắp xếp lại thứ tự các khu vực',
1534
+ rearrange_sub_unit: 'Sắp xếp lại các khu vực',
1535
+ updated_sub_unit_order: 'Đã cập nhật thứ tự các khu vực thành công!',
1503
1536
  };
@@ -72,6 +72,7 @@ const Routes = {
72
72
  ShareWifiPassword: 'ShareWifiPassword',
73
73
  RenameNewDevices: 'RenameNewDevices',
74
74
  ConnectingWifiGuide: 'ConnectingWifiGuide',
75
+ ScanDeviceLocal: 'ScanDeviceLocal',
75
76
 
76
77
  UnitMemberList: 'UnitMemberList',
77
78
  UpdateShareDevice: 'UpdateShareDevice',
@@ -137,6 +138,9 @@ const Routes = {
137
138
  AddUnknownTypeSmart: 'AddUnknownTypeSmart',
138
139
  SetupScriptNotify: 'SetupScriptNotify',
139
140
  SetupScriptDelay: 'SetupScriptDelay',
141
+ SetupScriptEmail: 'SetupScriptEmail',
142
+ SetupScriptReceiverEmail: 'SetupScriptReceiverEmail',
143
+ UpdateReceiverEmailScript: 'UpdateReceiverEmailScript',
140
144
  ScenarioName: 'ScenarioName',
141
145
  ValueChangeName: 'ValueChangeName',
142
146
  AllCamera: 'AllCamera',
@@ -175,6 +179,8 @@ const Routes = {
175
179
  Gateway: 'Gateway',
176
180
  GatewayDetail: 'GatewayDetail',
177
181
  GatewayInfo: 'GatewayInfo',
182
+ GatewayWifi: 'GatewayWifi',
183
+ Successfully: 'Successfully',
178
184
  DeviceGatewayInfo: 'DeviceGatewayInfo',
179
185
  GatewayConnectionMethods: 'GatewayConnectionMethods',
180
186
  DeviceZigbeeDetail: 'DeviceZigbeeDetail',
@@ -198,6 +204,7 @@ const Routes = {
198
204
  DetailConfigActionInternal: 'DetailConfigActionInternal',
199
205
  DeviceInternalDetail: 'DeviceInternalDetail',
200
206
  ChangePosition: 'ChangePosition',
207
+ RearrangeSubUnit: 'RearrangeSubUnit',
201
208
  };
202
209
 
203
210
  export default Routes;
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
- import renderer, { act } from 'react-test-renderer';
3
- import { Text } from 'react-native';
4
- import AccountItem from '../AccountItem';
5
-
6
- describe('Test AccountItem', () => {
7
- let wrapper;
8
- it('create AccountItem invalid', async () => {
9
- await act(async () => {
10
- wrapper = renderer.create(
11
- <AccountItem key={'account'} account={'account'} />
12
- );
13
- });
14
- const instance = wrapper.root;
15
- const text = instance.findAllByType(Text);
16
- expect(text.length).toBe(0);
17
- });
18
- it('create AccountItem account', async () => {
19
- await act(async () => {
20
- wrapper = renderer.create(
21
- <AccountItem
22
- key={'account'}
23
- account={{ name: 'name', phone_number: '098xxxx' }}
24
- />
25
- );
26
- });
27
- const instance = wrapper.root;
28
- const text = instance.findAllByType(Text);
29
- expect(text.length).toBe(2);
30
- });
31
- });
@@ -1,21 +0,0 @@
1
- import { useIsFocused } from '@react-navigation/native';
2
- import { useCallback, useEffect } from 'react';
3
- import { BackHandler } from 'react-native';
4
-
5
- export const useBlockBackAndroid = (actionBack) => {
6
- const focused = useIsFocused();
7
- const blockBack = useCallback(() => {
8
- actionBack && actionBack();
9
- return true;
10
- // eslint-disable-next-line react-hooks/exhaustive-deps
11
- }, []);
12
- useEffect(() => {
13
- if (focused) {
14
- BackHandler.addEventListener('hardwareBackPress', blockBack);
15
- } else {
16
- BackHandler.removeEventListener('hardwareBackPress', blockBack);
17
- }
18
- return () =>
19
- BackHandler.removeEventListener('hardwareBackPress', blockBack);
20
- }, [blockBack, focused]);
21
- };
@@ -1,46 +0,0 @@
1
- import { StyleSheet } from 'react-native';
2
- import { Device, Colors, Theme } from '../../configs';
3
- import { standardizeCameraScreenSize } from '../../utils/Utils';
4
-
5
- const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
6
- Device.screenWidth - 32
7
- );
8
-
9
- export default StyleSheet.create({
10
- wrap: {
11
- flex: 1,
12
- },
13
- boxCamera: {
14
- height: standardizeHeight,
15
- width: standardizeWidth,
16
- alignSelf: 'center',
17
- borderRadius: 10,
18
- ...Theme.shadow,
19
- },
20
- subUnitTitle: {
21
- fontSize: 20,
22
- lineHeight: 28,
23
- color: Colors.Gray8,
24
- marginLeft: 16,
25
- marginTop: 24,
26
- marginBottom: 8,
27
- },
28
- emptyDevice: {
29
- fontStyle: 'normal',
30
- fontWeight: 'normal',
31
- fontSize: 18,
32
- lineHeight: 28,
33
- color: Colors.Border,
34
- },
35
- boxDevices: {
36
- flexWrap: 'wrap',
37
- flexDirection: 'row',
38
- paddingHorizontal: 16,
39
- justifyContent: 'space-between',
40
- },
41
- boxEmptyDevices: {
42
- flexDirection: 'row',
43
- justifyContent: 'center',
44
- paddingTop: 16,
45
- },
46
- });