[251124] fix: App.js 로그 정리 및 최적화-2

🕐 커밋 시간: 2025. 11. 24. 09:24:08

📊 변경 통계:
  • 총 파일: 5개
  • 추가: +156줄
  • 삭제: -111줄

📝 수정된 파일:
  ~ com.twin.app.shoptime/src/actions/empActions.js
  ~ com.twin.app.shoptime/src/hooks/useFocusHistory/useFocusHistory.js
  ~ com.twin.app.shoptime/src/lunaSend/common.js
  ~ com.twin.app.shoptime/src/views/CheckOutPanel/CheckOutPanel.jsx
  ~ com.twin.app.shoptime/src/views/HomePanel/HomePanel.jsx

🔧 함수 변경 내용:
  📄 com.twin.app.shoptime/src/hooks/useFocusHistory/useFocusHistory.js (javascript):
     Added: dwarn(), derror()
    🔄 Modified: getOrCreateGlobalBuffer()
  📄 com.twin.app.shoptime/src/lunaSend/common.js (javascript):
     Added: dwarn(), derror()
  📄 com.twin.app.shoptime/src/views/HomePanel/HomePanel.jsx (javascript):
     Added: dwarn(), derror()

🔧 주요 변경 내용:
  • 핵심 비즈니스 로직 개선
This commit is contained in:
2025-11-24 09:24:08 +09:00
parent 6d0cf78534
commit e2a50b62ab
5 changed files with 479 additions and 360 deletions

View File

