TV MAC ADRESS 요청 루나 API 함수 추가 2차
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
changeAppStatus,
|
||||
checkFirstLaunch,
|
||||
deleteOldDb8Datas,
|
||||
getConnectionInfo,
|
||||
getConnectionStatus,
|
||||
getDeviceId,
|
||||
getHttpHeaderForServiceRequest,
|
||||
@@ -21,7 +22,6 @@ import {
|
||||
setGNBMenu,
|
||||
setSecondLayerInfo,
|
||||
} from "../actions/commonActions";
|
||||
import { getConnectionInfo } from "../actions/deviceActions";
|
||||
import { getShoptimeTerms } from "../actions/empActions";
|
||||
import { getHomeMenu, getHomeTerms } from "../actions/homeActions";
|
||||
import {
|
||||
@@ -124,7 +124,7 @@ function AppBase(props) {
|
||||
const oldDb8Deleted = useSelector(
|
||||
(state) => state.localSettings.oldDb8Deleted
|
||||
);
|
||||
const macAddress = useSelector((state) => state.device);
|
||||
const macAddress = useSelector((state) => state.common.macAddress);
|
||||
|
||||
const deviceCountryCode = httpHeader?.["X-Device-Country"] || "";
|
||||
|
||||
@@ -134,13 +134,13 @@ function AppBase(props) {
|
||||
}
|
||||
}, [cursorVisible]);
|
||||
|
||||
// useEffect(() => {
|
||||
// if (logEnable) {
|
||||
// enableConsole();
|
||||
// } else {
|
||||
// disableConsole();
|
||||
// }
|
||||
// }, [logEnable]);
|
||||
useEffect(() => {
|
||||
if (logEnable) {
|
||||
enableConsole();
|
||||
} else {
|
||||
disableConsole();
|
||||
}
|
||||
}, [logEnable]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!oldDb8Deleted) {
|
||||
@@ -263,13 +263,10 @@ function AppBase(props) {
|
||||
}
|
||||
|
||||
dispatch(getConnectionStatus());
|
||||
dispatch(getConnectionInfo());
|
||||
dispatch(getDeviceId());
|
||||
dispatch(getHttpHeaderForServiceRequest());
|
||||
dispatch(getSystemSettings());
|
||||
|
||||
if (window.webOSSystem) {
|
||||
dispatch(getConnectionInfo());
|
||||
}
|
||||
document.addEventListener("visibilitychange", visibilityChanged);
|
||||
document.addEventListener("webOSRelaunch", handleRelaunchEvent);
|
||||
//local virtual cursorvisiblilty
|
||||
@@ -287,7 +284,7 @@ function AppBase(props) {
|
||||
document.removeEventListener("wheel", mouseMoveEvent);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
}, [dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
let userDataChanged = false;
|
||||
|
||||
@@ -10,7 +10,6 @@ export const types = {
|
||||
REGISTER_DEVICE: "REGISTER_DEVICE",
|
||||
REGISTER_DEVICE_INFO: "REGISTER_DEVICE_INFO",
|
||||
GET_DEVICE_INFO: "GET_DEVICE_INFO",
|
||||
GET_DEVICE_MACADDRESS: "GET_DEVICE_ADDRESS",
|
||||
CLEAR_REGISTER_DEVICE_INFO: "CLEAR_REGISTER_DEVICE_INFO",
|
||||
|
||||
// common actions
|
||||
@@ -34,6 +33,7 @@ export const types = {
|
||||
SET_SECOND_LAYER_INFO: "SET_SECOND_LAYER_INFO",
|
||||
SET_ERROR_MESSAGE: "SET_ERROR_MESSAGE",
|
||||
CLEAR_ERROR_MESSAGE: "CLEAR_ERROR_MESSAGE",
|
||||
GET_DEVICE_MACADDRESS: "GET_DEVICE_MACADDRESS",
|
||||
|
||||
// billing actions
|
||||
GET_MY_INFO_BILLING_SEARCH: "GET_MY_INFO_BILLING_SEARCH",
|
||||
|
||||
@@ -596,6 +596,29 @@ export const getConnectionStatus = () => (dispatch, getState) => {
|
||||
});
|
||||
};
|
||||
|
||||
// macAddress
|
||||
export const getConnectionInfo = () => (dispatch, getState) => {
|
||||
lunaSend.getConnectionInfo({
|
||||
onSuccess: (res) => {
|
||||
console.log("lunasend getConnectionStatus", res);
|
||||
if (res && res.retrunValue) {
|
||||
const macAddress = res?.wiredInfo.macAddress;
|
||||
console.log("macAddress...........", macAddress, res);
|
||||
}
|
||||
},
|
||||
onFailure: (err) => {
|
||||
console.log("getConnentionInfo", err);
|
||||
},
|
||||
onComplete: (res) => {
|
||||
console.log("getConnentionInfo done", res);
|
||||
dispatch({
|
||||
type: types.GET_DEVICE_MACADDRESS,
|
||||
payload: res,
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const disableNotification = () => (dispatch, getState) => {
|
||||
lunaSend.disableNotification({
|
||||
onSuccess: (res) => {
|
||||
|
||||
@@ -153,25 +153,6 @@ export const getReAuthenticationCode = () => (dispatch, getState) => {
|
||||
);
|
||||
};
|
||||
|
||||
// macAddress
|
||||
export const getConnectionInfo = () => (dispatch, getState) => {
|
||||
lunaSend.getConnectionInfo({
|
||||
onSuccess: (res) => {
|
||||
if (res && res.retrunValue) {
|
||||
console.log("getConnentionInfo", res);
|
||||
const macAddress = res?.wiredInfo.macAddress;
|
||||
dispatch({
|
||||
type: types.GET_DEVICE_MACADDRESS,
|
||||
payload: macAddress,
|
||||
});
|
||||
}
|
||||
},
|
||||
onFailure: (err) => {
|
||||
console.log("getConnentionInfo", err);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const clearRegisterDeviceInfo = () => ({
|
||||
type: types.CLEAR_REGISTER_DEVICE_INFO,
|
||||
});
|
||||
|
||||
@@ -422,9 +422,9 @@ export const enableNotification = ({ onSuccess, onFailure, onComplete }) => {
|
||||
};
|
||||
|
||||
export const getConnectionInfo = ({ onSuccess, onFailure, onComplete }) => {
|
||||
if (process.env.REACT_APP_MODE === "DEBUG") {
|
||||
console.log("LUNA SEND getConnectionInfo");
|
||||
return "Some Hard Coded Mock Data";
|
||||
if (typeof window === "object" && !window.PalmSystem) {
|
||||
console.log("LUNA SEND disableConnectionInfo");
|
||||
return;
|
||||
} else {
|
||||
return new LS2Request().send({
|
||||
service: "luna://com.webos.service.connectionmanager",
|
||||
|
||||
@@ -69,6 +69,7 @@ const initialState = {
|
||||
},
|
||||
|
||||
secondLayerInfo: {},
|
||||
macAddress: { wifi: "", wired: "", p2p: "" },
|
||||
};
|
||||
|
||||
export const commonReducer = (state = initialState, action) => {
|
||||
@@ -259,6 +260,16 @@ export const commonReducer = (state = initialState, action) => {
|
||||
secondLayerInfo: action.payload,
|
||||
};
|
||||
}
|
||||
case types.GET_DEVICE_MACADDRESS: {
|
||||
return {
|
||||
...state,
|
||||
macAddress: {
|
||||
wifi: action.payload.wifiInfo.macAddress,
|
||||
wired: action.payload.wiredInfo.macAddress,
|
||||
p2p: action.payload.p2pInfo.macAddress,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { types } from "../actions/actionTypes";
|
||||
|
||||
const initialState = {
|
||||
macAddress: { wifi: "", wired: "", p2p: "" },
|
||||
regDeviceData: {},
|
||||
regDeviceInfoData: {},
|
||||
};
|
||||
@@ -23,11 +22,6 @@ export const deviceReducer = (state = initialState, action) => {
|
||||
...state,
|
||||
deviceInfo: action.payload.data.dvcInfo,
|
||||
};
|
||||
case types.GET_DEVICE_MACADDRESS:
|
||||
return {
|
||||
...state,
|
||||
macAddress: action,
|
||||
};
|
||||
case types.CLEAR_REGISTER_DEVICE_INFO:
|
||||
return {
|
||||
...state,
|
||||
|
||||
Reference in New Issue
Block a user