deviceId
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user