@eohjsc/react-native-smart-city 0.3.18 → 0.3.21

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.18",
4
+ "version": "0.3.21",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -55,7 +55,6 @@ const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
55
55
  );
56
56
 
57
57
  const triggerAction = useCallback(async () => {
58
- setTempIsOn((prev) => !prev);
59
58
  switch (sensor?.device_type) {
60
59
  case DEVICE_TYPE.ZIGBEE:
61
60
  if (action_on_data && action_off_data) {
@@ -75,11 +74,10 @@ const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
75
74
  }
76
75
  break;
77
76
  case DEVICE_TYPE.LG_THINQ:
77
+ setTempIsOn((prev) => !prev);
78
78
  if (action_data) {
79
79
  await doAction(action_data, JSON.stringify({ value: !isOn }));
80
80
  }
81
-
82
- updateStatusFromPusher();
83
81
  break;
84
82
  default:
85
83
  if (action_data) {
@@ -98,6 +96,7 @@ const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
98
96
  }
99
97
  break;
100
98
  }
99
+ updateStatusFromPusher();
101
100
  if (sensor?.is_managed_by_backend) {
102
101
  configuration?.config &&
103
102
  sensor?.device_type !== 'GOOGLE_HOME' &&
@@ -130,7 +129,13 @@ const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
130
129
  if (sensor?.is_managed_by_backend && sensor.device_type !== 'GOOGLE_HOME') {
131
130
  watchMultiConfigs([configuration.config]);
132
131
  }
133
- }, [sensor, configuration.config]);
132
+ }, [sensor, configuration.config, getIsOnValue]);
133
+
134
+ useEffect(() => {
135
+ if (sensor?.device_type !== DEVICE_TYPE.LG_THINQ) {
136
+ setTempIsOn(getIsOnValue());
137
+ }
138
+ }, [getIsOnValue, sensor?.device_type]);
134
139
 
135
140
  const Component = useMemo(() => {
136
141
  return getComponent(actionGroup.template);
@@ -64,7 +64,7 @@ const AddCommonSelectSubUnit = ({ route }) => {
64
64
  const fetchDetails = useCallback(async () => {
65
65
  const { success, data } = await axiosGet(
66
66
  API.UNIT.UNIT_DETAIL(unit_id),
67
- { headers: { 'Cache-Control': 'no-cache' } },
67
+ {},
68
68
  true
69
69
  );
70
70
  if (success) {
@@ -13,7 +13,7 @@ const useConnectDevices = (new_sensor, station_id, unit_id) => {
13
13
  const fetchDetails = useCallback(async () => {
14
14
  const { success: fetchSuccess, data: unit } = await axiosGet(
15
15
  API.UNIT.UNIT_DETAIL(unit_id),
16
- { headers: { 'Cache-Control': 'no-cache' } },
16
+ {},
17
17
  true
18
18
  );
19
19
  const station = unit.stations.find((item) => item.id === station_id);
@@ -27,7 +27,7 @@ const AddNewDevice = memo(({ route }) => {
27
27
  const fetchDetails = useCallback(async () => {
28
28
  const { success, data } = await axiosGet(
29
29
  API.UNIT.UNIT_DETAIL(unit_id),
30
- { headers: { 'Cache-Control': 'no-cache' } },
30
+ {},
31
31
  true
32
32
  );
33
33
  if (success) {
@@ -9,7 +9,7 @@ const useConnectGateway = (unit_id) => {
9
9
  const fetchDetails = useCallback(async () => {
10
10
  const { success: fetchSuccess, data: unit } = await axiosGet(
11
11
  API.UNIT.UNIT_DETAIL(unit_id),
12
- { headers: { 'Cache-Control': 'no-cache' } },
12
+ {},
13
13
  true
14
14
  );
15
15
  return { fetchSuccess, unit };
@@ -11,7 +11,7 @@ export default (unit) => {
11
11
  setIsLoading(true);
12
12
  const { success, data } = await axiosGet(
13
13
  API.UNIT.UNIT_DETAIL(unit?.id),
14
- { headers: { 'Cache-Control': 'no-cache' } },
14
+ {},
15
15
  true
16
16
  );
17
17
  if (success) {
@@ -24,7 +24,7 @@ const AddLGDevice = memo(({ route }) => {
24
24
  const fetchDetails = useCallback(async () => {
25
25
  const { success, data } = await axiosGet(
26
26
  API.UNIT.UNIT_DETAIL(unit_id),
27
- { headers: { 'Cache-Control': 'no-cache' } },
27
+ {},
28
28
  true
29
29
  );
30
30
  if (success) {
@@ -93,7 +93,7 @@ const UnitSummary = memo(({ route }) => {
93
93
  const fetchUnitDetail = useCallback(async () => {
94
94
  const { success, data } = await axiosGet(
95
95
  API.UNIT.UNIT_DETAIL(unit?.id),
96
- { headers: { 'Cache-Control': 'no-cache' } },
96
+ {},
97
97
  true
98
98
  );
99
99
  if (success) {