@eohjsc/react-native-smart-city 0.3.96 → 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 +1 -1
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +0 -6
- package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +0 -8
- package/src/commons/Dashboard/MyUnit/index.js +8 -2
- package/src/commons/Device/ProgressBar/__test__/ProgressBar.test.js +0 -10
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +3 -1
- package/src/commons/SubUnit/OneTap/index.js +7 -1
- package/src/configs/Constants.js +3 -0
- package/src/context/actionType.ts +1 -0
- package/src/context/mockStore.ts +3 -0
- package/src/context/reducer.ts +7 -1
- package/src/screens/AQIGuide/__test__/AQIGuide.test.js +0 -11
- package/src/screens/ActivityLog/hooks/index.js +5 -1
- package/src/screens/AddNewGateway/SelectDeviceType.js +15 -3
- package/src/screens/AddNewGateway/ShareWifiPassword.js +1 -1
- package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +19 -6
- package/src/screens/Automate/MultiUnits.js +12 -2
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +3 -1
- package/src/screens/Automate/ScriptDetail/index.js +7 -1
- package/src/screens/Automate/__test__/MultiUnits.test.js +6 -2
- package/src/screens/Automate/__test__/index.test.js +6 -2
- package/src/screens/Automate/index.js +12 -2
- package/src/screens/Notification/__test__/NotificationItem.test.js +42 -2
- package/src/screens/Notification/components/NotificationItem.js +23 -1
- package/src/screens/Sharing/MemberList.js +4 -2
- package/src/screens/Sharing/__test__/MemberList.test.js +3 -1
- package/src/screens/SubUnit/AddSubUnit.js +16 -1
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +57 -4
- package/src/screens/SubUnit/__test__/Detail.test.js +0 -38
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +0 -10
- package/src/screens/Unit/AddMenu.js +7 -1
- package/src/screens/WaterQualityGuide/__test__/index.test.js +0 -8
- package/src/utils/Apis/axios.js +3 -0
- package/src/utils/I18n/translations/en.js +22 -14
- package/src/utils/I18n/translations/vi.js +24 -13
- package/src/utils/Utils.js +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { useSelector } from 'react-redux';
|
|
4
3
|
import { act, create } from 'react-test-renderer';
|
|
5
4
|
|
|
6
5
|
import { DEVICE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
|
|
@@ -92,11 +91,6 @@ describe('Test OnOffTemplate', () => {
|
|
|
92
91
|
};
|
|
93
92
|
|
|
94
93
|
sensor = { name: 'Sensor' };
|
|
95
|
-
|
|
96
|
-
const localState = {
|
|
97
|
-
isOnSwich: false,
|
|
98
|
-
};
|
|
99
|
-
useSelector.mockImplementation((getter) => getter(localState));
|
|
100
94
|
});
|
|
101
95
|
|
|
102
96
|
it('render with template OnOffSimpleActionTemplate', async () => {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
/* eslint-disable promise/prefer-await-to-callbacks */
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { create, act } from 'react-test-renderer';
|
|
4
3
|
import { TouchableOpacity } from 'react-native';
|
|
5
|
-
import { useSelector } from 'react-redux';
|
|
6
4
|
|
|
7
5
|
import OneBigButtonTemplate from '../OneBigButtonTemplate';
|
|
8
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
@@ -46,12 +44,6 @@ describe('Test OneBigButtonTemplate', () => {
|
|
|
46
44
|
let sensor;
|
|
47
45
|
|
|
48
46
|
beforeEach(() => {
|
|
49
|
-
const localState = {
|
|
50
|
-
isOnSwich: false,
|
|
51
|
-
};
|
|
52
|
-
useSelector.mockImplementation((cb) => {
|
|
53
|
-
return cb(localState);
|
|
54
|
-
});
|
|
55
47
|
sensor = { name: 'Sensor' };
|
|
56
48
|
});
|
|
57
49
|
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/* eslint-disable promise/prefer-await-to-callbacks */
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { useSelector } from 'react-redux';
|
|
4
2
|
import renderer, { act } from 'react-test-renderer';
|
|
5
3
|
|
|
6
4
|
import ProgressBar from '..';
|
|
@@ -21,14 +19,6 @@ const wrapComponent = (item, data) => (
|
|
|
21
19
|
|
|
22
20
|
describe('Test ProgressBar', () => {
|
|
23
21
|
let tree;
|
|
24
|
-
beforeEach(() => {
|
|
25
|
-
const localState = {
|
|
26
|
-
language: 'en',
|
|
27
|
-
};
|
|
28
|
-
useSelector.mockImplementation((cb) => {
|
|
29
|
-
return cb(localState);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
22
|
|
|
33
23
|
it('render ProgressBar', async () => {
|
|
34
24
|
const item = {
|
|
@@ -282,7 +282,9 @@ describe('test Item', () => {
|
|
|
282
282
|
});
|
|
283
283
|
expect(mockedNavigate).not.toBeCalled();
|
|
284
284
|
expect(spyToastError).toBeCalledWith(
|
|
285
|
-
getTranslate('en', 'reach_max_automations_per_unit')
|
|
285
|
+
getTranslate('en', 'reach_max_automations_per_unit'),
|
|
286
|
+
'',
|
|
287
|
+
7000
|
|
286
288
|
);
|
|
287
289
|
});
|
|
288
290
|
|
|
@@ -40,7 +40,13 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
|
|
|
40
40
|
const handleOnAddNew = () => {
|
|
41
41
|
if (unit?.id) {
|
|
42
42
|
if (permissions.max_automations_per_unit <= totalAutomates) {
|
|
43
|
-
ToastBottomHelper.error(
|
|
43
|
+
ToastBottomHelper.error(
|
|
44
|
+
t('reach_max_automations_per_unit', {
|
|
45
|
+
length: permissions.max_automations_per_unit,
|
|
46
|
+
}),
|
|
47
|
+
'',
|
|
48
|
+
7000
|
|
49
|
+
);
|
|
44
50
|
return;
|
|
45
51
|
}
|
|
46
52
|
}
|
package/src/configs/Constants.js
CHANGED
|
@@ -220,6 +220,8 @@ export const NOTIFICATION_TYPES = {
|
|
|
220
220
|
NOTIFY_UPGRADE_SYSTEM: 'NOTIFY_UPGRADE_SYSTEM',
|
|
221
221
|
NOTIFY_CHANGE_UNIT_OLD_OWNER: 'NOTIFY_CHANGE_UNIT_OLD_OWNER',
|
|
222
222
|
NOTIFY_CHANGE_UNIT_NEW_OWNER: 'NOTIFY_CHANGE_UNIT_NEW_OWNER',
|
|
223
|
+
TRIAL_WILL_END: 'TRIAL_WILL_END',
|
|
224
|
+
FREE_TRIAL_SUBSCRIPTION: 'FREE_TRIAL_SUBSCRIPTION',
|
|
223
225
|
AIR_QUALITY: 'AIR_QUALITY',
|
|
224
226
|
TURBIDITY: 'TURBIDITY',
|
|
225
227
|
PH: 'PH',
|
|
@@ -230,6 +232,7 @@ export const NOTIFICATION_TYPES = {
|
|
|
230
232
|
SOS: 'SOS',
|
|
231
233
|
FILTER_WATER: 'FILTER_WATER',
|
|
232
234
|
LOW_BATTERY: 'LOW_BATTERY',
|
|
235
|
+
BROADCAST_NOTIFICATION: 'BROADCAST_NOTIFICATION',
|
|
233
236
|
};
|
|
234
237
|
|
|
235
238
|
export const ACTIVITY_LOG_TYPES = {
|
package/src/context/mockStore.ts
CHANGED
|
@@ -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
|
};
|
package/src/context/reducer.ts
CHANGED
|
@@ -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
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/* eslint-disable promise/prefer-await-to-callbacks */
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { useSelector } from 'react-redux';
|
|
4
2
|
import { act, create } from 'react-test-renderer';
|
|
5
3
|
import AQIGuide from '..';
|
|
6
4
|
import Text from '../../../commons/Text';
|
|
@@ -25,15 +23,6 @@ jest.mock('react', () => ({
|
|
|
25
23
|
}));
|
|
26
24
|
|
|
27
25
|
describe('test AQIGuide', () => {
|
|
28
|
-
beforeEach(() => {
|
|
29
|
-
const localState = {
|
|
30
|
-
language: 'en',
|
|
31
|
-
};
|
|
32
|
-
useSelector.mockImplementation((cb) => {
|
|
33
|
-
return cb(localState);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
26
|
it('render', async () => {
|
|
38
27
|
let tree;
|
|
39
28
|
await act(async () => {
|
|
@@ -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(
|
|
65
|
+
ToastBottomHelper.error(
|
|
66
|
+
t(`no_permission_${api?.needPermission}`),
|
|
67
|
+
'',
|
|
68
|
+
7000
|
|
69
|
+
);
|
|
66
70
|
return;
|
|
67
71
|
}
|
|
68
72
|
|
|
@@ -150,13 +150,19 @@ 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
|
|
|
157
157
|
if (['gateway_qr', 'wifi_device_qr'].includes(itemSelect)) {
|
|
158
158
|
if (permissions?.max_chips_per_unit <= unitCountSummary?.total_chips) {
|
|
159
|
-
ToastBottomHelper.error(
|
|
159
|
+
ToastBottomHelper.error(
|
|
160
|
+
t('reach_max_chips_per_unit', {
|
|
161
|
+
length: permissions?.max_chips_per_unit,
|
|
162
|
+
}),
|
|
163
|
+
'',
|
|
164
|
+
7000
|
|
165
|
+
);
|
|
160
166
|
return false;
|
|
161
167
|
}
|
|
162
168
|
}
|
|
@@ -165,7 +171,13 @@ const SelectDeviceType = ({ route }) => {
|
|
|
165
171
|
if (
|
|
166
172
|
permissions?.max_configs_per_unit <= unitCountSummary?.total_configs
|
|
167
173
|
) {
|
|
168
|
-
ToastBottomHelper.error(
|
|
174
|
+
ToastBottomHelper.error(
|
|
175
|
+
t('reach_max_configs_per_unit', {
|
|
176
|
+
length: permissions?.max_configs_per_unit,
|
|
177
|
+
}),
|
|
178
|
+
'',
|
|
179
|
+
7000
|
|
180
|
+
);
|
|
169
181
|
return false;
|
|
170
182
|
}
|
|
171
183
|
}
|
|
@@ -132,7 +132,7 @@ const ShareWifiPassword = ({ route }) => {
|
|
|
132
132
|
gateway: [data.gateway],
|
|
133
133
|
}));
|
|
134
134
|
}
|
|
135
|
-
if (data?.status && !data?.gateway) {
|
|
135
|
+
if (data?.status === 'error' && !data?.gateway) {
|
|
136
136
|
isWrongPassword.current = false;
|
|
137
137
|
setDataGateway((prev) => ({
|
|
138
138
|
...prev,
|
|
@@ -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,7 +148,9 @@ describe('Test select device type', () => {
|
|
|
147
148
|
});
|
|
148
149
|
expect(mockedNavigate).not.toBeCalled();
|
|
149
150
|
expect(spyToastError).toBeCalledWith(
|
|
150
|
-
getTranslate('en', 'reach_max_configs_per_unit')
|
|
151
|
+
getTranslate('en', 'reach_max_configs_per_unit'),
|
|
152
|
+
'',
|
|
153
|
+
7000
|
|
151
154
|
);
|
|
152
155
|
});
|
|
153
156
|
|
|
@@ -186,7 +189,9 @@ describe('Test select device type', () => {
|
|
|
186
189
|
});
|
|
187
190
|
expect(mockedNavigate).not.toBeCalled();
|
|
188
191
|
expect(spyToastError).toBeCalledWith(
|
|
189
|
-
getTranslate('en', 'reach_max_chips_per_unit')
|
|
192
|
+
getTranslate('en', 'reach_max_chips_per_unit'),
|
|
193
|
+
'',
|
|
194
|
+
7000
|
|
190
195
|
);
|
|
191
196
|
});
|
|
192
197
|
|
|
@@ -203,7 +208,9 @@ describe('Test select device type', () => {
|
|
|
203
208
|
},
|
|
204
209
|
});
|
|
205
210
|
expect(spyToastError).toBeCalledWith(
|
|
206
|
-
getTranslate('en', 'no_permission_plug_and_play_gateway')
|
|
211
|
+
getTranslate('en', 'no_permission_plug_and_play_gateway'),
|
|
212
|
+
'',
|
|
213
|
+
7000
|
|
207
214
|
);
|
|
208
215
|
});
|
|
209
216
|
|
|
@@ -220,7 +227,9 @@ describe('Test select device type', () => {
|
|
|
220
227
|
},
|
|
221
228
|
});
|
|
222
229
|
expect(spyToastError).toBeCalledWith(
|
|
223
|
-
getTranslate('en', 'no_permission_plug_and_play_zigbee')
|
|
230
|
+
getTranslate('en', 'no_permission_plug_and_play_zigbee'),
|
|
231
|
+
'',
|
|
232
|
+
7000
|
|
224
233
|
);
|
|
225
234
|
});
|
|
226
235
|
|
|
@@ -237,7 +246,9 @@ describe('Test select device type', () => {
|
|
|
237
246
|
},
|
|
238
247
|
});
|
|
239
248
|
expect(spyToastError).toBeCalledWith(
|
|
240
|
-
getTranslate('en', 'no_permission_plug_and_play_wifi')
|
|
249
|
+
getTranslate('en', 'no_permission_plug_and_play_wifi'),
|
|
250
|
+
'',
|
|
251
|
+
7000
|
|
241
252
|
);
|
|
242
253
|
});
|
|
243
254
|
|
|
@@ -254,7 +265,9 @@ describe('Test select device type', () => {
|
|
|
254
265
|
},
|
|
255
266
|
});
|
|
256
267
|
expect(spyToastError).toBeCalledWith(
|
|
257
|
-
getTranslate('en', 'no_permission_plug_and_play_modbus')
|
|
268
|
+
getTranslate('en', 'no_permission_plug_and_play_modbus'),
|
|
269
|
+
'',
|
|
270
|
+
7000
|
|
258
271
|
);
|
|
259
272
|
});
|
|
260
273
|
|
|
@@ -78,11 +78,21 @@ const MultiUnits = () => {
|
|
|
78
78
|
const handleOnAddNew = useCallback(() => {
|
|
79
79
|
if (unit?.id) {
|
|
80
80
|
if (permissions?.max_automations_per_unit <= data.length) {
|
|
81
|
-
ToastBottomHelper.error(
|
|
81
|
+
ToastBottomHelper.error(
|
|
82
|
+
t('reach_max_automations_per_unit', {
|
|
83
|
+
length: permissions.max_automations_per_unit,
|
|
84
|
+
}),
|
|
85
|
+
'',
|
|
86
|
+
7000
|
|
87
|
+
);
|
|
82
88
|
return;
|
|
83
89
|
}
|
|
84
90
|
} else if (!permissions?.smart_script_for_multi_unit) {
|
|
85
|
-
ToastBottomHelper.error(
|
|
91
|
+
ToastBottomHelper.error(
|
|
92
|
+
t('no_permission_smart_script_for_multi_unit'),
|
|
93
|
+
'',
|
|
94
|
+
7000
|
|
95
|
+
);
|
|
86
96
|
return;
|
|
87
97
|
}
|
|
88
98
|
if (tabActive === AUTOMATE_TABS.SCENARIO) {
|
|
@@ -271,7 +271,9 @@ describe('Test ScriptDetail', () => {
|
|
|
271
271
|
});
|
|
272
272
|
expect(mockNavigate).not.toBeCalled();
|
|
273
273
|
expect(spyToastError).toBeCalledWith(
|
|
274
|
-
getTranslate('en', 'reach_max_actions_per_automation')
|
|
274
|
+
getTranslate('en', 'reach_max_actions_per_automation'),
|
|
275
|
+
'',
|
|
276
|
+
7000
|
|
275
277
|
);
|
|
276
278
|
});
|
|
277
279
|
|
|
@@ -302,7 +302,13 @@ const ItemAdd = ({ automate, index }) => {
|
|
|
302
302
|
|
|
303
303
|
const onPressAddAction = useCallback(() => {
|
|
304
304
|
if (permissions?.max_actions_per_automation <= index) {
|
|
305
|
-
ToastBottomHelper.error(
|
|
305
|
+
ToastBottomHelper.error(
|
|
306
|
+
t('reach_max_actions_per_automation', {
|
|
307
|
+
length: permissions?.max_actions_per_automation,
|
|
308
|
+
}),
|
|
309
|
+
'',
|
|
310
|
+
7000
|
|
311
|
+
);
|
|
306
312
|
return;
|
|
307
313
|
}
|
|
308
314
|
const navParams = {
|
|
@@ -252,7 +252,9 @@ describe('Test MultiUnits', () => {
|
|
|
252
252
|
});
|
|
253
253
|
expect(mockedNavigate).not.toBeCalled();
|
|
254
254
|
expect(spyToastError).toBeCalledWith(
|
|
255
|
-
getTranslate('en', 'reach_max_automations_per_unit')
|
|
255
|
+
getTranslate('en', 'reach_max_automations_per_unit'),
|
|
256
|
+
'',
|
|
257
|
+
7000
|
|
256
258
|
);
|
|
257
259
|
});
|
|
258
260
|
|
|
@@ -288,7 +290,9 @@ describe('Test MultiUnits', () => {
|
|
|
288
290
|
});
|
|
289
291
|
expect(mockedNavigate).not.toBeCalled();
|
|
290
292
|
expect(spyToastError).toBeCalledWith(
|
|
291
|
-
getTranslate('en', 'no_permission_smart_script_for_multi_unit')
|
|
293
|
+
getTranslate('en', 'no_permission_smart_script_for_multi_unit'),
|
|
294
|
+
'',
|
|
295
|
+
7000
|
|
292
296
|
);
|
|
293
297
|
});
|
|
294
298
|
|
|
@@ -148,7 +148,9 @@ describe('Test Automate', () => {
|
|
|
148
148
|
});
|
|
149
149
|
expect(mockedNavigate).not.toBeCalled();
|
|
150
150
|
expect(spyToastError).toBeCalledWith(
|
|
151
|
-
getTranslate('en', 'reach_max_automations_per_unit')
|
|
151
|
+
getTranslate('en', 'reach_max_automations_per_unit'),
|
|
152
|
+
'',
|
|
153
|
+
7000
|
|
152
154
|
);
|
|
153
155
|
});
|
|
154
156
|
|
|
@@ -292,7 +294,9 @@ describe('Test Automate', () => {
|
|
|
292
294
|
});
|
|
293
295
|
expect(mockedNavigate).not.toBeCalled();
|
|
294
296
|
expect(spyToastError).toBeCalledWith(
|
|
295
|
-
getTranslate('en', 'no_permission_smart_script_for_multi_unit')
|
|
297
|
+
getTranslate('en', 'no_permission_smart_script_for_multi_unit'),
|
|
298
|
+
'',
|
|
299
|
+
7000
|
|
296
300
|
);
|
|
297
301
|
});
|
|
298
302
|
});
|
|
@@ -85,11 +85,21 @@ const Automate = () => {
|
|
|
85
85
|
if (id) {
|
|
86
86
|
// only limit per unit
|
|
87
87
|
if (permissions.max_automations_per_unit <= automates.length) {
|
|
88
|
-
ToastBottomHelper.error(
|
|
88
|
+
ToastBottomHelper.error(
|
|
89
|
+
t('reach_max_automations_per_unit', {
|
|
90
|
+
length: permissions.max_automations_per_unit,
|
|
91
|
+
}),
|
|
92
|
+
'',
|
|
93
|
+
7000
|
|
94
|
+
);
|
|
89
95
|
return;
|
|
90
96
|
}
|
|
91
97
|
} else if (!permissions?.smart_script_for_multi_unit) {
|
|
92
|
-
ToastBottomHelper.error(
|
|
98
|
+
ToastBottomHelper.error(
|
|
99
|
+
t('no_permission_smart_script_for_multi_unit'),
|
|
100
|
+
'',
|
|
101
|
+
7000
|
|
102
|
+
);
|
|
93
103
|
return;
|
|
94
104
|
}
|
|
95
105
|
navigate(Routes.UnitStack, {
|
|
@@ -12,8 +12,8 @@ import { API } from '../../../configs';
|
|
|
12
12
|
import api from '../../../utils/Apis/axios';
|
|
13
13
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
14
14
|
|
|
15
|
-
const wrapComponent = (item) => (
|
|
16
|
-
<SCProvider initState={mockSCStore(
|
|
15
|
+
const wrapComponent = (item, stateData = {}) => (
|
|
16
|
+
<SCProvider initState={mockSCStore(stateData)}>
|
|
17
17
|
<NotificationItem item={item} />
|
|
18
18
|
</SCProvider>
|
|
19
19
|
);
|
|
@@ -321,4 +321,44 @@ describe('test NotificationItem', () => {
|
|
|
321
321
|
'. You cannot access to this unit anymore.'
|
|
322
322
|
);
|
|
323
323
|
});
|
|
324
|
+
|
|
325
|
+
test('test case BROADCAST_NOTIFICATION', async () => {
|
|
326
|
+
item.content_code = NOTIFICATION_TYPES.BROADCAST_NOTIFICATION;
|
|
327
|
+
item.params = {
|
|
328
|
+
message: {
|
|
329
|
+
vi: 'vi message',
|
|
330
|
+
en: 'en message',
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
await act(async () => {
|
|
334
|
+
tree = await create(wrapComponent(item));
|
|
335
|
+
});
|
|
336
|
+
const instance = tree.root;
|
|
337
|
+
const customText = instance.findByProps({
|
|
338
|
+
accessibilityLabel: AccessibilityLabel.CUSTOM_TEXT,
|
|
339
|
+
});
|
|
340
|
+
expect(customText.props.children).toEqual('en message');
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
test('test case BROADCAST_NOTIFICATION language is vi', async () => {
|
|
344
|
+
item.content_code = NOTIFICATION_TYPES.BROADCAST_NOTIFICATION;
|
|
345
|
+
item.params = {
|
|
346
|
+
message: {
|
|
347
|
+
vi: 'vi message',
|
|
348
|
+
en: 'en message',
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
const localState = {
|
|
353
|
+
language: 'vi',
|
|
354
|
+
};
|
|
355
|
+
await act(async () => {
|
|
356
|
+
tree = await create(wrapComponent(item, localState));
|
|
357
|
+
});
|
|
358
|
+
const instance = tree.root;
|
|
359
|
+
const customText = instance.findByProps({
|
|
360
|
+
accessibilityLabel: AccessibilityLabel.CUSTOM_TEXT,
|
|
361
|
+
});
|
|
362
|
+
expect(customText.props.children).toEqual('vi message');
|
|
363
|
+
});
|
|
324
364
|
});
|
|
@@ -12,10 +12,12 @@ import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
|
12
12
|
import { axiosPost } from '../../../utils/Apis/axios';
|
|
13
13
|
import Routes from '../../../utils/Route';
|
|
14
14
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
15
|
+
import { useSCContextSelector } from '../../../context';
|
|
15
16
|
|
|
16
17
|
const NotificationItem = memo(({ item }) => {
|
|
17
18
|
const t = useTranslations();
|
|
18
19
|
const navigation = useNavigation();
|
|
20
|
+
const language = useSCContextSelector((state) => state.language);
|
|
19
21
|
const { id, icon, created_at, is_read, params, content_code } = item;
|
|
20
22
|
const [isRead, setIsRead] = useState(is_read);
|
|
21
23
|
const timeFormat = moment(created_at).format('LT DD/MM/YYYY');
|
|
@@ -386,10 +388,30 @@ const NotificationItem = memo(({ item }) => {
|
|
|
386
388
|
},
|
|
387
389
|
iconContent: <Image source={Images.logo} style={styles.logo} />,
|
|
388
390
|
};
|
|
391
|
+
case NOTIFICATION_TYPES.TRIAL_WILL_END: // to do Canh remove later
|
|
392
|
+
return {
|
|
393
|
+
content: customColorText(
|
|
394
|
+
t('text_notification_content_when_trial_will_end')
|
|
395
|
+
),
|
|
396
|
+
redirect: () => null,
|
|
397
|
+
iconContent: <Image source={Images.logo} style={styles.logo} />,
|
|
398
|
+
};
|
|
399
|
+
case NOTIFICATION_TYPES.FREE_TRIAL_SUBSCRIPTION:
|
|
400
|
+
return {
|
|
401
|
+
content: customColorText(
|
|
402
|
+
t('text_notification_content_your_account_upgraded_3_month')
|
|
403
|
+
),
|
|
404
|
+
};
|
|
405
|
+
case NOTIFICATION_TYPES.BROADCAST_NOTIFICATION:
|
|
406
|
+
return {
|
|
407
|
+
content: params?.message[language],
|
|
408
|
+
redirect: () => null,
|
|
409
|
+
iconContent: <Image source={Images.logo} style={styles.logo} />,
|
|
410
|
+
};
|
|
389
411
|
default:
|
|
390
412
|
return null;
|
|
391
413
|
}
|
|
392
|
-
}, [content_code, customColorText, icon, navigation, params, t]);
|
|
414
|
+
}, [content_code, customColorText, icon, navigation, params, t, language]);
|
|
393
415
|
|
|
394
416
|
const { content, redirect, iconContent } = renderItem() || {};
|
|
395
417
|
|
|
@@ -40,8 +40,10 @@ const MemberList = ({ route }) => {
|
|
|
40
40
|
if (permissions?.max_members_per_unit <= dataMembers.length) {
|
|
41
41
|
ToastBottomHelper.error(
|
|
42
42
|
t('reach_max_members_per_unit', {
|
|
43
|
-
|
|
44
|
-
})
|
|
43
|
+
length: permissions?.max_members_per_unit,
|
|
44
|
+
}),
|
|
45
|
+
'',
|
|
46
|
+
7000
|
|
45
47
|
);
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
@@ -101,7 +101,9 @@ describe('test MemberList', () => {
|
|
|
101
101
|
});
|
|
102
102
|
expect(mockedNavigate).not.toBeCalled();
|
|
103
103
|
expect(spyToastError).toBeCalledWith(
|
|
104
|
-
getTranslate('en', 'reach_max_members_per_unit')
|
|
104
|
+
getTranslate('en', 'reach_max_members_per_unit'),
|
|
105
|
+
'',
|
|
106
|
+
7000
|
|
105
107
|
);
|
|
106
108
|
});
|
|
107
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,7 +133,11 @@ const AddSubUnit = ({ route }) => {
|
|
|
124
133
|
cleanData();
|
|
125
134
|
} else {
|
|
126
135
|
awaitCreate.current = false;
|
|
127
|
-
|
|
136
|
+
if (
|
|
137
|
+
unitChoose?.stations?.length >= permissions?.max_stations_per_unit
|
|
138
|
+
) {
|
|
139
|
+
ToastBottomHelper.error(t('reach_max_stations_per_unit'), '', 7000);
|
|
140
|
+
}
|
|
128
141
|
}
|
|
129
142
|
}
|
|
130
143
|
}
|
|
@@ -141,6 +154,8 @@ const AddSubUnit = ({ route }) => {
|
|
|
141
154
|
goBack,
|
|
142
155
|
navigate,
|
|
143
156
|
route.params,
|
|
157
|
+
unitChoose?.stations?.length,
|
|
158
|
+
permissions?.max_stations_per_unit,
|
|
144
159
|
]);
|
|
145
160
|
|
|
146
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
|
);
|
|
@@ -182,7 +183,8 @@ describe('Test AddSubUnit', () => {
|
|
|
182
183
|
expect(Toast.show).toHaveBeenCalledWith({
|
|
183
184
|
type: 'error',
|
|
184
185
|
position: 'bottom',
|
|
185
|
-
text1:
|
|
186
|
+
text1: 'CLIENT_ERROR',
|
|
187
|
+
text2: undefined,
|
|
186
188
|
visibilityTime: 1000,
|
|
187
189
|
});
|
|
188
190
|
});
|
|
@@ -296,7 +298,19 @@ describe('Test AddSubUnit', () => {
|
|
|
296
298
|
};
|
|
297
299
|
mock.onPost(API.SUB_UNIT.CREATE_SUB_UNIT(1)).reply(200, {});
|
|
298
300
|
await act(async () => {
|
|
299
|
-
tree = await create(
|
|
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
|
+
);
|
|
300
314
|
});
|
|
301
315
|
const instance = tree.root;
|
|
302
316
|
const viewButtonBottom = await makeValidateData(instance);
|
|
@@ -306,6 +320,45 @@ describe('Test AddSubUnit', () => {
|
|
|
306
320
|
expect(mockNavigationDispatch).toBeCalledWith(mockReplace);
|
|
307
321
|
});
|
|
308
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
|
+
|
|
309
362
|
it('test create sub-unit type AddHassiDevice', async () => {
|
|
310
363
|
route.params = {
|
|
311
364
|
...route.params,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useSelector } from 'react-redux';
|
|
3
2
|
import { act, create } from 'react-test-renderer';
|
|
4
3
|
import Toast from 'react-native-toast-message';
|
|
5
4
|
import SubUnitDetail from '../Detail';
|
|
@@ -47,23 +46,6 @@ const wrapComponent = (route) => (
|
|
|
47
46
|
|
|
48
47
|
describe('Test SubUnitDetail', () => {
|
|
49
48
|
let route;
|
|
50
|
-
let stationState = {
|
|
51
|
-
id: 2,
|
|
52
|
-
camera: {
|
|
53
|
-
id: 1,
|
|
54
|
-
uri: 'camera-uri',
|
|
55
|
-
preview_uri: 'camera-preview-uri',
|
|
56
|
-
},
|
|
57
|
-
sensors: [
|
|
58
|
-
{
|
|
59
|
-
icon: '',
|
|
60
|
-
id: 1,
|
|
61
|
-
action: { icon: '', color: '' },
|
|
62
|
-
name: '',
|
|
63
|
-
value: '',
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
};
|
|
67
49
|
|
|
68
50
|
beforeEach(() => {
|
|
69
51
|
route = {
|
|
@@ -80,26 +62,6 @@ describe('Test SubUnitDetail', () => {
|
|
|
80
62
|
},
|
|
81
63
|
},
|
|
82
64
|
};
|
|
83
|
-
|
|
84
|
-
const localState = {
|
|
85
|
-
language: 'en',
|
|
86
|
-
auth: {
|
|
87
|
-
account: {
|
|
88
|
-
user: {
|
|
89
|
-
id: 2,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
unit: {
|
|
94
|
-
unitDetail: {
|
|
95
|
-
id: 1,
|
|
96
|
-
stations: [stationState],
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
useSelector.mockImplementation((getter) => {
|
|
101
|
-
return getter(localState);
|
|
102
|
-
});
|
|
103
65
|
});
|
|
104
66
|
|
|
105
67
|
afterEach(() => {
|
|
@@ -3,7 +3,6 @@ import { TouchableOpacity, Image } from 'react-native';
|
|
|
3
3
|
import MockAdapter from 'axios-mock-adapter';
|
|
4
4
|
import { AlertAction, ImagePicker, ViewButtonBottom } from '../../../commons';
|
|
5
5
|
import { API } from '../../../configs';
|
|
6
|
-
import { useSelector } from 'react-redux';
|
|
7
6
|
import { act, create } from 'react-test-renderer';
|
|
8
7
|
import Toast from 'react-native-toast-message';
|
|
9
8
|
|
|
@@ -78,15 +77,6 @@ describe('Test EditSubUnit', () => {
|
|
|
78
77
|
},
|
|
79
78
|
},
|
|
80
79
|
};
|
|
81
|
-
const localState = {
|
|
82
|
-
language: 'en',
|
|
83
|
-
unit: {
|
|
84
|
-
unitDetail: {
|
|
85
|
-
id: 1,
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
useSelector.mockImplementation((getter) => getter(localState));
|
|
90
80
|
|
|
91
81
|
mockedDispatch.mockClear();
|
|
92
82
|
mock.reset();
|
|
@@ -33,7 +33,13 @@ const AddMenu = memo(({ unit, afterItemClick, showAdd, setHideAdd }) => {
|
|
|
33
33
|
onClick: () => {
|
|
34
34
|
// 2 is station favorite and smart
|
|
35
35
|
if (unit.stations.length - 2 >= permissions.max_stations_per_unit) {
|
|
36
|
-
ToastBottomHelper.error(
|
|
36
|
+
ToastBottomHelper.error(
|
|
37
|
+
t('reach_max_stations_per_unit', {
|
|
38
|
+
length: permissions.max_stations_per_unit,
|
|
39
|
+
}),
|
|
40
|
+
'',
|
|
41
|
+
7000
|
|
42
|
+
);
|
|
37
43
|
return;
|
|
38
44
|
}
|
|
39
45
|
navigation.navigate(Routes.AddSubUnitStack, {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/* eslint-disable promise/prefer-await-to-callbacks */
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { useSelector } from 'react-redux';
|
|
4
2
|
import WaterQualityGuide from '../index';
|
|
5
3
|
import { create, act } from 'react-test-renderer';
|
|
6
4
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
@@ -28,12 +26,6 @@ describe('Test WaterQualityGuide', () => {
|
|
|
28
26
|
let route;
|
|
29
27
|
|
|
30
28
|
beforeEach(() => {
|
|
31
|
-
const localState = {
|
|
32
|
-
language: 'en',
|
|
33
|
-
};
|
|
34
|
-
useSelector.mockImplementation((cb) => {
|
|
35
|
-
return cb(localState);
|
|
36
|
-
});
|
|
37
29
|
Date.now = jest.fn(() => new Date('2021-01-24T12:00:00.000Z'));
|
|
38
30
|
route = {
|
|
39
31
|
params: {
|
package/src/utils/Apis/axios.js
CHANGED
|
@@ -78,6 +78,9 @@ const parseErrorResponse = async (error) => {
|
|
|
78
78
|
if (firstKey !== 'non_field_errors') {
|
|
79
79
|
message = `${firstKey}: ${message}`;
|
|
80
80
|
}
|
|
81
|
+
if (firstKey === 'detail') {
|
|
82
|
+
message = error.data[firstKey];
|
|
83
|
+
}
|
|
81
84
|
} else {
|
|
82
85
|
message = error.data || error.problem;
|
|
83
86
|
}
|
|
@@ -882,6 +882,13 @@ export default {
|
|
|
882
882
|
'Your ownership of **unit_name** has been assigned to **new_owner_name**.',
|
|
883
883
|
text_notification_content_change_unit_for_new_owner:
|
|
884
884
|
'You are now the owner of **unit_name**.',
|
|
885
|
+
text_notification_content_when_trial_will_end:
|
|
886
|
+
'The service usage period is only **days** days left, ' +
|
|
887
|
+
'Package **product_name** will automatically renew on **trial_end** with **amount** **currency**',
|
|
888
|
+
text_notification_content_your_account_upgraded_3_month:
|
|
889
|
+
'Congratulations! Your account has just been upgraded to a 3-month free PREMIUM plan ' +
|
|
890
|
+
'as a sincere thanking word to your loyalty of the BETA version of E-Ra IoT Platform. ' +
|
|
891
|
+
"Let's experience the new features now!",
|
|
885
892
|
this_spot_does_not_exsit: 'This spot does not exist',
|
|
886
893
|
please_scan_again_or_contact_the_parking_manager:
|
|
887
894
|
'Please scan again or contact the parking manager',
|
|
@@ -1389,27 +1396,28 @@ export default {
|
|
|
1389
1396
|
value_must_be_less_than_max: 'Value must be less than {max}',
|
|
1390
1397
|
value_must_be_a_number: 'Value must be a number',
|
|
1391
1398
|
reach_max_stations_per_unit:
|
|
1392
|
-
'
|
|
1399
|
+
'Sub-unit is incomplete. Please visit e-ra to complete your operation.',
|
|
1393
1400
|
not_support_plug_and_play: 'Not support plug and play',
|
|
1394
1401
|
reach_max_actions_per_automation:
|
|
1395
|
-
'
|
|
1402
|
+
'Action is incomplete. Please visit e-ra to complete your operation.',
|
|
1396
1403
|
reach_max_automations_per_unit:
|
|
1397
|
-
'
|
|
1398
|
-
reach_max_members_per_unit:
|
|
1399
|
-
|
|
1400
|
-
|
|
1404
|
+
'Automation is incomplete. Please visit e-ra to complete your operation.',
|
|
1405
|
+
reach_max_members_per_unit:
|
|
1406
|
+
'Member is incomplete. Please visit e-ra to complete your operation.',
|
|
1407
|
+
reach_max_chips_per_unit:
|
|
1408
|
+
'Chip is incomplete. Please visit e-ra to complete your operation.',
|
|
1409
|
+
reach_max_configs_per_unit:
|
|
1410
|
+
'Config is incomplete. Please visit e-ra to complete your operation.',
|
|
1401
1411
|
no_permission_plug_and_play_modbus:
|
|
1402
|
-
'Add modbus is
|
|
1412
|
+
'Add modbus is incomplete. Please visit e-ra to complete your operation.',
|
|
1403
1413
|
no_permission_plug_and_play_zigbee:
|
|
1404
|
-
'Add zigbee is
|
|
1414
|
+
'Add zigbee is incomplete. Please visit e-ra to complete your operation.',
|
|
1405
1415
|
no_permission_plug_and_play_wifi:
|
|
1406
|
-
'Add wifi is
|
|
1416
|
+
'Add wifi is incomplete. Please visit e-ra to complete your operation.',
|
|
1407
1417
|
no_permission_plug_and_play_gateway:
|
|
1408
|
-
'Add gateway is
|
|
1418
|
+
'Add gateway is incomplete. Please visit e-ra to complete your operation.',
|
|
1409
1419
|
no_permission_view_action_log:
|
|
1410
|
-
|
|
1411
|
-
'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.',
|
|
1412
1421
|
no_permission_smart_script_for_multi_unit:
|
|
1413
|
-
|
|
1414
|
-
'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.',
|
|
1415
1423
|
};
|
|
@@ -898,6 +898,13 @@ export default {
|
|
|
898
898
|
'Quyền sở hữu **unit_name** của bạn đã được chỉ định cho **new_owner_name**.',
|
|
899
899
|
text_notification_content_change_unit_for_new_owner:
|
|
900
900
|
'Bạn hiện là chủ sở hữu của **unit_name**.',
|
|
901
|
+
text_notification_content_when_trial_will_end:
|
|
902
|
+
'Thời hạn sử dụng dịch vụ chỉ còn **days** ngày, ' +
|
|
903
|
+
'Gói **product_name** sẽ tự động gia hạn vào ngày **trial_end** với **amount** **currency**',
|
|
904
|
+
text_notification_content_your_account_upgraded_3_month:
|
|
905
|
+
'Xin chúc mừng! Tài khoản của bạn vừa được nâng cấp lên gói PREMIUM miễn phí 3 tháng ' +
|
|
906
|
+
'nhằm tri ân người dùng phiên bản BETA của E-Ra IoT Platform. ' +
|
|
907
|
+
'Chúng tôi xin cảm ơn sự ủng hộ của bạn. Cùng trải nghiệm các tính năng mới ngay thôi!',
|
|
901
908
|
this_spot_does_not_exsit: 'Vị trí đỗ này không tồn tại',
|
|
902
909
|
please_scan_again_or_contact_the_parking_manager:
|
|
903
910
|
'Vui lòng quét lại hoặc liên hệ với người quản lý bãi đậu xe',
|
|
@@ -1397,24 +1404,28 @@ export default {
|
|
|
1397
1404
|
value_must_be_less_than_max: 'Giá trị phải nhỏ hơn {max}',
|
|
1398
1405
|
value_must_be_a_number: 'Giá trị phải là một số',
|
|
1399
1406
|
reach_max_stations_per_unit:
|
|
1400
|
-
'
|
|
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.',
|
|
1401
1408
|
not_support_plug_and_play: 'Không hỗ trợ kết nối tự động',
|
|
1402
|
-
reach_max_actions_per_automation:
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1409
|
+
reach_max_actions_per_automation:
|
|
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
|
+
reach_max_automations_per_unit:
|
|
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
|
+
reach_max_members_per_unit:
|
|
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
|
+
reach_max_chips_per_unit:
|
|
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
|
+
reach_max_configs_per_unit:
|
|
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.',
|
|
1407
1419
|
no_permission_plug_and_play_modbus:
|
|
1408
|
-
'Kết nối tự động modbus
|
|
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.',
|
|
1409
1421
|
no_permission_plug_and_play_zigbee:
|
|
1410
|
-
'Kết nối tự động zigbee
|
|
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.',
|
|
1411
1423
|
no_permission_plug_and_play_wifi:
|
|
1412
|
-
'Kết nối tự động wifi
|
|
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.',
|
|
1413
1425
|
no_permission_plug_and_play_gateway:
|
|
1414
|
-
'Kết nối tự động gateway
|
|
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.',
|
|
1415
1427
|
no_permission_view_action_log:
|
|
1416
|
-
'Xem lịch sử hoạt động
|
|
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.',
|
|
1417
1429
|
no_permission_smart_script_for_multi_unit:
|
|
1418
|
-
|
|
1419
|
-
'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.',
|
|
1420
1431
|
};
|
package/src/utils/Utils.js
CHANGED
|
@@ -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:
|
|
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:
|
|
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:
|
|
115
|
+
visibilityTime: visibilityTime,
|
|
116
116
|
});
|
|
117
117
|
},
|
|
118
118
|
};
|