diff --git a/com.twin.app.shoptime/src/App/App.js b/com.twin.app.shoptime/src/App/App.js index 535cd390..6b0ccb7f 100644 --- a/com.twin.app.shoptime/src/App/App.js +++ b/com.twin.app.shoptime/src/App/App.js @@ -1,30 +1,29 @@ -import React, { useCallback, useEffect } from 'react'; +import React, { useCallback, useEffect } from "react"; -import { useDispatch } from 'react-redux'; +import { useDispatch } from "react-redux"; -import ThemeDecorator from '@enact/sandstone/ThemeDecorator'; -import platform from '@enact/core/platform'; -import { getBrandList } from '../actions/brandActions'; -import { getAuthenticationCode } from '../actions/deviceActions'; +import platform from "@enact/core/platform"; +import ThemeDecorator from "@enact/sandstone/ThemeDecorator"; + +import appinfo from "../../webos-meta/appinfo.json"; +import { getBrandList } from "../actions/brandActions"; +import { changeAppStatus } from "../actions/commonActions"; +import { getAuthenticationCode } from "../actions/deviceActions"; import { getHomeLayout, getHomeMainContents, getHomeMenu, getThemeCurationInfo, -} from '../actions/homeActions'; -import { - getSubCategory, - getTop20Show, -} from '../actions/mainActions'; -import { getMyRecommandedKeyword } from '../actions/myPageActions'; -import { getBestSeller } from '../actions/productActions'; -import MainView from '../views/MainView/MainView'; +} from "../actions/homeActions"; +import { getSubCategory, getTop20Show } from "../actions/mainActions"; +import { getMyRecommandedKeyword } from "../actions/myPageActions"; +import { getOnSaleInfo } from "../actions/onSaleActions"; +import { getBestSeller } from "../actions/productActions"; import { lunaTest } from "../lunaSend/lunaTest"; -import appinfo from '../../webos-meta/appinfo.json'; -import css from './App.module.less'; -import { getLaunchParams } from '../utils/helperMethods'; -import { changeAppStatus } from '../actions/commonActions'; -import { handleDeepLink } from './deepLinkHandler'; +import { getLaunchParams } from "../utils/helperMethods"; +import MainView from "../views/MainView/MainView"; +import css from "./App.module.less"; +import { handleDeepLink } from "./deepLinkHandler"; let foreGroundChangeTimer = null; @@ -33,11 +32,19 @@ function AppBase(props) { const initService = useCallback( (haveyInit = true) => { - console.log( "<<<<<<<<<<<<< appinfo >>>>>>>>>>>>{heavyInit, appinfo} ", haveyInit, appinfo); + console.log( + "<<<<<<<<<<<<< appinfo >>>>>>>>>>>>{heavyInit, appinfo} ", + haveyInit, + appinfo + ); if (haveyInit) { dispatch(changeAppStatus({ connectionFailed: false })); if (typeof window === "object" && window.PalmSystem) { - dispatch(changeAppStatus({ cursorVisible: window.PalmSystem?.cursor?.visibility })); + dispatch( + changeAppStatus({ + cursorVisible: window.PalmSystem?.cursor?.visibility, + }) + ); } //todo // dispatch(getSystemSettings()); @@ -48,6 +55,7 @@ function AppBase(props) { // dispatch(getHttpHeaderForServiceRequest(webOSVersion, language)); dispatch(getAuthenticationCode()); + dispatch(getOnSaleInfo({ categoryIncFlag: "Y", lgCatCd: "" })); dispatch(getHomeMenu()); dispatch(getHomeLayout()); dispatch(getHomeMainContents()); @@ -67,22 +75,30 @@ function AppBase(props) { dispatch(getThemeCurationInfo()); } }, - [dispatch]); + [dispatch] + ); - const handleLaunchEvent = useCallback((isRelaunch=false)=>{ - //todo deeplink - const launchParams = getLaunchParams(); - console.log('handleLaunchEvent...{isRelaunch, launchParams}', isRelaunch, launchParams); - - if(launchParams?.contentTarget){ + const handleLaunchEvent = useCallback( + (isRelaunch = false) => { //todo deeplink - dispatch(handleDeepLink(launchParams.contentTarget)); - } + const launchParams = getLaunchParams(); + console.log( + "handleLaunchEvent...{isRelaunch, launchParams}", + isRelaunch, + launchParams + ); - setTimeout(() => { - initService(!isRelaunch); - }, 100); - },[initService]); + if (launchParams?.contentTarget) { + //todo deeplink + dispatch(handleDeepLink(launchParams.contentTarget)); + } + + setTimeout(() => { + initService(!isRelaunch); + }, 100); + }, + [initService] + ); const handleRelaunchEvent = useCallback(() => { console.log("handleRelaunchEvent started"); @@ -99,12 +115,25 @@ function AppBase(props) { // set foreground flag using delay time. clearTimeout(foreGroundChangeTimer); foreGroundChangeTimer = setTimeout(() => { - console.log("visibility changed !!! ==> set to foreground cursorVisible", JSON.stringify(window.PalmSystem?.cursor?.visibility)); // eslint-disable-line no-console + console.log( + "visibility changed !!! ==> set to foreground cursorVisible", + JSON.stringify(window.PalmSystem?.cursor?.visibility) + ); // eslint-disable-line no-console if (platform.platformName !== "webos") { //for debug - dispatch(changeAppStatus({ isAppForeground: true, cursorVisible: !platform.touchscreen })); - } else if (typeof window === 'object') { - dispatch(changeAppStatus({ isAppForeground: true, cursorVisible: window.PalmSystem?.cursor?.visibility })); + dispatch( + changeAppStatus({ + isAppForeground: true, + cursorVisible: !platform.touchscreen, + }) + ); + } else if (typeof window === "object") { + dispatch( + changeAppStatus({ + isAppForeground: true, + cursorVisible: window.PalmSystem?.cursor?.visibility, + }) + ); } }, 1000); setTimeout(() => { @@ -116,14 +145,15 @@ function AppBase(props) { useEffect(() => { if (typeof window === "object" && window.PalmSystem) { window.PalmSystem.activate(); - window.lunaTest = (service, method, subscribe, parameters) => lunaTest(service, method, subscribe, parameters); + window.lunaTest = (service, method, subscribe, parameters) => + lunaTest(service, method, subscribe, parameters); } handleLaunchEvent(); document.addEventListener("visibilitychange", visibilityChanged); document.addEventListener("webOSRelaunch", handleRelaunchEvent); return () => { - document.removeEventListener("visibilitychange", visibilityChanged) - document.removeEventListener("webOSRelaunch", handleRelaunchEvent) + document.removeEventListener("visibilitychange", visibilityChanged); + document.removeEventListener("webOSRelaunch", handleRelaunchEvent); }; }, [dispatch]);