This commit is contained in:
yonghyon
2024-03-08 09:39:24 +09:00
parent b089b218e3
commit 2a3f5b4b85
6 changed files with 41 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ import ThemeDecorator from "@enact/sandstone/ThemeDecorator";
import appinfo from "../../webos-meta/appinfo.json";
import {
changeAppStatus,
getDeviceId,
getHttpHeaderForServiceRequest,
} from "../actions/commonActions";
import { getAuthenticationCode } from "../actions/deviceActions";
@@ -135,13 +136,13 @@ function AppBase(props) {
window.lunaTest = (service, method, subscribe, parameters) =>
lunaTest(service, method, subscribe, parameters);
}
dispatch(getDeviceId());
dispatch(getHttpHeaderForServiceRequest());
//todo subscribe
// dispatch(getSystemSettings());
// //get captionEnable
// dispatch(getSystemSettings2());
// dispatch(getSystemInfo());
// dispatch(getDeviceId());
document.addEventListener("visibilitychange", visibilityChanged);
document.addEventListener("webOSRelaunch", handleRelaunchEvent);
return () => {

View File

@@ -79,7 +79,6 @@ export const getHttpHeaderForServiceRequest =
convertedRes["app_id"] = appinfo.id;
//todo temp
convertedRes["app_ver"] = "1.0.0"; //appinfo.version;
convertedRes["dvc_id"] = res["X-Device-Model"];
convertedRes["cntry_cd"] = res["X-Device-Country"];
convertedRes["prod_cd"] = res["X-Device-Product"];
convertedRes["plat_cd"] = res["X-Device-Platform"];
@@ -133,3 +132,21 @@ export const logoutAccount = () => (dispatch, getState) => {
},
});
};
export const getDeviceId = (onComplete) => (dispatch, getState) => {
lunaSend.getDeviceId({"idType": ["LGUDID"]}, {
onSuccess: (res) => {
console.log("getDeviceId ",res);
if(res.returnValue){
const deviceId = res.idList[0].idValue;
dispatch(changeAppStatus({deviceId: deviceId}));
}
},
onFailure: (err) => {
console.log(err);
},
onComplete: () => {
console.log('getDeviceId done');
if (onComplete) onComplete();
}
});
};

View File

@@ -105,11 +105,13 @@ export const TAxios = (
const executeRequest = (accessToken, getState) => {
const httpHeader = getState().common.httpHeader;
const {mbr_no, deviceId} = getState().common.appStatus;
const AUTHORIZATION = { headers: {...httpHeader} };
if (accessToken) {
AUTHORIZATION.headers["lgsp_auth"] = accessToken;
}
AUTHORIZATION.headers["dvc_id"] = deviceId;
if (typeof window === "object") {
let url = Array.isArray(baseUrl) ? getUrl(getState, baseUrl[0]) : getUrl(getState, baseUrl);

View File

@@ -1,4 +1,5 @@
import LS2Request from "./LS2Request";
import * as Config from '../utils/Config';
export const getConnectionStatus = ({ onSuccess, onFailure, onComplete }) => {
if (process.env.REACT_APP_MODE === "DEBUG") {
@@ -87,3 +88,19 @@ export const getHttpHeaderForServiceRequest = ({
});
}
};
export const getDeviceId = (parameters, {onSuccess, onFailure, onComplete}) => {
if (typeof window === 'object' && window.PalmSystem) {
return new LS2Request().send({
service: 'luna://com.webos.service.sm',
method: 'deviceid/getIDs',
subscribe: false,
parameters: parameters,
onSuccess,
onFailure,
onComplete
});
}else{
onSuccess({returnValue: true, idList: [{idValue: Config.DEBUG_WINDOW_DEVICEID, idtype:"LGUDID"}]});
onComplete();
}
};

View File

@@ -7,6 +7,7 @@ const initialState = {
webOSVersion: "", //"5.0", "9.0" ...
serverHOST: "", //"US.nextlgsdp.com",
mbr_no: "", //X-User-Number : "US2401051532595"
deviceId: "", //d87cedca-84e7-c05e-613d-39739bb7941f
cursorVisible: false,
loginUserData: {},
toast: false,

View File

@@ -7,6 +7,7 @@ export const SFT_TEST = "5555";
export const SFT_TEST2 = "6666";
export const DEFAULT_SERVERTYPE = "qt2"; //system, qt2, qt, prd
export const DEFAULT_RIC_CODE = "aic"; //system, aic, eic, ruc
export const DEBUG_WINDOW_DEVICEID = 'testdevice';
export const panel_names = {
INTRO_PANEL: "intropanel",
HOME_PANEL: "homepanel",