@eohjsc/react-native-smart-city 0.4.79 → 0.4.81
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/Action/ItemQuickAction.js +10 -2
- package/src/commons/Action/__test__/ItemQuickAction.test.js +28 -2
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +1 -1
- package/src/screens/Automate/ScriptDetail/Styles/indexStyles.js +4 -0
- package/src/screens/Automate/ScriptDetail/index.js +4 -4
- package/src/screens/Sharing/SelectUser.js +1 -0
- package/src/screens/Sharing/Styles/SelectPermissionStyles.js +1 -2
package/package.json
CHANGED
|
@@ -18,6 +18,7 @@ const ItemQuickAction = memo(
|
|
|
18
18
|
off_status,
|
|
19
19
|
interval,
|
|
20
20
|
will_auto_update_status,
|
|
21
|
+
on_state_values,
|
|
21
22
|
} = quick_action || {};
|
|
22
23
|
const [action, setAction] = useState(sensor?.action);
|
|
23
24
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -29,9 +30,16 @@ const ItemQuickAction = memo(
|
|
|
29
30
|
const sendRemoteCommand = useRemoteControl();
|
|
30
31
|
const [processing, setProcessing] = useState(false);
|
|
31
32
|
|
|
33
|
+
const getIsOnValue = useCallback(() => {
|
|
34
|
+
if (on_state_values && on_state_values.length > 0) {
|
|
35
|
+
return on_state_values.includes(currentValue);
|
|
36
|
+
}
|
|
37
|
+
return !!currentValue;
|
|
38
|
+
}, [currentValue, on_state_values]);
|
|
39
|
+
|
|
32
40
|
useEffect(() => {
|
|
33
|
-
setIsOn(
|
|
34
|
-
}, [
|
|
41
|
+
setIsOn(getIsOnValue());
|
|
42
|
+
}, [getIsOnValue]);
|
|
35
43
|
|
|
36
44
|
useEffect(() => {
|
|
37
45
|
if (!quick_action) {
|
|
@@ -33,14 +33,14 @@ describe('Test ItemQuickAction', () => {
|
|
|
33
33
|
config_id: 51,
|
|
34
34
|
interval: 5000,
|
|
35
35
|
off_action: {
|
|
36
|
-
icon: '
|
|
36
|
+
icon: 'on',
|
|
37
37
|
command_prefer_over_bluetooth: true,
|
|
38
38
|
command_prefer_over_googlehome: false,
|
|
39
39
|
command_prefer_over_internet: false,
|
|
40
40
|
id: 10,
|
|
41
41
|
},
|
|
42
42
|
on_action: {
|
|
43
|
-
icon: '
|
|
43
|
+
icon: 'off',
|
|
44
44
|
command_prefer_over_bluetooth: true,
|
|
45
45
|
command_prefer_over_googlehome: false,
|
|
46
46
|
command_prefer_over_internet: false,
|
|
@@ -258,4 +258,30 @@ describe('Test ItemQuickAction', () => {
|
|
|
258
258
|
});
|
|
259
259
|
expect(Toast.show).not.toBeCalled();
|
|
260
260
|
});
|
|
261
|
+
it('test config value 0 on_state_values 0', async () => {
|
|
262
|
+
sensor.quick_action.on_state_values = [0];
|
|
263
|
+
const globalStates = require('../../../iot/states');
|
|
264
|
+
globalStates.useConfigGlobalState = () => [{ 51: { value: 0 } }, null];
|
|
265
|
+
|
|
266
|
+
await act(async () => {
|
|
267
|
+
tree = await create(
|
|
268
|
+
<ItemQuickAction sensor={sensor} wrapperStyle={style} />
|
|
269
|
+
);
|
|
270
|
+
});
|
|
271
|
+
const icon = tree.root.findByType(IconComponent);
|
|
272
|
+
expect(icon.props.icon).toEqual(sensor.quick_action.off_action.icon);
|
|
273
|
+
});
|
|
274
|
+
it('test config value 0 on_state_values 1', async () => {
|
|
275
|
+
sensor.quick_action.on_state_values = [1];
|
|
276
|
+
const globalStates = require('../../../iot/states');
|
|
277
|
+
globalStates.useConfigGlobalState = () => [{ 51: { value: 0 } }, null];
|
|
278
|
+
|
|
279
|
+
await act(async () => {
|
|
280
|
+
tree = await create(
|
|
281
|
+
<ItemQuickAction sensor={sensor} wrapperStyle={style} />
|
|
282
|
+
);
|
|
283
|
+
});
|
|
284
|
+
const icon = tree.root.findByType(IconComponent);
|
|
285
|
+
expect(icon.props.icon).toEqual(sensor.quick_action.on_action.icon);
|
|
286
|
+
});
|
|
261
287
|
});
|
|
@@ -46,7 +46,7 @@ const QualityIndicatorItem = memo(
|
|
|
46
46
|
<Text size={24} color={Colors.Gray9} style={styles.txtValue}>
|
|
47
47
|
{measure && measure.length ? `${value} ${measure}` : `${value}`}
|
|
48
48
|
</Text>
|
|
49
|
-
{!!evaluate && (
|
|
49
|
+
{!!evaluate?.color && (
|
|
50
50
|
<Text size={12} color={evaluate.color} style={styles.txtEvaluate}>
|
|
51
51
|
{evaluate.text}
|
|
52
52
|
</Text>
|
|
@@ -21,7 +21,6 @@ import MenuActionMore from '../../../commons/MenuActionMore';
|
|
|
21
21
|
import Add from '../../../../assets/images/Add.svg';
|
|
22
22
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
23
23
|
import { axiosGet, axiosPost } from '../../../utils/Apis/axios';
|
|
24
|
-
import FImage from '../../../commons/FImage';
|
|
25
24
|
import Routes from '../../../utils/Route';
|
|
26
25
|
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
27
26
|
import ItemAutomate from '../../../commons/Automate/ItemAutomate';
|
|
@@ -31,6 +30,7 @@ import RenameScript from './Components/RenameScript';
|
|
|
31
30
|
import DeleteScript from './Components/DeleteScript';
|
|
32
31
|
import Images from '../../../configs/Images';
|
|
33
32
|
import { useBackendPermission } from '../../../utils/Permission/backend';
|
|
33
|
+
import IconComponent from '../../../commons/IconComponent';
|
|
34
34
|
|
|
35
35
|
const PreventDoubleTouch = withPreventDoubleClick(TouchableOpacity);
|
|
36
36
|
|
|
@@ -265,9 +265,9 @@ const Item = ({ item, index }) => {
|
|
|
265
265
|
</Text>
|
|
266
266
|
</View>
|
|
267
267
|
<View style={styles.rightItem}>
|
|
268
|
-
<
|
|
269
|
-
|
|
270
|
-
style={styles.
|
|
268
|
+
<IconComponent
|
|
269
|
+
icon={item?.sensor_icon_kit}
|
|
270
|
+
style={styles.iconEndDevice}
|
|
271
271
|
/>
|
|
272
272
|
<View style={styles.contentItem}>
|
|
273
273
|
<View style={styles.titleItem}>
|