@eohjsc/react-native-smart-city 0.7.9 → 0.7.11
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 +2 -2
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +3 -7
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +2 -5
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +2 -6
- package/src/screens/Automate/AddNewAction/SetupScriptEmail.js +7 -3
- package/src/screens/Automate/AddNewAction/SetupScriptReceiverEmail.js +1 -1
- package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +1 -1
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptEmail.test.js +1 -1
- package/src/screens/Automate/EditActionsList/UpdateReceiverEmailScript.js +1 -1
- package/src/screens/Automate/ScriptDetail/Styles/indexStyles.js +10 -0
- package/src/screens/Automate/ScriptDetail/index.js +2 -2
- package/src/screens/SubUnit/ManageSubUnit.js +1 -1
- package/src/utils/I18n/translations/en.js +0 -1
- package/src/utils/I18n/translations/vi.js +0 -1
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.7.
|
|
4
|
+
"version": "0.7.11",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
"react-native-geocoder": "^0.5.0",
|
|
156
156
|
"react-native-gesture-handler": "^2.17.1",
|
|
157
157
|
"react-native-get-location": "^2.0.0",
|
|
158
|
-
"react-native-image-crop-picker": "
|
|
158
|
+
"react-native-image-crop-picker": "0.41.2",
|
|
159
159
|
"react-native-image-resizer": "^1.4.5",
|
|
160
160
|
"react-native-input-credit-card": "^0.5.5",
|
|
161
161
|
"react-native-iphone-x-helper": "^1.2.1",
|
|
@@ -38,15 +38,11 @@ const GridItem = ({ item, doAction, sensor }) => {
|
|
|
38
38
|
|
|
39
39
|
const doActionAndWatchConfig = useCallback(
|
|
40
40
|
(actionData) => {
|
|
41
|
-
let data =
|
|
41
|
+
let data = null;
|
|
42
42
|
if (allow_config_store_value && config) {
|
|
43
|
-
data = {
|
|
44
|
-
config_id: config,
|
|
45
|
-
config_value: is_on_value,
|
|
46
|
-
value: is_on_value,
|
|
47
|
-
};
|
|
43
|
+
data = JSON.stringify({ config_id: config, config_value: is_on_value });
|
|
48
44
|
}
|
|
49
|
-
doAction(actionData,
|
|
45
|
+
doAction(actionData, data);
|
|
50
46
|
if (sensor?.is_managed_by_backend) {
|
|
51
47
|
if (config && sensor.device_type === DEVICE_TYPE.LG_THINQ) {
|
|
52
48
|
watchMultiConfigs([config]);
|
|
@@ -75,10 +75,7 @@ describe('Test StatesGridActionTemplate', () => {
|
|
|
75
75
|
await act(async () => {
|
|
76
76
|
await touchableOpacities[0].props.onPress();
|
|
77
77
|
});
|
|
78
|
-
expect(mockDoAction).toHaveBeenCalledWith(
|
|
79
|
-
mockActionData,
|
|
80
|
-
JSON.stringify({ value: 1 })
|
|
81
|
-
);
|
|
78
|
+
expect(mockDoAction).toHaveBeenCalledWith(mockActionData, null);
|
|
82
79
|
});
|
|
83
80
|
|
|
84
81
|
it('test trigger special action', async () => {
|
|
@@ -102,7 +99,7 @@ describe('Test StatesGridActionTemplate', () => {
|
|
|
102
99
|
});
|
|
103
100
|
expect(mockDoAction).toHaveBeenCalledWith(
|
|
104
101
|
mockActionData,
|
|
105
|
-
JSON.stringify({ config_id: 1, config_value: 1
|
|
102
|
+
JSON.stringify({ config_id: 1, config_value: 1 })
|
|
106
103
|
);
|
|
107
104
|
});
|
|
108
105
|
});
|
|
@@ -16,14 +16,10 @@ const ActionItem = ({
|
|
|
16
16
|
item,
|
|
17
17
|
}) => {
|
|
18
18
|
const handleSelectAction = useCallback(() => {
|
|
19
|
-
let actionData =
|
|
19
|
+
let actionData = null;
|
|
20
20
|
const { allow_config_store_value, config, is_on_value } = item;
|
|
21
21
|
if (allow_config_store_value && config) {
|
|
22
|
-
actionData = {
|
|
23
|
-
config_id: config,
|
|
24
|
-
config_value: is_on_value,
|
|
25
|
-
value: is_on_value,
|
|
26
|
-
};
|
|
22
|
+
actionData = { config_id: config, config_value: is_on_value };
|
|
27
23
|
}
|
|
28
24
|
setActionName(item.text);
|
|
29
25
|
|
|
@@ -14,7 +14,11 @@ const SetupScriptEmail = ({ route }) => {
|
|
|
14
14
|
const t = useTranslations();
|
|
15
15
|
const { goBack, navigate } = useNavigation();
|
|
16
16
|
const { automate, unitId, multiUnit } = route.params || {};
|
|
17
|
-
const
|
|
17
|
+
const initialUnitId = useMemo(
|
|
18
|
+
() => unitId || multiUnit.id,
|
|
19
|
+
[unitId, multiUnit?.id]
|
|
20
|
+
);
|
|
21
|
+
const [formData, setFormData] = useState({ unit: initialUnitId });
|
|
18
22
|
|
|
19
23
|
const onChangeTitle = (value) => {
|
|
20
24
|
setFormData((state) => ({
|
|
@@ -32,10 +36,10 @@ const SetupScriptEmail = ({ route }) => {
|
|
|
32
36
|
const onNext = useCallback(async () => {
|
|
33
37
|
navigate(Routes.SetupScriptReceiverEmail, {
|
|
34
38
|
automate,
|
|
35
|
-
unitId:
|
|
39
|
+
unitId: initialUnitId,
|
|
36
40
|
formData,
|
|
37
41
|
});
|
|
38
|
-
}, [
|
|
42
|
+
}, [navigate, automate, initialUnitId, formData]);
|
|
39
43
|
|
|
40
44
|
const canSave = useMemo(() => {
|
|
41
45
|
const { title, message } = formData || {};
|
|
@@ -11,9 +11,9 @@ import { API, Colors } from '../../../configs';
|
|
|
11
11
|
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
12
12
|
import Routes from '../../../utils/Route';
|
|
13
13
|
import moment from 'moment';
|
|
14
|
-
import { Image } from 'react-native-svg';
|
|
15
14
|
import CheckBox from '@react-native-community/checkbox';
|
|
16
15
|
import { useSCContextSelector } from '../../../context';
|
|
16
|
+
import { Image } from 'react-native';
|
|
17
17
|
|
|
18
18
|
const SetupScriptReceiverEmail = ({ route }) => {
|
|
19
19
|
const t = useTranslations();
|
|
@@ -41,7 +41,7 @@ describe('Test SetupScriptEmail', () => {
|
|
|
41
41
|
useRoute.mockImplementation(() => route);
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
it('SetupScriptNotify onPress create script
|
|
44
|
+
it('SetupScriptNotify onPress create script email success', async () => {
|
|
45
45
|
mock.onPost(API.AUTOMATE.ADD_SCRIPT_NOTIFY(1)).reply(200);
|
|
46
46
|
await act(async () => {
|
|
47
47
|
tree = await renderer.create(wrapComponent(route));
|
|
@@ -11,9 +11,9 @@ import { API, Colors } from '../../../configs';
|
|
|
11
11
|
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
12
12
|
import Routes from '../../../utils/Route';
|
|
13
13
|
import moment from 'moment';
|
|
14
|
-
import { Image } from 'react-native-svg';
|
|
15
14
|
import CheckBox from '@react-native-community/checkbox';
|
|
16
15
|
import { useSCContextSelector } from '../../../context';
|
|
16
|
+
import { Image } from 'react-native';
|
|
17
17
|
|
|
18
18
|
const UpdateReceiverEmailScript = ({ route }) => {
|
|
19
19
|
const t = useTranslations();
|
|
@@ -80,6 +80,16 @@ export default StyleSheet.create({
|
|
|
80
80
|
height: 100,
|
|
81
81
|
marginBottom: 16,
|
|
82
82
|
},
|
|
83
|
+
rightItemAction: {
|
|
84
|
+
flex: 1,
|
|
85
|
+
borderColor: Colors.Gray4,
|
|
86
|
+
borderWidth: 1,
|
|
87
|
+
borderRadius: 4,
|
|
88
|
+
paddingVertical: 15,
|
|
89
|
+
paddingHorizontal: 16,
|
|
90
|
+
marginLeft: 4,
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
},
|
|
83
93
|
leftItem: {
|
|
84
94
|
width: 41,
|
|
85
95
|
height: '100%',
|
|
@@ -311,7 +311,7 @@ const ScriptDetail = ({ route }) => {
|
|
|
311
311
|
|
|
312
312
|
<View style={styles.row}>
|
|
313
313
|
<Text type="H3" color={Colors.Gray9} semibold>
|
|
314
|
-
{t('
|
|
314
|
+
{t('actions_list')}
|
|
315
315
|
</Text>
|
|
316
316
|
{data.length > 0 && !!can_edit && !!enableScript && (
|
|
317
317
|
<TouchableOpacity
|
|
@@ -414,7 +414,7 @@ const Item = ({ item, index, enableScript, t }) => {
|
|
|
414
414
|
{paddedIndex}
|
|
415
415
|
</Text>
|
|
416
416
|
</View>
|
|
417
|
-
<View style={styles.
|
|
417
|
+
<View style={styles.rightItemAction}>
|
|
418
418
|
<IconComponent icon={sensor_icon_kit} style={styles.iconEndDevice} />
|
|
419
419
|
<View style={styles.contentItem}>
|
|
420
420
|
<View style={styles.titleItem}>
|
|
@@ -50,7 +50,7 @@ const StationList = ({ stations, onEditSubUnit }) => {
|
|
|
50
50
|
/>
|
|
51
51
|
}
|
|
52
52
|
text={item.name}
|
|
53
|
-
subtext={`${item.devices
|
|
53
|
+
subtext={`${item.devices?.length} ${t('devices').toLowerCase()}`}
|
|
54
54
|
onPress={() => onEditSubUnit(item)}
|
|
55
55
|
rightComponent={
|
|
56
56
|
<IconOutline name="right" size={20} color={Colors.Gray6} />
|
|
@@ -267,7 +267,6 @@ export default {
|
|
|
267
267
|
setup_the_conditions: 'Setup the conditions',
|
|
268
268
|
setup_the_schedule: 'Setup the Schedule',
|
|
269
269
|
des_launch_one_tap: 'Quick button create at the dashboard',
|
|
270
|
-
active_list: 'Actions List',
|
|
271
270
|
text_very_good_level: 'Very good',
|
|
272
271
|
text_good_level: 'Good',
|
|
273
272
|
text_moderate_level: 'Moderate',
|
|
@@ -50,7 +50,6 @@ export default {
|
|
|
50
50
|
schedule: 'Lịch trình',
|
|
51
51
|
event: 'Sự kiện',
|
|
52
52
|
des_launch_one_tap: 'Tạo nút nhanh trên trang tổng quan',
|
|
53
|
-
active_list: 'Danh sách hành động',
|
|
54
53
|
filtering: 'Đang sục rửa',
|
|
55
54
|
insufficient_water_input: 'Thiếu nước đầu vào.',
|
|
56
55
|
check_water_leak: 'Kiểm tra rò rỉ nước.',
|