fix: 선택약관 4차수정 250622
This commit is contained in:
@@ -1,28 +1,41 @@
|
||||
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
||||
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
||||
import platform from "@enact/core/platform";
|
||||
import { Job } from "@enact/core/util";
|
||||
import ThemeDecorator from "@enact/sandstone/ThemeDecorator";
|
||||
import React, {
|
||||
// useMemo,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useRef,
|
||||
// useState,
|
||||
} from "react";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
// import { I18nContext } from "@enact/i18n";
|
||||
// import classNames from "classnames";
|
||||
// import PropTypes from "prop-types";
|
||||
import Spotlight from "@enact/spotlight";
|
||||
import { Job } from "@enact/core/util";
|
||||
import platform from "@enact/core/platform";
|
||||
import { ThemeDecorator } from "@enact/sandstone/ThemeDecorator";
|
||||
|
||||
// import "../../../assets/fontello/css/fontello.css";
|
||||
|
||||
import appinfo from "../../webos-meta/appinfo.json";
|
||||
import {
|
||||
changeAppStatus,
|
||||
checkFirstLaunch,
|
||||
// cancelFocusElement,
|
||||
// focusElement,
|
||||
// setExitApp,
|
||||
// setPreventMouse,
|
||||
// setShowPopup,
|
||||
// setTermsAgreeYn,
|
||||
getTermsAgreeYn,
|
||||
deleteOldDb8Datas,
|
||||
getConnectionInfo,
|
||||
sendBroadCast,
|
||||
getConnectionStatus,
|
||||
getConnectionInfo,
|
||||
getDeviceId,
|
||||
getHttpHeaderForServiceRequest,
|
||||
getSystemSettings,
|
||||
sendBroadCast,
|
||||
checkFirstLaunch,
|
||||
setDeepLink,
|
||||
setGNBMenu,
|
||||
setSecondLayerInfo,
|
||||
setShowPopup,
|
||||
getTermsAgreeYn,
|
||||
} from "../actions/commonActions";
|
||||
import { getShoptimeTerms } from "../actions/empActions";
|
||||
import { getHomeMenu, getHomeTerms } from "../actions/homeActions";
|
||||
@@ -36,7 +49,14 @@ import usePrevious from "../hooks/usePrevious";
|
||||
import { lunaTest } from "../lunaSend/lunaTest";
|
||||
import { store } from "../store/store";
|
||||
import * as Config from "../utils/Config";
|
||||
import { $L, clearLaunchParams, getLaunchParams } from "../utils/helperMethods";
|
||||
import {
|
||||
// $L,
|
||||
clearLaunchParams,
|
||||
// getCountry,
|
||||
getLaunchParams,
|
||||
// getUUID,
|
||||
// resizeTo,
|
||||
} from "../utils/helperMethods";
|
||||
import { SpotlightIds } from "../utils/SpotlightIds";
|
||||
import ErrorBoundary from "../views/ErrorBoundary";
|
||||
import MainView from "../views/MainView/MainView";
|
||||
@@ -44,7 +64,11 @@ import css from "./App.module.less";
|
||||
import { handleBypassLink } from "./bypassLinkHandler";
|
||||
import { handleDeepLink } from "./deepLinkHandler";
|
||||
import { sendLogTotalRecommend } from "../actions/logActions";
|
||||
import { startFocusMonitoring, stopFocusMonitoring } from '../utils/focus-monitor';
|
||||
// import {
|
||||
// startFocusMonitoring,
|
||||
// stopFocusMonitoring,
|
||||
// } from "../utils/focus-monitor";
|
||||
// import { PanelHoc } from "../components/TPanel/TPanel";
|
||||
|
||||
let foreGroundChangeTimer = null;
|
||||
|
||||
@@ -80,7 +104,7 @@ Spotlight.focus = function (elem, containerOption) {
|
||||
if (!floatLayerNode.contains(current)) {
|
||||
if (floatLayerNode.lastElementChild) {
|
||||
const spottableNode = floatLayerNode.lastElementChild.querySelector(
|
||||
'[data-spotlight-container="true"]'
|
||||
'[data-spotlight-container="true"]',
|
||||
);
|
||||
if (spottableNode) {
|
||||
originFocus.apply(this, [spottableNode]); // this 바인딩을 유지하여 originFocus 호출
|
||||
@@ -98,7 +122,7 @@ Spotlight.focus = function (elem, containerOption) {
|
||||
sendBroadCast({
|
||||
type: "deActivateTab",
|
||||
moreInfo: { reason: "focus" },
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -111,15 +135,15 @@ function AppBase(props) {
|
||||
const httpHeader = useSelector((state) => state.common.httpHeader);
|
||||
const httpHeaderRef = useRef(httpHeader);
|
||||
const webOSVersion = useSelector(
|
||||
(state) => state.common.appStatus.webOSVersion
|
||||
(state) => state.common.appStatus.webOSVersion,
|
||||
);
|
||||
const deviceId = useSelector((state) => state.common.appStatus.deviceId);
|
||||
const loginUserData = useSelector(
|
||||
(state) => state.common.appStatus.loginUserData
|
||||
(state) => state.common.appStatus.loginUserData,
|
||||
);
|
||||
const loginUserDataRef = useRef(loginUserData);
|
||||
const cursorVisible = useSelector(
|
||||
(state) => state.common.appStatus.cursorVisible
|
||||
(state) => state.common.appStatus.cursorVisible,
|
||||
);
|
||||
const introTermsAgree = useSelector((state) => state.common.introTermsAgree);
|
||||
// const optionalTermsAgree = useSelector((state) => state.common.optionalTermsAgree);
|
||||
@@ -128,15 +152,6 @@ function AppBase(props) {
|
||||
// const termsFlag = useSelector((state) => state.common.termsFlag);
|
||||
const termsData = useSelector((state) => state.home.termsData);
|
||||
|
||||
// const shouldShowOptionalTermsPopup = useMemo(() => {
|
||||
// const terms = termsData?.data?.terms;
|
||||
// if (!terms) {
|
||||
// return false;
|
||||
// }
|
||||
// const optionalTerm = terms.find(term => term.trmsTpCd === "MST00405");
|
||||
// return optionalTerm ? optionalTerm.trmsPopFlag === 'Y' && optionalTerm.trmsAgrFlag === 'N' : false;
|
||||
// }, [termsData]);
|
||||
|
||||
useEffect(() => {
|
||||
if (termsData?.data?.terms) {
|
||||
dispatch(getTermsAgreeYn());
|
||||
@@ -146,9 +161,9 @@ function AppBase(props) {
|
||||
const introTermsAgreeRef = usePrevious(introTermsAgree);
|
||||
const logEnable = useSelector((state) => state.localSettings.logEnable);
|
||||
const oldDb8Deleted = useSelector(
|
||||
(state) => state.localSettings.oldDb8Deleted
|
||||
(state) => state.localSettings.oldDb8Deleted,
|
||||
);
|
||||
const macAddress = useSelector((state) => state.common.macAddress);
|
||||
// const macAddress = useSelector((state) => state.common.macAddress);
|
||||
|
||||
const deviceCountryCode = httpHeader?.["X-Device-Country"] || "";
|
||||
|
||||
@@ -170,13 +185,13 @@ function AppBase(props) {
|
||||
if (!oldDb8Deleted) {
|
||||
dispatch(deleteOldDb8Datas());
|
||||
}
|
||||
}, [oldDb8Deleted]);
|
||||
}, [oldDb8Deleted, dispatch]);
|
||||
|
||||
const hideCursor = useRef(
|
||||
new Job((func) => {
|
||||
func();
|
||||
console.log("hide cursor");
|
||||
}, 5000)
|
||||
}, 5000),
|
||||
);
|
||||
|
||||
// 컴포넌트에서 모니터링 시작 - 한시적 모니터링
|
||||
@@ -199,11 +214,13 @@ function AppBase(props) {
|
||||
// called by [receive httpHeader, launch, relaunch]
|
||||
const initService = useCallback(
|
||||
(haveyInit = true) => {
|
||||
/*
|
||||
console.log(
|
||||
"<<<<<<<<<<<<< appinfo >>>>>>>>>>>>{heavyInit, appinfo} ",
|
||||
haveyInit,
|
||||
appinfo
|
||||
);
|
||||
*/
|
||||
if (httpHeaderRef.current) {
|
||||
if (haveyInit) {
|
||||
dispatch(changeAppStatus({ connectionFailed: false }));
|
||||
@@ -211,7 +228,7 @@ function AppBase(props) {
|
||||
dispatch(
|
||||
changeAppStatus({
|
||||
cursorVisible: window.PalmSystem?.cursor?.visibility,
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
dispatch(getHomeMenu());
|
||||
@@ -224,7 +241,7 @@ function AppBase(props) {
|
||||
console.log(
|
||||
"initService...{haveyInit, launchParams}",
|
||||
haveyInit,
|
||||
JSON.stringify(launchParams)
|
||||
JSON.stringify(launchParams),
|
||||
);
|
||||
|
||||
// pyh TODO: edit or delete later (line 196 ~ 198)
|
||||
@@ -239,7 +256,7 @@ function AppBase(props) {
|
||||
contextName: Config.LOG_CONTEXT_NAME.ENTRY,
|
||||
messageId: Config.LOG_MESSAGE_ID.ENTRY_INFO,
|
||||
entry_menu: "App",
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -249,12 +266,12 @@ function AppBase(props) {
|
||||
contextName: Config.LOG_CONTEXT_NAME.SHOPTIME,
|
||||
messageId: Config.LOG_MESSAGE_ID.VIEW_CHANGE,
|
||||
visible: true,
|
||||
})
|
||||
}),
|
||||
);
|
||||
clearLaunchParams();
|
||||
}
|
||||
},
|
||||
[dispatch]
|
||||
[dispatch],
|
||||
);
|
||||
|
||||
const handleRelaunchEvent = useCallback(() => {
|
||||
@@ -265,7 +282,7 @@ function AppBase(props) {
|
||||
if (typeof window === "object" && window.PalmSystem) {
|
||||
window.PalmSystem.activate();
|
||||
}
|
||||
}, [initService, dispatch]);
|
||||
}, [initService, introTermsAgreeRef]);
|
||||
|
||||
const visibilityChanged = useCallback(() => {
|
||||
console.log("document is hidden", document.hidden);
|
||||
@@ -279,7 +296,7 @@ function AppBase(props) {
|
||||
foreGroundChangeTimer = setTimeout(() => {
|
||||
console.log(
|
||||
"visibility changed !!! ==> set to foreground cursorVisible",
|
||||
JSON.stringify(window.PalmSystem?.cursor?.visibility)
|
||||
JSON.stringify(window.PalmSystem?.cursor?.visibility),
|
||||
); // eslint-disable-line no-console
|
||||
if (platform.platformName !== "webos") {
|
||||
//for debug
|
||||
@@ -287,19 +304,19 @@ function AppBase(props) {
|
||||
changeAppStatus({
|
||||
isAppForeground: true,
|
||||
cursorVisible: !platform.touchscreen,
|
||||
})
|
||||
}),
|
||||
);
|
||||
} else if (typeof window === "object") {
|
||||
dispatch(
|
||||
changeAppStatus({
|
||||
isAppForeground: true,
|
||||
cursorVisible: window.PalmSystem?.cursor?.visibility,
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}, [dispatch, initService]);
|
||||
}, [dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
const keyDownEvent = (event) => {
|
||||
@@ -342,7 +359,7 @@ function AppBase(props) {
|
||||
document.removeEventListener("wheel", mouseMoveEvent);
|
||||
}
|
||||
};
|
||||
}, [dispatch]);
|
||||
}, [dispatch, visibilityChanged, handleRelaunchEvent]);
|
||||
|
||||
useEffect(() => {
|
||||
let userDataChanged = false;
|
||||
@@ -358,7 +375,7 @@ function AppBase(props) {
|
||||
dispatch(
|
||||
changeAppStatus({
|
||||
showLoadingPanel: { show: true, type: "launching" },
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
dispatch(checkFirstLaunch());
|
||||
@@ -367,13 +384,13 @@ function AppBase(props) {
|
||||
getHomeTerms({
|
||||
mbrNo: loginUserData.userNumber,
|
||||
trmsTpCdList: "MST00401, MST00402, MST00405", // 선택약관 추가 25.06
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
httpHeaderRef.current = httpHeader;
|
||||
}
|
||||
loginUserDataRef.current = loginUserData;
|
||||
}, [httpHeader, deviceId]);
|
||||
}, [httpHeader, deviceId, dispatch, loginUserData]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
@@ -385,8 +402,7 @@ function AppBase(props) {
|
||||
) {
|
||||
dispatch(getShoptimeTerms());
|
||||
}
|
||||
}, [webOSVersion, deviceId]);
|
||||
|
||||
}, [webOSVersion, deviceId, dispatch, deviceCountryCode]);
|
||||
|
||||
// 테스트용 인트로 화면 표시
|
||||
// useEffect(() => {
|
||||
@@ -402,31 +418,17 @@ function AppBase(props) {
|
||||
// 약관 동의 여부 확인 전에는 아무것도 하지 않음
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (introTermsAgree) {
|
||||
// 필수 약관에 동의한 경우
|
||||
// if (shouldShowOptionalTermsPopup) {
|
||||
// 선택 약관 팝업을 띄워야 하는 경우
|
||||
// 3초 후에 팝업을 띄우도록 설정
|
||||
// console.log("App.js optionalTermsTest 팝업 표시");
|
||||
// const timer = setTimeout(() => {
|
||||
// dispatch(setShowPopup({ activePopup: "optionalTermsConfirm" }));
|
||||
// }, 3000); // 3000 milliseconds = 3 seconds
|
||||
|
||||
// 컴포넌트 언마운트 시 타이머 클리어
|
||||
// return () => clearTimeout(timer);
|
||||
// } else {
|
||||
// 선택 약관 팝업이 필요 없는 경우, 바로 서비스 초기화
|
||||
initService(true);
|
||||
// }
|
||||
initService(true);
|
||||
} else {
|
||||
// 필수 약관에 동의하지 않은 경우
|
||||
dispatch(
|
||||
pushPanel({ name: Config.panel_names.INTRO_PANEL, panelInfo: {} })
|
||||
pushPanel({ name: Config.panel_names.INTRO_PANEL, panelInfo: {} }),
|
||||
);
|
||||
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
|
||||
}
|
||||
}, [introTermsAgree, dispatch, initService]);
|
||||
}, [introTermsAgree, dispatch, initService, termsLoading]);
|
||||
|
||||
useEffect(() => {
|
||||
const launchParmas = getLaunchParams();
|
||||
@@ -442,7 +444,7 @@ function AppBase(props) {
|
||||
setDeepLink({
|
||||
contentTarget: launchParmas.contentTarget,
|
||||
isDeepLink: true,
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -452,9 +454,9 @@ function AppBase(props) {
|
||||
deeplinkId: launchParmas.contentTarget ?? "",
|
||||
linkTpCd,
|
||||
logTpNo: Config.LOG_TP_NO.SECOND_LAYER,
|
||||
})
|
||||
}),
|
||||
);
|
||||
}, [dispatch]);
|
||||
}, [dispatch, initService]);
|
||||
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
|
||||
Reference in New Issue
Block a user