@@ -1,11 +1,26 @@
import appinfo from "../../webos-meta/appinfo.json";
import { alertToast } from "../actions/commonActions";
import { store } from "../store/store";
import LS2Request from "./LS2Request";
import appinfo from '../../webos-meta/appinfo.json';
import { alertToast } from '../actions/commonActions';
import { store } from '../store/store';
import LS2Request from './LS2Request';
// Toggle debug logging for this module (false by default)
const DEBUG_MODE = false;
const dlog = (...args) => {
if (DEBUG_MODE) console.log(...args);
};
const dwarn = (...args) => {
if (DEBUG_MODE) console.warn(...args);
};
const derror = (...args) => {
console.error(...args);
};
export const getConnectionStatus = ({ onSuccess, onFailure, onComplete }) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND getConnectionStatus");
if (typeof window === 'object' && !window.PalmSystem) {
dlog('LUNA SEND getConnectionStatus');
//test
// setTimeout(() => {
@@ -24,11 +39,11 @@ export const getConnectionStatus = ({ onSuccess, onFailure, onComplete }) => {
// }, 20000);
// }, 10000);
return "Some Hard Coded Mock Data";
return 'Some Hard Coded Mock Data';
} else {
return new LS2Request().send({
service: "luna://com.webos.service.connectionmanager",
method: "getStatus",
service: 'luna://com.webos.service.connectionmanager',
method: 'getStatus',
subscribe: true,
parameters: {},
onSuccess,
@@ -39,59 +54,51 @@ export const getConnectionStatus = ({ onSuccess, onFailure, onComplete }) => {
};
export const createToast = (message) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND createToast message", message);
if (typeof window === 'object' && !window.PalmSystem) {
dlog('LUNA SEND createToast message', message);
return;
}
return new LS2Request().send({
service: "luna://com.webos.notification",
method: "createToast",
service: 'luna://com.webos.notification',
method: 'createToast',
parameters: {
message: message,
iconUrl: "",
iconUrl: '',
noaction: true,
},
onSuccess: (res) => {
console.log("LUNA SEND createToast success", message);
dlog('LUNA SEND createToast success', message);
},
onFailure: (err) => {
console.log("LUNA SEND createToast failed", err);
derror('LUNA SEND createToast failed', err);
},
});
};
let httpHeaderHandler = null;
export const getHttpHeaderForServiceRequest = ({
onSuccess,
onFailure,
onComplete,
}) => {
if (
typeof window === "object" &&
window.PalmSystem &&
process.env.REACT_APP_MODE !== "DEBUG"
) {
export const getHttpHeaderForServiceRequest = ({ onSuccess, onFailure, onComplete }) => {
if (typeof window === 'object' && window.PalmSystem && process.env.REACT_APP_MODE !== 'DEBUG') {
if (httpHeaderHandler) {
httpHeaderHandler.cancel();
}
httpHeaderHandler = new LS2Request().send({
service: "luna://com.webos.service.sdx",
method: "getHttpHeaderForServiceRequest",
service: 'luna://com.webos.service.sdx',
method: 'getHttpHeaderForServiceRequest',
subscribe: true,
parameters: {},
onSuccess: (res) => {
try {
console.log("[serverHost][LS2] onSuccess HOST:", res && res.HOST);
console.log("[serverHost][LS2] onSuccess raw:", res);
dlog('[serverHost][LS2] onSuccess HOST:', res && res.HOST);
dlog('[serverHost][LS2] onSuccess raw:', res);
} catch (e) {}
onSuccess && onSuccess(res);
},
onFailure: (err) => {
console.log("[serverHost][LS2] onFailure:", err);
derror('[serverHost][LS2] onFailure:', err);
onFailure && onFailure(err);
},
onComplete: (res) => {
console.log("[serverHost][LS2] onComplete:", res);
dlog('[serverHost][LS2] onComplete:', res);
onComplete && onComplete(res);
},
});
@@ -99,64 +106,56 @@ export const getHttpHeaderForServiceRequest = ({
} else {
const serverType = store.getState().localSettings.serverType;
const userNumber =
serverType === "prd" ? "US2412306099093" : "US2210240095608";
const userNumber = serverType === 'prd' ? 'US2412306099093' : 'US2210240095608';
const mockRes = {
HOST: "qt2-US.nextlgsdp.com",
"X-User-Number": userNumber,
HOST: 'qt2-US.nextlgsdp.com',
'X-User-Number': userNumber,
Authorization:
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJuZXh0bGdzZHAuY29tIiwiYXVkIjoibmV4dGxnc2RwLmNvbSIsImlhdCI6MTcwNzc4NTUyNSwiZXhwIjoxNzA3NzkyNzI1LCJtYWNBZGRyZXNzIjoiZWVkMDQ2NjdiNjUzOWU3YmQxMDA1OTljYjBkYTI5ZjRjZTgyZGZlOGZkNzIzMDAxZGVmMjg4NWRkNWZiODRmNWNiMzZlM2QwNzYzNWZjZGJjYWNjNGVjMzI5NWIwNjZjOTMwNmNmNDI1ZGQzMmQ2MDMxMjc1NWNkOTIyNjEwMzcifQ.vqPdYGnN46diesDBLzA4UhACCJVdIycLs7wZu9M55Hc",
"X-Authentication": "MkOLvUocrJ69RH/iV1ZABJhjR2g=",
"X-Device-ID":
"OemUY5qbPITZv96QKlxrtcqT6ypeX6us2qANLng3/0QCUhv2mecK1UDTMYb/hjpjey9dC/kFycc/5R8u+oK56JIWyYC4V278z64YDPKbDXIsd+eECvyf+Rdm8BneIUPM",
"X-Device-Product": "webOSTV 6.0",
"X-Device-Platform": "W21A",
"X-Device-Model": "HE_DTV_W20P_AFADATAA",
"X-Device-Eco-Info": "1",
"X-Device-Country": "US",
"X-Device-Language": "en-US",
"X-Device-Netcast-Platform-Version": "6.4.0",
"X-Device-Publish-Flag": "N",
"X-Device-Fck": "253",
"X-Device-SDK-VERSION": "1.0.0",
"X-Device-Eula":
"additionalDataAllowed,takeOnAllowed,networkAllowed,generalTermsAllowed,chpAllowed,customAdAllowed,acrOnAllowed,voice2Allowed,voiceAllowed,acrAdAllowed",
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJuZXh0bGdzZHAuY29tIiwiYXVkIjoibmV4dGxnc2RwLmNvbSIsImlhdCI6MTcwNzc4NTUyNSwiZXhwIjoxNzA3NzkyNzI1LCJtYWNBZGRyZXNzIjoiZWVkMDQ2NjdiNjUzOWU3YmQxMDA1OTljYjBkYTI5ZjRjZTgyZGZlOGZkNzIzMDAxZGVmMjg4NWRkNWZiODRmNWNiMzZlM2QwNzYzNWZjZGJjYWNjNGVjMzI5NWIwNjZjOTMwNmNmNDI1ZGQzMmQ2MDMxMjc1NWNkOTIyNjEwMzcifQ.vqPdYGnN46diesDBLzA4UhACCJVdIycLs7wZu9M55Hc',
'X-Authentication': 'MkOLvUocrJ69RH/iV1ZABJhjR2g=',
'X-Device-ID':
'OemUY5qbPITZv96QKlxrtcqT6ypeX6us2qANLng3/0QCUhv2mecK1UDTMYb/hjpjey9dC/kFycc/5R8u+oK56JIWyYC4V278z64YDPKbDXIsd+eECvyf+Rdm8BneIUPM',
'X-Device-Product': 'webOSTV 6.0',
'X-Device-Platform': 'W21A',
'X-Device-Model': 'HE_DTV_W20P_AFADATAA',
'X-Device-Eco-Info': '1',
'X-Device-Country': 'US',
'X-Device-Language': 'en-US',
'X-Device-Netcast-Platform-Version': '6.4.0',
'X-Device-Publish-Flag': 'N',
'X-Device-Fck': '253',
'X-Device-SDK-VERSION': '1.0.0',
'X-Device-Eula':
'additionalDataAllowed,takeOnAllowed,networkAllowed,generalTermsAllowed,chpAllowed,customAdAllowed,acrOnAllowed,voice2Allowed,voiceAllowed,acrAdAllowed',
};
try {
console.log("[serverHost][LS2][MOCK] onSuccess HOST:", mockRes.HOST);
console.log("[serverHost][LS2][MOCK] onSuccess raw:", mockRes);
dlog('[serverHost][LS2][MOCK] onSuccess HOST:', mockRes.HOST);
dlog('[serverHost][LS2][MOCK] onSuccess raw:', mockRes);
} catch (e) {}
onSuccess(mockRes);
}
};
export const getSystemSettings = (
parameters,
{ onSuccess, onFailure, onComplete }
) => {
if (
typeof window === "object" &&
window.PalmSystem &&
process.env.REACT_APP_MODE !== "DEBUG"
) {
export const getSystemSettings = (parameters, { onSuccess, onFailure, onComplete }) => {
if (typeof window === 'object' && window.PalmSystem && process.env.REACT_APP_MODE !== 'DEBUG') {
return new LS2Request().send({
service: "luna://com.webos.settingsservice",
method: "getSystemSettings",
service: 'luna://com.webos.settingsservice',
method: 'getSystemSettings',
subscribe: true,
parameters: parameters,
onSuccess,
onFailure,
onComplete,
});
} else if (typeof window === "object") {
} else if (typeof window === 'object') {
const language =
typeof window.navigator === "object"
typeof window.navigator === 'object'
? window.navigator.language || window.navigator.userLanguage
: "en-US";
: 'en-US';
const res = {
settings: {
smartServiceCountryCode2: language.split("-")[1],
smartServiceCountryCode2: language.split('-')[1],
captionEnable: true,
},
returnValue: true,
@@ -167,17 +166,17 @@ export const getSystemSettings = (
};
export function checkValidCountry(ricCode, country) {
if (ricCode === "aic") {
if (country === "US") return true;
if (ricCode === 'aic') {
if (country === 'US') return true;
else return false;
} else if (ricCode === "eic") {
if (country === "GB" || country === "DE") return true;
} else if (ricCode === 'eic') {
if (country === 'GB' || country === 'DE') return true;
else return false;
} else if (ricCode === "ruc") {
if (country === "RU") return true;
} else if (ricCode === 'ruc') {
if (country === 'RU') return true;
else return false;
} else {
if (country === "US") {
if (country === 'US') {
return true;
} else {
return false;
@@ -186,20 +185,12 @@ export function checkValidCountry(ricCode, country) {
}
// 3.0 ~ 4.5
export const setSubtitleEnable = (
mediaId,
captionEnable,
{ onSuccess, onFailure, onComplete }
) => {
if (
typeof window === "object" &&
window.PalmSystem &&
process.env.REACT_APP_MODE !== "DEBUG"
) {
export const setSubtitleEnable = (mediaId, captionEnable, { onSuccess, onFailure, onComplete }) => {
if (typeof window === 'object' && window.PalmSystem && process.env.REACT_APP_MODE !== 'DEBUG') {
if (captionEnable) {
return new LS2Request().send({
service: "luna://com.webos.service.tv.subtitle",
method: "enableSubtitle",
service: 'luna://com.webos.service.tv.subtitle',
method: 'enableSubtitle',
parameters: { pipelineId: mediaId },
onSuccess,
onFailure,
@@ -207,8 +198,8 @@ export const setSubtitleEnable = (
});
} else {
return new LS2Request().send({
service: "luna://com.webos.service.tv.subtitle",
method: "disableSubtitle",
service: 'luna://com.webos.service.tv.subtitle',
method: 'disableSubtitle',
parameters: { pipelineId: mediaId },
onSuccess,
onFailure,
@@ -224,10 +215,10 @@ export const setSubtitleEnableOver5 = (
captionEnable,
{ onSuccess, onFailure, onComplete }
) => {
if (typeof window === "object" && window.PalmSystem) {
if (typeof window === 'object' && window.PalmSystem) {
return new LS2Request().send({
service: "luna://com.webos.media",
method: "setSubtitleEnable",
service: 'luna://com.webos.media',
method: 'setSubtitleEnable',
parameters: { enable: captionEnable, mediaId: mediaId },
onSuccess,
onFailure,
@@ -238,17 +229,17 @@ export const setSubtitleEnableOver5 = (
// system Alert with time validation
export const addReservation = (data, { onSuccess, onFailure, onComplete }) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND addReservation data", data);
if (typeof window === 'object' && !window.PalmSystem) {
dlog('LUNA SEND addReservation data', data);
return;
}
const createReservation = () => {
return new LS2Request().send({
service: "luna://com.webos.service.tvReservationAgent",
method: "add",
service: 'luna://com.webos.service.tvReservationAgent',
method: 'add',
parameters: {
scheduleType: "LGShopping",
scheduleType: 'LGShopping',
startTime: {
year: data.startTime.year,
month: data.startTime.month,
@@ -258,13 +249,13 @@ export const addReservation = (data, { onSuccess, onFailure, onComplete }) => {
second: data.startTime.second,
},
callback: {
method: "luna://com.webos.notification/createAlert",
method: 'luna://com.webos.notification/createAlert',
params: {
message: data.params.message,
buttons: [
{
label: data.params.buttons[0].label,
onclick: "luna://com.webos.applicationManager/launch",
onclick: 'luna://com.webos.applicationManager/launch',
params: {
id: window.PalmSystem.identifier ?? appinfo.id,
params: data.params.launch,
@@ -284,16 +275,10 @@ export const addReservation = (data, { onSuccess, onFailure, onComplete }) => {
},
onSuccess,
onFailure: (err) => {
console.log("LUNA SEND addReservation failed", err);
derror('LUNA SEND addReservation failed', err);
// Check if error is related to invalid current time
if (
err &&
err.errorText &&
err.errorText.includes("Invalid current time")
) {
console.log(
"Invalid current time error detected, will retry after time validation"
);
if (err && err.errorText && err.errorText.includes('Invalid current time')) {
dlog('Invalid current time error detected, will retry after time validation');
// Don't call onFailure immediately, let the retry logic handle it
return;
}
@@ -305,33 +290,33 @@ export const addReservation = (data, { onSuccess, onFailure, onComplete }) => {
// First, validate system time before creating reservation
const validateTimeAndCreateReservation = (retryCount = 0, maxRetries = 3) => {
console.log(`LUNA SEND validating system time, attempt ${retryCount + 1}`);
dlog(`LUNA SEND validating system time, attempt ${retryCount + 1}`);
getSystemTime({
onSuccess: (timeRes) => {
console.log("LUNA SEND system time validation success", timeRes);
dlog('LUNA SEND system time validation success', timeRes);
// Time is available, proceed with reservation
createReservation();
},
onFailure: (timeErr) => {
console.log("LUNA SEND system time validation failed", timeErr);
derror('LUNA SEND system time validation failed', timeErr);
if (retryCount < maxRetries) {
// Retry with exponential backoff
const delay = Math.min(1000 * Math.pow(2, retryCount), 5000); // Max 5 seconds
console.log(`LUNA SEND retrying time validation in ${delay}ms`);
dlog(`LUNA SEND retrying time validation in ${delay}ms`);
setTimeout(() => {
validateTimeAndCreateReservation(retryCount + 1, maxRetries);
}, delay);
} else {
console.log("LUNA SEND max retries exceeded for time validation");
dlog('LUNA SEND max retries exceeded for time validation');
// Still try to create reservation as fallback
createReservation();
}
},
onComplete: () => {
console.log("LUNA SEND system time validation complete");
dlog('LUNA SEND system time validation complete');
},
});
};
@@ -340,21 +325,15 @@ export const addReservation = (data, { onSuccess, onFailure, onComplete }) => {
validateTimeAndCreateReservation();
};
export const deleteReservationCallback = (
scheduleIdList,
{ onSuccess, onFailure, onComplete }
) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log(
"LUNA SEND deleteReservationCallback scheduleIdList",
scheduleIdList
);
export const deleteReservationCallback = (scheduleIdList, { onSuccess, onFailure, onComplete }) => {
if (typeof window === 'object' && !window.PalmSystem) {
dlog('LUNA SEND deleteReservationCallback scheduleIdList', scheduleIdList);
return;
}
return new LS2Request().send({
service: "luna://com.webos.service.tvReservationAgent",
method: "delete",
service: 'luna://com.webos.service.tvReservationAgent',
method: 'delete',
parameters: {
scheduleIdList: scheduleIdList,
},
@@ -365,19 +344,19 @@ export const deleteReservationCallback = (
};
export const deleteReservation = ({ onSuccess, onFailure, onComplete }) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND deleteReservation");
if (typeof window === 'object' && !window.PalmSystem) {
dlog('LUNA SEND deleteReservation');
return;
}
return new LS2Request().send({
service: "luna://com.palm.db",
method: "search",
service: 'luna://com.palm.db',
method: 'search',
parameters: {
query: {
from: "com.webos.service.tvReservationAgent.info:1",
orderBy: "startTime",
filter: [{ prop: "reserveType", op: "=", val: 6 }], // 6 LG Shopping 전용.
from: 'com.webos.service.tvReservationAgent.info:1',
orderBy: 'startTime',
filter: [{ prop: 'reserveType', op: '=', val: 6 }], // 6 LG Shopping 전용.
},
},
onSuccess,
@@ -387,8 +366,8 @@ export const deleteReservation = ({ onSuccess, onFailure, onComplete }) => {
};
export const deleteOldDb8 = (kind, { onSuccess, onFailure, onComplete }) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND deleteOldDb8");
if (typeof window === 'object' && !window.PalmSystem) {
dlog('LUNA SEND deleteOldDb8');
onSuccess && onSuccess();
return;
}
@@ -396,10 +375,10 @@ export const deleteOldDb8 = (kind, { onSuccess, onFailure, onComplete }) => {
const id = window.PalmSystem.identifier ?? appinfo.id;
return new LS2Request().send({
service: "luna://com.webos.service.db",
method: "delKind",
service: 'luna://com.webos.service.db',
method: 'delKind',
parameters: {
id: id + ":" + kind,
id: id + ':' + kind,
},
onSuccess,
onFailure,
@@ -408,20 +387,20 @@ export const deleteOldDb8 = (kind, { onSuccess, onFailure, onComplete }) => {
};
export const checkFirstLaunch = ({ onSuccess, onFailure, onComplete }) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND checkFirstLaunch");
if (typeof window === 'object' && !window.PalmSystem) {
dlog('LUNA SEND checkFirstLaunch');
return;
}
const id = window.PalmSystem.identifier ?? appinfo.id;
return new LS2Request().send({
service: "luna://com.webos.service.db",
method: "find",
service: 'luna://com.webos.service.db',
method: 'find',
parameters: {
query: {
from: `${id}:20`,
where: [{ prop: "type", op: "=", val: "app_init" }],
where: [{ prop: 'type', op: '=', val: 'app_init' }],
},
},
onSuccess,
@@ -431,8 +410,8 @@ export const checkFirstLaunch = ({ onSuccess, onFailure, onComplete }) => {
};
export const saveFirstLaunchInfo = ({ onSuccess, onFailure, onComplete }) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND saveFirstLaunchInfo");
if (typeof window === 'object' && !window.PalmSystem) {
dlog('LUNA SEND saveFirstLaunchInfo');
onSuccess({ returnValue: true });
return;
}
@@ -440,13 +419,13 @@ export const saveFirstLaunchInfo = ({ onSuccess, onFailure, onComplete }) => {
const id = window.PalmSystem.identifier ?? appinfo.id;
return new LS2Request().send({
service: "luna://com.webos.service.db",
method: "put",
service: 'luna://com.webos.service.db',
method: 'put',
parameters: {
object: [
{
_kind: `${id}:20`,
type: "app_init",
type: 'app_init',
initialized: true,
timestamp: new Date().toISOString(),
},
@@ -459,14 +438,14 @@ export const saveFirstLaunchInfo = ({ onSuccess, onFailure, onComplete }) => {
};
export const disableNotification = ({ onSuccess, onFailure, onComplete }) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND disableNotification");
if (typeof window === 'object' && !window.PalmSystem) {
dlog('LUNA SEND disableNotification');
return;
}
return new LS2Request().send({
service: "luna://com.webos.notification",
method: "disable",
service: 'luna://com.webos.notification',
method: 'disable',
parameters: {},
onSuccess,
onFailure,
@@ -475,14 +454,14 @@ export const disableNotification = ({ onSuccess, onFailure, onComplete }) => {
};
export const enableNotification = ({ onSuccess, onFailure, onComplete }) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND enableNotification");
if (typeof window === 'object' && !window.PalmSystem) {
dlog('LUNA SEND enableNotification');
return;
}
return new LS2Request().send({
service: "luna://com.webos.notification",
method: "enable",
service: 'luna://com.webos.notification',
method: 'enable',
parameters: {},
onSuccess,
onFailure,
@@ -491,13 +470,13 @@ export const enableNotification = ({ onSuccess, onFailure, onComplete }) => {
};
export const getConnectionInfo = ({ onSuccess, onFailure, onComplete }) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND disableConnectionInfo");
if (typeof window === 'object' && !window.PalmSystem) {
dlog('LUNA SEND disableConnectionInfo');
return;
} else {
return new LS2Request().send({
service: "luna://com.webos.service.connectionmanager",
method: "getinfo",
service: 'luna://com.webos.service.connectionmanager',
method: 'getinfo',
subscribe: false,
parameters: {},
onSuccess,
@@ -509,35 +488,35 @@ export const getConnectionInfo = ({ onSuccess, onFailure, onComplete }) => {
// Check system time availability
export const getSystemTime = ({ onSuccess, onFailure, onComplete }) => {
if (typeof window === "object" && !window.PalmSystem) {
console.log("LUNA SEND getSystemTime - mock environment");
if (typeof window === 'object' && !window.PalmSystem) {
dlog('LUNA SEND getSystemTime - mock environment');
onSuccess({ returnValue: true, utc: Date.now() / 1000 });
return;
}
return new LS2Request().send({
service: "luna://com.webos.settingsservice",
method: "getSystemSettings",
service: 'luna://com.webos.settingsservice',
method: 'getSystemSettings',
subscribe: false,
parameters: {
category: "time",
keys: ["autoClock"],
category: 'time',
keys: ['autoClock'],
},
onSuccess: (res) => {
console.log("LUNA SEND getSystemTime success", res);
dlog('LUNA SEND getSystemTime success', res);
if (res && res.returnValue) {
// If autoClock is available, try to get actual time
new LS2Request().send({
service: "luna://com.webos.service.systemservice",
method: "clock/getTime",
service: 'luna://com.webos.service.systemservice',
method: 'clock/getTime',
subscribe: false,
parameters: {},
onSuccess: (timeRes) => {
console.log("LUNA SEND clock/getTime success", timeRes);
dlog('LUNA SEND clock/getTime success', timeRes);
onSuccess(timeRes);
},
onFailure: (timeErr) => {
console.log("LUNA SEND clock/getTime failed", timeErr);
derror('LUNA SEND clock/getTime failed', timeErr);
// Fallback to settings response if getTime fails
onSuccess(res);
},