@eohjsc/react-native-smart-city 0.3.97 → 0.3.98

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.3.97",
4
+ "version": "0.3.98",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -67,11 +67,17 @@ const MyUnit = ({ refreshing }) => {
67
67
  if (isNeedUpdateCache) {
68
68
  setAction(Action.IS_CHECK_CLEAR_CACHE_UNITS, false);
69
69
  const { success, data } = await axiosGet(API.UNIT.MY_UNITS(), {}, true);
70
- success && setMyUnits(data);
70
+ if (success) {
71
+ setMyUnits(data);
72
+ setAction(Action.SET_MY_UNITS, data);
73
+ }
71
74
  } else {
72
75
  await fetchWithCache(API.UNIT.MY_UNITS(), {}, (response) => {
73
76
  const { success, data } = response;
74
- success && setMyUnits(data);
77
+ if (success) {
78
+ setMyUnits(data);
79
+ setAction(Action.SET_MY_UNITS, data);
80
+ }
75
81
  });
76
82
  }
77
83
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -282,10 +282,9 @@ describe('test Item', () => {
282
282
  });
283
283
  expect(mockedNavigate).not.toBeCalled();
284
284
  expect(spyToastError).toBeCalledWith(
285
- getTranslate(
286
- 'en',
287
- "You've reached the [0] limit. Remove one automation or upgrade your plan for a better experience."
288
- )
285
+ getTranslate('en', 'reach_max_automations_per_unit'),
286
+ '',
287
+ 7000
289
288
  );
290
289
  });
291
290
 
@@ -43,7 +43,9 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
43
43
  ToastBottomHelper.error(
44
44
  t('reach_max_automations_per_unit', {
45
45
  length: permissions.max_automations_per_unit,
46
- })
46
+ }),
47
+ '',
48
+ 7000
47
49
  );
48
50
  return;
49
51
  }
@@ -41,6 +41,7 @@ export const Action = {
41
41
  SET_IS_IN_EDIT_TEMPLATE_SCREEN: 'SET_IS_IN_EDIT_TEMPLATE_SCREEN',
42
42
  LOGOUT: 'LOGOUT',
43
43
  SET_APP_STATE_CHANGE: 'SET_APP_STATE_CHANGE',
44
+ SET_MY_UNITS: 'SET_MY_UNITS',
44
45
  };
45
46
 
