@eohjsc/react-native-smart-city 0.4.94 → 0.4.95
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/README.md
CHANGED
package/package.json
CHANGED
|
@@ -18,14 +18,14 @@ import { SCProvider } from '../../../context';
|
|
|
18
18
|
import { mockSCStore } from '../../../context/mockStore';
|
|
19
19
|
import Routes from '../../../utils/Route';
|
|
20
20
|
import api from '../../../utils/Apis/axios';
|
|
21
|
-
import {
|
|
21
|
+
import { useWatchConfigs } from '../../../hooks/IoT';
|
|
22
22
|
|
|
23
23
|
const mock = new MockAdapter(api.axiosInstance);
|
|
24
24
|
|
|
25
|
-
jest.mock('../../../
|
|
25
|
+
jest.mock('../../../hooks/IoT', () => {
|
|
26
26
|
return {
|
|
27
|
-
...jest.requireActual('../../../
|
|
28
|
-
|
|
27
|
+
...jest.requireActual('../../../hooks/IoT'),
|
|
28
|
+
useWatchConfigs: jest.fn(),
|
|
29
29
|
};
|
|
30
30
|
});
|
|
31
31
|
|
|
@@ -195,7 +195,7 @@ describe('test DeviceDetail', () => {
|
|
|
195
195
|
useLayoutEffectSpy.mockImplementation(() => setState);
|
|
196
196
|
mock.reset();
|
|
197
197
|
mockedNavigate.mockClear();
|
|
198
|
-
|
|
198
|
+
useWatchConfigs.mockReset();
|
|
199
199
|
});
|
|
200
200
|
|
|
201
201
|
it('render DeviceDetail render SensorDisplayItem', async () => {
|
|
@@ -810,7 +810,7 @@ describe('test DeviceDetail', () => {
|
|
|
810
810
|
el.props.accessibilityLabel === AccessibilityLabel.SENSOR_DISPLAY_ITEM
|
|
811
811
|
);
|
|
812
812
|
expect(sensorDisplayItem.length).toEqual(1);
|
|
813
|
-
expect(
|
|
813
|
+
expect(useWatchConfigs).toHaveBeenCalledWith([]);
|
|
814
814
|
});
|
|
815
815
|
|
|
816
816
|
it('watch action config', async () => {
|
|
@@ -838,7 +838,7 @@ describe('test DeviceDetail', () => {
|
|
|
838
838
|
tree = await create(wrapComponent(store, account, route));
|
|
839
839
|
});
|
|
840
840
|
|
|
841
|
-
expect(
|
|
841
|
+
expect(useWatchConfigs).toHaveBeenCalledWith([]);
|
|
842
842
|
});
|
|
843
843
|
|
|
844
844
|
it('watch stages grid action config', async () => {
|
|
@@ -869,6 +869,6 @@ describe('test DeviceDetail', () => {
|
|
|
869
869
|
tree = await create(wrapComponent(store, account, route));
|
|
870
870
|
});
|
|
871
871
|
|
|
872
|
-
expect(
|
|
872
|
+
expect(useWatchConfigs).toHaveBeenCalledWith([]);
|
|
873
873
|
});
|
|
874
874
|
});
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
useBluetoothDeviceConnected,
|
|
33
33
|
useHomeAssistantDeviceConnected,
|
|
34
34
|
useEoHBackendDeviceConnected,
|
|
35
|
+
useWatchConfigs,
|
|
35
36
|
} from '../../hooks/IoT';
|
|
36
37
|
import { useDisconnectedDevice } from './hooks/useDisconnectedDevice';
|
|
37
38
|
import { useDeviceWatchConfigControl } from './hooks/useDeviceWatchConfigControl';
|
|
@@ -59,7 +60,6 @@ import { useReceiveNotifications } from '../../hooks';
|
|
|
59
60
|
import useChipJsonConfiguration, {
|
|
60
61
|
useConnectChipMqtt,
|
|
61
62
|
} from '../../hooks/useMqtt';
|
|
62
|
-
import { watchMultiConfigs } from '../../iot/Monitor';
|
|
63
63
|
|
|
64
64
|
const DeviceDetail = ({ route }) => {
|
|
65
65
|
const configIdsTemp = useRef([]);
|
|
@@ -67,9 +67,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
67
67
|
const t = useTranslations();
|
|
68
68
|
const navigation = useNavigation();
|
|
69
69
|
const token = useSCContextSelector((state) => state.auth.account.token);
|
|
70
|
-
const { isLockWhenPickColor
|
|
71
|
-
(state) => state.app
|
|
72
|
-
);
|
|
70
|
+
const { isLockWhenPickColor } = useSCContextSelector((state) => state.app);
|
|
73
71
|
|
|
74
72
|
const { setAction } = useContext(SCContext);
|
|
75
73
|
const [offsetTitle, setOffsetTitle] = useState(1);
|
|
@@ -612,6 +610,8 @@ const DeviceDetail = ({ route }) => {
|
|
|
612
610
|
}, [display.items, isNetworkConnected, sensor, mqttConfigs])
|
|
613
611
|
);
|
|
614
612
|
|
|
613
|
+
useWatchConfigs(configIdsTemp.current);
|
|
614
|
+
|
|
615
615
|
const isShowEmergencyResolve =
|
|
616
616
|
display.items.filter(
|
|
617
617
|
(item) =>
|
|
@@ -719,10 +719,6 @@ const DeviceDetail = ({ route }) => {
|
|
|
719
719
|
SCConfig.setCurrentSensorDisplay(sensor);
|
|
720
720
|
}, [sensor]);
|
|
721
721
|
|
|
722
|
-
useEffect(() => {
|
|
723
|
-
appState === 'active' && watchMultiConfigs(configIdsTemp.current);
|
|
724
|
-
}, [appState]);
|
|
725
|
-
|
|
726
722
|
const shouldRender =
|
|
727
723
|
loading.displayTemplate === false &&
|
|
728
724
|
loading.isConnected === false &&
|