[지라이슈없음] network status check (develop progress)
This commit is contained in:
@@ -133,9 +133,14 @@ function AppBase(props) {
|
||||
const oldDb8Deleted = useSelector(
|
||||
(state) => state.localSettings.oldDb8Deleted
|
||||
);
|
||||
const isInternetConnected = useSelector(
|
||||
(state) => state.common.appStatus.isInternetConnected
|
||||
);
|
||||
|
||||
const deviceCountryCode = httpHeader?.["X-Device-Country"] || "";
|
||||
|
||||
useEffect(() => {});
|
||||
|
||||
useEffect(() => {
|
||||
if (!cursorVisible && !Spotlight.getCurrent()) {
|
||||
Spotlight.focus();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Job } from "@enact/core/util";
|
||||
import Spotlight from "@enact/spotlight";
|
||||
|
||||
import appinfo from "../../webos-meta/appinfo.json";
|
||||
@@ -555,3 +556,44 @@ export const checkFirstLaunch = () => (dispatch) => {
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
let updateNetworkStateJob = new Job((dispatch, connected) => {
|
||||
dispatch(changeAppStatus({ isInternetConnected: connected }));
|
||||
});
|
||||
|
||||
export const getConnectionStatus = () => (dispatch, getState) => {
|
||||
lunaSend.getConnectionStatus({
|
||||
onSuccess: (res) => {
|
||||
console.log("lunasend getConnectionStatus", res);
|
||||
if (res.returnValue) {
|
||||
const isInternet =
|
||||
(res.wifi && res.wifi.onInternet === "yes") ||
|
||||
(res.wired && res.wired.onInternet === "yes");
|
||||
const isInternetConnected =
|
||||
(res.wifi && res.wifi.state === "connected") ||
|
||||
(res.wired && res.wired.state === "connected");
|
||||
|
||||
console.log(
|
||||
"internetconnected.............",
|
||||
isInternet,
|
||||
isInternetConnected,
|
||||
res
|
||||
);
|
||||
|
||||
const connected = isInternet && isInternetConnected;
|
||||
|
||||
updateNetworkStateJob.startAfter(
|
||||
connected ? 100 : 3000,
|
||||
dispatch,
|
||||
connected
|
||||
);
|
||||
}
|
||||
},
|
||||
onFailure: (err) => {
|
||||
console.log(err);
|
||||
},
|
||||
onComplete: (res) => {
|
||||
console.log("getConnectionStatus done", res);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ const initialState = {
|
||||
toast: false,
|
||||
toastText: null,
|
||||
captionEnable: false,
|
||||
isInternetConnected: true,
|
||||
},
|
||||
broadcast: {},
|
||||
httpHeader: null,
|
||||
|
||||
Reference in New Issue
Block a user