46
47
  export type AuthData = {
@@ -25,6 +25,7 @@ export const mockDataStore: ContextData = {
25
25
  barStyle: '',
26
26
  },
27
27
  listAction: [],
28
+ myUnits: [],
28
29
  unit: {
29
30
  favoriteDeviceIds: [],
30
31
  },
@@ -95,6 +96,7 @@ export const mockSCStore = (data: ContextData): ContextData => {
95
96
  appState: 'active',
96
97
  ...data.app,
97
98
  },
99
+ myUnits: [...mockDataStore.myUnits, ...(data?.myUnits || [])],
98
100
  unit: {
99
101
  favoriteDeviceIds: [
100
102
  ...mockDataStore.unit.favoriteDeviceIds,
@@ -130,5 +132,6 @@ export const mockSCStore = (data: ContextData): ContextData => {
130
132
  bluetooth: {
131
133
  ...mockDataStore.bluetooth,
132
134
  },
135
+ percent: mockDataStore.percent,
133
136
  };
134
137
  };
@@ -33,6 +33,7 @@ export type ContextData = {
33
33
  devMode: DevModeType;
34
34
  bluetooth: BluetoothType;
35
35
  percent: number;
36
+ myUnits: [];
36
37
  };
37
38
 
38
39
  export type Action = {
@@ -54,6 +55,7 @@ export const initialState = {
54
55
  listDevice: {} as ListDevice,
55
56
  listAction: [] as ListAction,
56
57
  percent: 0,
58
+ myUnits: [],
57
59
  unit: {
58
60
  favoriteDeviceIds: [],
59
61
  },
@@ -537,7 +539,11 @@ export const reducer = (currentState: ContextData, action: Action) => {
537
539
  appState: payload,
538
540
  },
539
541
  };
540
-
542
+ case Action.SET_MY_UNITS:
543
+ return {
544
+ ...currentState,
545
+ myUnits: payload,
546
+ };
541
547
  default:
542
548
  return currentState;
543
549
  }
@@ -62,7 +62,11 @@ export default ({ id, type, share, filterEnabled }) => {
62
62
  if (api?.needPermission && !permissions?.[api?.needPermission]) {
63
63
  setIsLoading(false);
64
64
  setIsRefreshing(false);
65
- ToastBottomHelper.error(t(`no_permission_${api?.needPermission}`));
65
+ ToastBottomHelper.error(
66
+ t(`no_permission_${api?.needPermission}`),
67
+ '',
68
+ 7000
69
+ );
66
70
  return;
67
71
  }
68
72
 
@@ -150,7 +150,7 @@ const SelectDeviceType = ({ route }) => {
150
150
  const handleOnSelect = (itemSelect) => {
151
151
  const needPermission = getPermissionCode(itemSelect);
152
152
  if (!permissions?.[needPermission]) {
153
- ToastBottomHelper.error(t(`no_permission_${needPermission}`));
153
+ ToastBottomHelper.error(t(`no_permission_${needPermission}`), '', 7000);
154
154
  return false;
155
155
  }
156
156
 
@@ -159,7 +159,9 @@ const SelectDeviceType = ({ route }) => {
159
159
  ToastBottomHelper.error(
160
160
  t('reach_max_chips_per_unit', {
161
161
  length: permissions?.max_chips_per_unit,
162
- })
162
+ }),
163
+ '',
164
+ 7000
163
165
  );
164
166
  return false;
165
167
  }
@@ -172,7 +174,9 @@ const SelectDeviceType = ({ route }) => {
172
174
  ToastBottomHelper.error(
173
175
  t('reach_max_configs_per_unit', {
174
176
  length: permissions?.max_configs_per_unit,
175
- })
177
+ }),
178
+ '',
179
+ 7000
176
180
  );
177
181
  return false;
178
182
  }
@@ -14,6 +14,7 @@ import api from '../../../utils/Apis/axios';
14
14
  import API from '../../../configs/API';
15
15
  import { ToastBottomHelper } from '../../../utils/Utils';
16
16
  import { getTranslate } from '../../../utils/I18n';
17
+
17
18
  const wrapComponent = (route, storeData = {}) => (
18
19
  <SCProvider initState={mockSCStore(storeData)}>
19
20
  <SelectDeviceType route={route} />
@@ -147,10 +148,9 @@ describe('Test select device type', () => {
147
148
  });
148
149
  expect(mockedNavigate).not.toBeCalled();
149
150
  expect(spyToastError).toBeCalledWith(
150
- getTranslate(
151
- 'en',
152
- "You've reached the [1] limit. Remove one config or upgrade your plan for a better experience."
153
- )
151
+ getTranslate('en', 'reach_max_configs_per_unit'),
152
+ '',
153
+ 7000
154
154
  );
155
155
  });
156
156
 
@@ -189,10 +189,9 @@ describe('Test select device type', () => {
189
189
  });
190
190
  expect(mockedNavigate).not.toBeCalled();
191
191
  expect(spyToastError).toBeCalledWith(
192
- getTranslate(
193
- 'en',
194
- "You've reached the [1] limit. Remove one chip or upgrade your plan for a better experience."
195
- )
192
+ getTranslate('en', 'reach_max_chips_per_unit'),
193
+ '',
194
+ 7000
196
195
  );
197
196
  });
198
197
 
@@ -209,7 +208,9 @@ describe('Test select device type', () => {
209
208
  },
210
209
  });
211
210
  expect(spyToastError).toBeCalledWith(
212
- getTranslate('en', 'no_permission_plug_and_play_gateway')
211
+ getTranslate('en', 'no_permission_plug_and_play_gateway'),
212
+ '',
213
+ 7000
213
214
  );
214
215
  });
215
216
 
@@ -226,7 +227,9 @@ describe('Test select device type', () => {
226
227
  },
227
228
  });
228
229
  expect(spyToastError).toBeCalledWith(
229
- getTranslate('en', 'no_permission_plug_and_play_zigbee')
230
+ getTranslate('en', 'no_permission_plug_and_play_zigbee'),
231
+ '',
232
+ 7000
230
233
  );
231
234
  });
232
235
 
@@ -243,7 +246,9 @@ describe('Test select device type', () => {
243
246
  },
244
247
  });
