@eohjsc/react-native-smart-city 0.4.49 → 0.4.51
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 +2 -4
- package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +1 -1
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +4 -4
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +1 -1
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +1 -1
- package/src/commons/IconComponent/index.js +3 -7
- package/src/configs/SCConfig.js +6 -0
- package/src/utils/Apis/axios.js +2 -0
package/package.json
CHANGED
|
@@ -7,8 +7,7 @@ import { useConfigGlobalState } from '../../iot/states';
|
|
|
7
7
|
import IconComponent from '../IconComponent';
|
|
8
8
|
|
|
9
9
|
const ItemQuickAction = memo(
|
|
10
|
-
({ sensor, wrapperStyle, setStatus, iconSize =
|
|
11
|
-
const [isSendingCommand, setIsSendingCommand] = useState(false);
|
|
10
|
+
({ sensor, wrapperStyle, setStatus, iconSize = 30 }) => {
|
|
12
11
|
const [action, setAction] = useState(sensor.action);
|
|
13
12
|
// eslint-disable-next-line no-unused-vars
|
|
14
13
|
const [configValues, _] = useConfigGlobalState('configValues');
|
|
@@ -64,7 +63,6 @@ const ItemQuickAction = memo(
|
|
|
64
63
|
data = JSON.stringify(data);
|
|
65
64
|
}
|
|
66
65
|
await sendRemoteCommand(sensor, action, data, userId);
|
|
67
|
-
setIsSendingCommand(true);
|
|
68
66
|
|
|
69
67
|
if (!sensor.quick_action.will_auto_update_status) {
|
|
70
68
|
setTimeout(() => {
|
|
@@ -86,7 +84,7 @@ const ItemQuickAction = memo(
|
|
|
86
84
|
<View style={wrapperStyle}>
|
|
87
85
|
<IconComponent
|
|
88
86
|
icon={action?.icon_kit || action?.icon || 'PoweroffOutlined'}
|
|
89
|
-
|
|
87
|
+
isOn={isOn}
|
|
90
88
|
iconSize={iconSize}
|
|
91
89
|
size={iconSize}
|
|
92
90
|
/>
|
|
@@ -28,15 +28,16 @@ const OptionsDropdownActionTemplate = ({
|
|
|
28
28
|
isWidgetOrder,
|
|
29
29
|
}) => {
|
|
30
30
|
const t = useTranslations();
|
|
31
|
-
const { configuration = {}, title = '' } = item;
|
|
32
31
|
const {
|
|
32
|
+
title,
|
|
33
33
|
action_data,
|
|
34
34
|
options = [],
|
|
35
35
|
icon_kit_data,
|
|
36
36
|
icon,
|
|
37
37
|
config,
|
|
38
38
|
allow_config_store_value,
|
|
39
|
-
} = configuration;
|
|
39
|
+
} = item?.configuration || {};
|
|
40
|
+
|
|
40
41
|
// eslint-disable-next-line no-unused-vars
|
|
41
42
|
const [configValues, setConfigValues] = useConfigGlobalState('configValues');
|
|
42
43
|
const checkIcon = /\d/.test(icon); // to do check icon svg and icon antDesign
|
|
@@ -96,7 +97,7 @@ const OptionsDropdownActionTemplate = ({
|
|
|
96
97
|
hideAlertAction,
|
|
97
98
|
]);
|
|
98
99
|
|
|
99
|
-
useUnwatchLGDeviceConfigControl(sensor, [
|
|
100
|
+
useUnwatchLGDeviceConfigControl(sensor, [config]);
|
|
100
101
|
|
|
101
102
|
const iconKit = !!icon_kit_data && icon_kit_data.icon;
|
|
102
103
|
|
|
@@ -117,7 +118,6 @@ const OptionsDropdownActionTemplate = ({
|
|
|
117
118
|
{!checkIcon && (
|
|
118
119
|
<IconComponent
|
|
119
120
|
icon={iconKit || icon}
|
|
120
|
-
isSendingCommand={false}
|
|
121
121
|
iconSize={27}
|
|
122
122
|
size={27}
|
|
123
123
|
style={styles.marginRight}
|
|
@@ -56,8 +56,8 @@ describe('Test OptionsDropdownActionTemplate', () => {
|
|
|
56
56
|
beforeEach(() => {
|
|
57
57
|
watchMultiConfigs.mockClear();
|
|
58
58
|
displayItem = {
|
|
59
|
-
title: 'Fan Speed',
|
|
60
59
|
configuration: {
|
|
60
|
+
title: 'Fan Speed',
|
|
61
61
|
action_data: actionData,
|
|
62
62
|
config: 5,
|
|
63
63
|
action: 'e5d23347-ee31-4fe3-9fb5-bbce05bf4b61',
|
|
@@ -8,14 +8,13 @@ import FImage from '../FImage';
|
|
|
8
8
|
const IconComponent = memo(
|
|
9
9
|
({
|
|
10
10
|
icon,
|
|
11
|
-
|
|
11
|
+
isOn = false,
|
|
12
12
|
size = 30,
|
|
13
13
|
iconSize = 30,
|
|
14
14
|
style,
|
|
15
15
|
antIconStyle,
|
|
16
16
|
color,
|
|
17
17
|
colorInActive,
|
|
18
|
-
active,
|
|
19
18
|
}) => {
|
|
20
19
|
let extraStyle = {
|
|
21
20
|
width: size,
|
|
@@ -49,11 +48,8 @@ const IconComponent = memo(
|
|
|
49
48
|
}, [icon]);
|
|
50
49
|
|
|
51
50
|
const colorIcon = useMemo(() => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
return color || Colors.Green7;
|
|
56
|
-
}, [active, color, colorInActive, isSendingCommand]);
|
|
51
|
+
return isOn ? color || Colors.Green7 : colorInActive || Colors.TextGray;
|
|
52
|
+
}, [color, colorInActive, isOn]);
|
|
57
53
|
|
|
58
54
|
if (!icon) {
|
|
59
55
|
return null;
|
package/src/configs/SCConfig.js
CHANGED
|
@@ -100,6 +100,8 @@ const SCDefaultConfig = {
|
|
|
100
100
|
intervalWatchConfigTime: 30000,
|
|
101
101
|
setCurrentSensorDisplay: () => {},
|
|
102
102
|
appName: 'E-Ra',
|
|
103
|
+
packageName: 'com.eohjsc.eohmobile.staging',
|
|
104
|
+
versionCode: 1
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
export class SCConfig {
|
|
@@ -117,6 +119,8 @@ export class SCConfig {
|
|
|
117
119
|
static intervalWatchConfigTime = SCDefaultConfig.intervalWatchConfigTime;
|
|
118
120
|
static setCurrentSensorDisplay = SCDefaultConfig.setCurrentSensorDisplay;
|
|
119
121
|
static appName = SCDefaultConfig.appName;
|
|
122
|
+
static packageName = SCDefaultConfig.packageName;
|
|
123
|
+
static versionCode = SCDefaultConfig.versionCode;
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
export const initSCConfig = (config) => {
|
|
@@ -143,4 +147,6 @@ export const initSCConfig = (config) => {
|
|
|
143
147
|
SCConfig.setCurrentSensorDisplay =
|
|
144
148
|
config.setCurrentSensorDisplay ?? SCDefaultConfig.setCurrentSensorDisplay;
|
|
145
149
|
SCConfig.appName = config.appName ?? SCDefaultConfig.appName;
|
|
150
|
+
SCConfig.packageName = config.packageName ?? SCConfig.packageName,
|
|
151
|
+
SCConfig.versionCode = config.version ?? SCConfig.versionCode
|
|
146
152
|
};
|
package/src/utils/Apis/axios.js
CHANGED