245
248
  expect(spyToastError).toBeCalledWith(
246
- getTranslate('en', 'no_permission_plug_and_play_wifi')
249
+ getTranslate('en', 'no_permission_plug_and_play_wifi'),
250
+ '',
251
+ 7000
247
252
  );
248
253
  });
249
254
 
@@ -260,7 +265,9 @@ describe('Test select device type', () => {
260
265
  },
261
266
  });
262
267
  expect(spyToastError).toBeCalledWith(
263
- getTranslate('en', 'no_permission_plug_and_play_modbus')
268
+ getTranslate('en', 'no_permission_plug_and_play_modbus'),
269
+ '',
270
+ 7000
264
271
  );
265
272
  });
266
273
 
@@ -81,12 +81,18 @@ const MultiUnits = () => {
81
81
  ToastBottomHelper.error(
82
82
  t('reach_max_automations_per_unit', {
83
83
  length: permissions.max_automations_per_unit,
84
- })
84
+ }),
85
+ '',
86
+ 7000
85
87
  );
86
88
  return;
87
89
  }
88
90
  } else if (!permissions?.smart_script_for_multi_unit) {
89
- ToastBottomHelper.error(t('no_permission_smart_script_for_multi_unit'));
91
+ ToastBottomHelper.error(
92
+ t('no_permission_smart_script_for_multi_unit'),
93
+ '',
94
+ 7000
95
+ );
90
96
  return;
91
97
  }
92
98
  if (tabActive === AUTOMATE_TABS.SCENARIO) {
@@ -271,10 +271,9 @@ describe('Test ScriptDetail', () => {
271
271
  });
272
272
  expect(mockNavigate).not.toBeCalled();
273
273
  expect(spyToastError).toBeCalledWith(
274
- getTranslate(
275
- 'en',
276
- "You've reached the [0] limit. Remove one action or upgrade your plan for a better experience."
277
- )
274
+ getTranslate('en', 'reach_max_actions_per_automation'),
275
+ '',
276
+ 7000
278
277
  );
279
278
  });
280
279
 
@@ -305,7 +305,9 @@ const ItemAdd = ({ automate, index }) => {
305
305
  ToastBottomHelper.error(
306
306
  t('reach_max_actions_per_automation', {
307
307
  length: permissions?.max_actions_per_automation,
308
- })
308
+ }),
309
+ '',
310
+ 7000
309
311
  );
310
312
  return;
311
313
  }
@@ -252,10 +252,9 @@ describe('Test MultiUnits', () => {
252
252
  });
253
253
  expect(mockedNavigate).not.toBeCalled();
254
254
  expect(spyToastError).toBeCalledWith(
255
- getTranslate(
256
- 'en',
257
- "You've reached the [0] limit. Remove one automation or upgrade your plan for a better experience."
258
- )
255
+ getTranslate('en', 'reach_max_automations_per_unit'),
256
+ '',
257
+ 7000
259
258
  );
260
259
  });
261
260
 
@@ -291,7 +290,9 @@ describe('Test MultiUnits', () => {
291
290
  });
292
291
  expect(mockedNavigate).not.toBeCalled();
293
292
  expect(spyToastError).toBeCalledWith(
294
- getTranslate('en', 'no_permission_smart_script_for_multi_unit')
293
+ getTranslate('en', 'no_permission_smart_script_for_multi_unit'),
294
+ '',
295
+ 7000
295
296
  );
296
297
  });
297
298
 
@@ -148,10 +148,9 @@ describe('Test Automate', () => {
148
148
  });
149
149
  expect(mockedNavigate).not.toBeCalled();
150
150
  expect(spyToastError).toBeCalledWith(
151
- getTranslate(
152
- 'en',
153
- "You've reached the [0] limit. Remove one automation or upgrade your plan for a better experience."
154
- )
151
+ getTranslate('en', 'reach_max_automations_per_unit'),
152
+ '',
153
+ 7000
155
154
  );
156
155
  });
157
156
 
@@ -295,7 +294,9 @@ describe('Test Automate', () => {
295
294
  });
296
295
  expect(mockedNavigate).not.toBeCalled();
297
296
  expect(spyToastError).toBeCalledWith(
298
- getTranslate('en', 'no_permission_smart_script_for_multi_unit')
297
+ getTranslate('en', 'no_permission_smart_script_for_multi_unit'),
298
+ '',
299
+ 7000
299
300
  );
300
301
  });
301
302
  });
@@ -88,12 +88,18 @@ const Automate = () => {
88
88
  ToastBottomHelper.error(
89
89
  t('reach_max_automations_per_unit', {
90
90
  length: permissions.max_automations_per_unit,
91
- })
91
+ }),
92
+ '',
93
+ 7000
92
94
  );
93
95
  return;
94
96
  }
95
97
  } else if (!permissions?.smart_script_for_multi_unit) {
96
- ToastBottomHelper.error(t('no_permission_smart_script_for_multi_unit'));
98
+ ToastBottomHelper.error(
99
+ t('no_permission_smart_script_for_multi_unit'),
100
+ '',
101
+ 7000
102
+ );
97
103
  return;
98
104
  }
99
105
  navigate(Routes.UnitStack, {
@@ -41,7 +41,9 @@ const MemberList = ({ route }) => {
41
41
  ToastBottomHelper.error(
42
42
  t('reach_max_members_per_unit', {
43
43
  length: permissions?.max_members_per_unit,
44
- })
44
+ }),
45
+ '',
46
+ 7000
45
47
  );
46
48
  return;
47
49
  }
@@ -101,10 +101,9 @@ describe('test MemberList', () => {
101
101
  });
102
102
  expect(mockedNavigate).not.toBeCalled();
103
103
  expect(spyToastError).toBeCalledWith(
104
- getTranslate(
105
- 'en',
106
- "You've reached the [0] limit. Remove one member or upgrade your plan for a better experience."
107
- )
104
+ getTranslate('en', 'reach_max_members_per_unit'),
105
+ '',
106
+ 7000
108
107
  );
109
108
  });
110
109
  });
@@ -20,11 +20,16 @@ import { AccessibilityLabel } from '../../configs/Constants';
20
20
  import styles from './AddSubUnitStyles';
21
21
  import useKeyboardShow from '../../hooks/Common/useKeyboardShow';
22
22
  import { replace } from '../../navigations/utils';
23
+ import { useBackendPermission } from '../../utils/Permission/backend';
24
+ import { useSCContextSelector } from '../../context';
23
25
 
24
26
  const AddSubUnit = ({ route }) => {
25
27
  const t = useTranslations();
26
28
  const { dismissKeyboard } = useKeyboardShow();
27
29
  const { navigate, goBack, dispatch } = useNavigation();
30
+ const permissions = useBackendPermission();
31
+ const myUnits = useSCContextSelector((state) => state.myUnits);
32
+
28
33
  const {
29
34
  unit,
30
35
  addType,
@@ -38,6 +43,10 @@ const AddSubUnit = ({ route }) => {
38
43
  const [showImagePicker, setShowImagePicker] = useState(false);
39
44
  let awaitCreate = useRef(false);
40
45
 
46
+ const unitChoose = useMemo(() => {
47
+ return myUnits?.find((item) => item?.id === unit?.id);
48
+ }, [myUnits, unit?.id]);
49
+
41
50
  const cleanData = () => {
42
51
  setRoomName('');
43
52
  setWallpaper('');
@@ -124,6 +133,11 @@ const AddSubUnit = ({ route }) => {
124
133
  cleanData();
125
134
  } else {
126
135
  awaitCreate.current = false;
136
+ if (
137
+ unitChoose?.stations?.length >= permissions?.max_stations_per_unit
138
+ ) {
139
+ ToastBottomHelper.error(t('reach_max_stations_per_unit'), '', 7000);
140
+ }
127
141
  }
128
142
  }
129
143
  }
@@ -140,6 +154,8 @@ const AddSubUnit = ({ route }) => {
140
154
  goBack,
141
155
  navigate,
142
156
  route.params,
157
+ unitChoose?.stations?.length,
158
+ permissions?.max_stations_per_unit,
143
159
  ]);
144
160
 
145
161
  const onChoosePhoto = useCallback(() => {
@@ -14,9 +14,10 @@ import { SCProvider } from '../../../context';
14
14
  import { mockSCStore } from '../../../context/mockStore';
15
15
  import api from '../../../utils/Apis/axios';
16
16
  import { API } from '../../../configs';
17
+ import { ToastBottomHelper } from '../../../utils/Utils';
17
18
 
18
- const wrapComponent = (route) => (
19
- <SCProvider initState={mockSCStore({})}>
19
+ const wrapComponent = (route, storeData = {}) => (
20
+ <SCProvider initState={mockSCStore(storeData)}>
20
21
  <AddSubUnit route={route} />
21
22
  </SCProvider>
22
23
  );
@@ -297,7 +298,19 @@ describe('Test AddSubUnit', () => {
297
298
  };
298
299
  mock.onPost(API.SUB_UNIT.CREATE_SUB_UNIT(1)).reply(200, {});
299
300
  await act(async () => {
300
- tree = await create(wrapComponent(route));
301
+ tree = await create(
302
+ wrapComponent(route, {
303
+ auth: {
304
+ account: {
305
+ user: {
306
+ permissions: {
307
+ max_stations_per_unit: 100,
308
+ },
309
+ },
310
+ },
311
+ },
312
+ })
313
+ );
301
314
  });
302
315
  const instance = tree.root;
303
316
  const viewButtonBottom = await makeValidateData(instance);
@@ -307,6 +320,45 @@ describe('Test AddSubUnit', () => {
307
320
  expect(mockNavigationDispatch).toBeCalledWith(mockReplace);
308
321
  });
309
322
 
323
+ it('test no permission create fail sub-unit is out side Unit', async () => {
324
+ route.params = {
325
+ ...route.params,
326
+ isInsideUnit: false,
327
+ };
328
+ const spyToastError = jest.spyOn(ToastBottomHelper, 'error');
329
+ mock.onPost(API.SUB_UNIT.CREATE_SUB_UNIT(1)).reply(400, {});
330
+ await act(async () => {
331
+ tree = await create(
332
+ wrapComponent(route, {
333
+ auth: {
334
+ account: {
335
+ user: {
336
+ permissions: {
337
+ max_stations_per_unit: 0,
338
+ },
339
+ },
340
+ },
341
+ },
342
+ myUnits: [
343
+ { id: 1, name: 'unit 1', stations: [{ id: 1, name: 'station' }] },
344
+ ],
345
+ })
346
+ );
347
+ });
348
+ const instance = tree.root;
349
+ const viewButtonBottom = await makeValidateData(instance);
350
+
351
+ await act(async () => {
352
+ await viewButtonBottom.props.onRightClick();
353
+ });
354
+ expect(spyToastError).toBeCalledWith(
355
+ getTranslate('en', 'reach_max_stations_per_unit'),
356
+ '',
357
+ 7000
358
+ );
359
+ expect(mockNavigationDispatch).not.toBeCalled();
360
+ });
361
+
310
362
  it('test create sub-unit type AddHassiDevice', async () => {
311
363
  route.params = {
312
364
  ...route.params,
@@ -36,7 +36,9 @@ const AddMenu = memo(({ unit, afterItemClick, showAdd, setHideAdd }) => {
36
36
  ToastBottomHelper.error(
37
37
  t('reach_max_stations_per_unit', {
38
38
  length: permissions.max_stations_per_unit,
39
- })
39
+ }),
40
+ '',
41
+ 7000
40
42
  );
41
43
  return;
42
44
  }
@@ -1396,30 +1396,28 @@ export default {
1396
1396
  value_must_be_less_than_max: 'Value must be less than {max}',
1397
1397
  value_must_be_a_number: 'Value must be a number',
1398
1398
  reach_max_stations_per_unit:
1399
- "You've reached the [{length}] limit. Remove one sub-unit or upgrade your plan for a better experience.",
1399
+ 'Sub-unit is incomplete. Please visit e-ra to complete your operation.',
1400
1400
  not_support_plug_and_play: 'Not support plug and play',
1401
1401
  reach_max_actions_per_automation:
1402
- "You've reached the [{length}] limit. Remove one action or upgrade your plan for a better experience.",
1402
+ 'Action is incomplete. Please visit e-ra to complete your operation.',
1403
1403
  reach_max_automations_per_unit:
1404
- "You've reached the [{length}] limit. Remove one automation or upgrade your plan for a better experience.",
1404
+ 'Automation is incomplete. Please visit e-ra to complete your operation.',
1405
1405
  reach_max_members_per_unit:
1406
- "You've reached the [{length}] limit. Remove one member or upgrade your plan for a better experience.",
1406
+ 'Member is incomplete. Please visit e-ra to complete your operation.',
1407
1407
  reach_max_chips_per_unit:
1408
- "You've reached the [{length}] limit. Remove one chip or upgrade your plan for a better experience.",
1408
+ 'Chip is incomplete. Please visit e-ra to complete your operation.',
1409
1409
  reach_max_configs_per_unit:
1410
- "You've reached the [{length}] limit. Remove one config or upgrade your plan for a better experience.",
1410
+ 'Config is incomplete. Please visit e-ra to complete your operation.',
1411
1411
  no_permission_plug_and_play_modbus:
1412
- 'Add modbus is currently not available on your Subscription. Please upgrade your plan for a better experience!',
1412
+ 'Add modbus is incomplete. Please visit e-ra to complete your operation.',
1413
1413
  no_permission_plug_and_play_zigbee:
1414
- 'Add zigbee is currently not available on your Subscription. Please upgrade your plan for a better experience!',
1414
+ 'Add zigbee is incomplete. Please visit e-ra to complete your operation.',
1415
1415
  no_permission_plug_and_play_wifi:
1416
- 'Add wifi is currently not available on your Subscription. Please upgrade your plan for a better experience!',
1416
+ 'Add wifi is incomplete. Please visit e-ra to complete your operation.',
1417
1417
  no_permission_plug_and_play_gateway:
1418
- 'Add gateway is currently not available on your Subscription. Please upgrade your plan for a better experience!',
1418
+ 'Add gateway is incomplete. Please visit e-ra to complete your operation.',
1419
1419
  no_permission_view_action_log:
1420
- // eslint-disable-next-line max-len
1421
- 'View action log is currently not available on your Subscription. Please upgrade your plan for a better experience!',
1420
+ 'View action log is incomplete. Please visit e-ra to complete your operation.',
1422
1421
  no_permission_smart_script_for_multi_unit:
1423
- // eslint-disable-next-line max-len
1424
- 'Smart script for Multi Unit is currently not available on your Subscription. Please upgrade your plan for a better experience!',
1422
+ 'Smart script for Multi Unit is incomplete. Please visit e-ra to complete your operation.',
1425
1423
  };
@@ -1404,29 +1404,28 @@ export default {
1404
1404
  value_must_be_less_than_max: 'Giá trị phải nhỏ hơn {max}',
1405
1405
  value_must_be_a_number: 'Giá trị phải là một số',
1406
1406
  reach_max_stations_per_unit:
1407
- 'Bạn đã đạt giới hạn [{length}]. Vui lòng xoá bớt một sub-unit hoặc nâng cấp gói để trải nghiệm tốt hơn.',
1407
+ 'Sub-unit chưa hoàn tất. Hãy truy cập e-ra để hoàn thiện thao tác của bạn.',
1408
1408
  not_support_plug_and_play: 'Không hỗ trợ kết nối tự động',
1409
1409
  reach_max_actions_per_automation:
1410
- 'Bạn đã đạt giới hạn [{length}]. Vui lòng xoá bớt một action hoặc nâng cấp gói để có trải nghiệm tốt hơn.',
1410
+ 'Action chưa hoàn tất. Hãy truy cập e-ra để hoàn thiện thao tác của bạn.',
1411
1411
  reach_max_automations_per_unit:
1412
- 'Bạn đã đạt giới hạn [{length}]. Vui lòng xoá bớt một automation hoặc nâng cấp gói để có trải nghiệm tốt hơn.',
1412
+ 'Automation chưa hoàn tất. Hãy truy cập e-ra để hoàn thiện thao tác của bạn.',
1413
1413
  reach_max_members_per_unit:
1414
- 'Bạn đã đạt giới hạn [{length}]. Vui lòng xoá bớt một member hoặc nâng cấp gói để có trải nghiệm tốt hơn.',
1414
+ 'Member chưa hoàn tất. Hãy truy cập e-ra để hoàn thiện thao tác của bạn.',
1415
1415
  reach_max_chips_per_unit:
1416
- 'Bạn đã đạt giới hạn [{length}]. Vui lòng xoá bớt một chip hoặc nâng cấp gói để có trải nghiệm tốt hơn.',
1416
+ 'Chip chưa hoàn tất. Hãy truy cập e-ra để hoàn thiện thao tác của bạn.',
1417
1417
  reach_max_configs_per_unit:
1418
- 'Bạn đã đạt giới hạn [{length}]. Vui lòng xoá bớt một config hoặc nâng cấp gói để có trải nghiệm tốt hơn.',
1418
+ 'Config chưa hoàn tất. Hãy truy cập e-ra để hoàn thiện thao tác của bạn.',
1419
1419
  no_permission_plug_and_play_modbus:
1420
- 'Kết nối tự động modbus hiện tại chưa hỗ trợ trên gói của bạn. Vui lòng nâng cấp gói để trải nghiệm tốt hơn!',
1420
+ 'Kết nối tự động modbus chưa hoàn tất. Hãy truy cập e-ra để hoàn thiện thao tác của bạn.',
1421
1421
  no_permission_plug_and_play_zigbee:
1422
- 'Kết nối tự động zigbee hiện tại chưa hỗ trợ trên gói của bạn. Vui lòng nâng cấp gói để trải nghiệm tốt hơn!',
1422
+ 'Kết nối tự động zigbee chưa hoàn tất. Hãy truy cập e-ra để hoàn thiện thao tác của bạn.',
1423
1423
  no_permission_plug_and_play_wifi:
1424
- 'Kết nối tự động wifi hiện tại chưa hỗ trợ trên gói của bạn. Vui lòng nâng cấp gói để trải nghiệm tốt hơn!',
1424
+ 'Kết nối tự động wifi chưa hoàn tất. Hãy truy cập e-ra để hoàn thiện thao tác của bạn.',
1425
1425
  no_permission_plug_and_play_gateway:
1426
- 'Kết nối tự động gateway hiện tại chưa hỗ trợ trên gói của bạn. Vui lòng nâng cấp gói để trải nghiệm tốt hơn!',
1426
+ 'Kết nối tự động gateway chưa hoàn tất. Hãy truy cập e-ra để hoàn thiện thao tác của bạn.',
1427
1427
  no_permission_view_action_log:
1428
- 'Xem lịch sử hoạt động hiện tại chưa hỗ trợ trên gói của bạn. Vui lòng nâng cấp gói để trải nghiệm tốt hơn!',
1428
+ 'Xem lịch sử hoạt động chưa hoàn tất. Hãy truy cập e-ra để hoàn thiện thao tác của bạn.',
1429
1429
  no_permission_smart_script_for_multi_unit:
1430
- // eslint-disable-next-line max-len
1431
- 'Kịch bản thông minh cho nhiều địa điểm hiện tại chưa hỗ trợ trên gói của bạn. Vui lòng nâng cấp gói để có trải nghiệm tốt hơn!',
1430
+ 'Kịch bản thông minh cho nhiều địa điểm chưa hoàn tất. Hãy truy cập e-ra để hoàn thiện thao tác của bạn.',
1432
1431
  };
@@ -88,31 +88,31 @@ export const openMapDirection = (item) => () => {
88
88
  };
89
89
 
90
90
  export const ToastBottomHelper = {
91
- success: (msg, line2) => {
91
+ success: (msg, line2, visibilityTime = 1000) => {
92
92
  Toast.show({
93
93
  type: 'success',
94
94
  position: 'bottom',
95
95
  text1: msg,
96
96
  text2: line2,
97
- visibilityTime: 1000,
97
+ visibilityTime: visibilityTime,
98
98
  });
99
99
  },
100
- error: (msg, line2) => {
100
+ error: (msg, line2, visibilityTime = 1000) => {
101
101
  Toast.show({
102
102
  type: 'error',
103
103
  position: 'bottom',
104
104
  text1: msg,
105
105
  text2: line2,
106
- visibilityTime: 1000,
106
+ visibilityTime: visibilityTime,
107
107
  });
108
108
  },
109
- info: (msg, line2) => {
109
+ info: (msg, line2, visibilityTime = 1000) => {
110
110
  Toast.show({
111
111
  type: 'info',
112
112
  position: 'bottom',
113
113
  text1: msg,
114
114
  text2: line2,
115
- visibilityTime: 1000,
115
+ visibilityTime: visibilityTime,
116
116
  });
117
117
  },
118
118
  };