fix: 선택약관관련 수정 250619

This commit is contained in:
djaco
2025-06-19 08:59:10 +09:00
parent eb4f951822
commit 7e67e05aac
27 changed files with 2065 additions and 229 deletions

View File

@@ -44,6 +44,7 @@ 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';
let foreGroundChangeTimer = null;
@@ -121,22 +122,21 @@ function AppBase(props) {
(state) => state.common.appStatus.cursorVisible
);
const introTermsAgree = useSelector((state) => state.common.introTermsAgree);
const optionalTermsAgree = useSelector(
(state) => state.common.optionalTermsAgree
);
// const optionalTermsAgree = useSelector((state) => state.common.optionalTermsAgree);
const termsLoading = useSelector((state) => state.common.termsLoading);
// termsFlag 전체 상태 확인
const termsFlag = useSelector((state) => state.common.termsFlag);
// 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" : false;
}, [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());
@@ -179,6 +179,23 @@ function AppBase(props) {
}, 5000)
);
// 컴포넌트에서 모니터링 시작 - 한시적 모니터링
// useEffect(() => {
// startFocusMonitoring();
// return () => stopFocusMonitoring();
// }, []);
// 임시 작업용 코드
// useEffect(() => {
// const timer = setTimeout(() => {
// dispatch(
// pushPanel({ name: Config.panel_names.INTRO_PANEL, panelInfo: {} })
// );
// }, 1500);
// return () => clearTimeout(timer);
// }, [dispatch]);
// called by [receive httpHeader, launch, relaunch]
const initService = useCallback(
(haveyInit = true) => {
@@ -370,29 +387,38 @@ function AppBase(props) {
}
}, [webOSVersion, deviceId]);
// 테스트용 팝업 표시
// useEffect(() => {
// setTimeout(() => {
// console.log("App.js optionalTermsTest 팝업 표시");
// dispatch(setShowPopup({ activePopup: "optionalTermsTest" }));
// dispatch(setShowPopup({ activePopup: "optionalTermsConfirmBottom" }));
// }, 3000);
// }, [dispatch]);
// 약관 동의 및 선택 약관 팝업 처리
useEffect(() => {
if (introTermsAgree === undefined) {
if (introTermsAgree === undefined || termsLoading) {
// 약관 동의 여부 확인 전에는 아무것도 하지 않음
return;
}
if (introTermsAgree) {
// 필수 약관에 동의한 경우
if (shouldShowOptionalTermsPopup) {
// if (shouldShowOptionalTermsPopup) {
// 선택 약관 팝업을 띄워야 하는 경우
dispatch(setShowPopup({ activePopup: "optionalTermsTest" }));
} else {
// 3초 후에 팝업을 띄우도록 설정
// console.log("App.js optionalTermsTest 팝업 표시");
// const timer = setTimeout(() => {
// dispatch(setShowPopup({ activePopup: "optionalTermsConfirm" }));
// }, 3000); // 3000 milliseconds = 3 seconds
// 컴포넌트 언마운트 시 타이머 클리어
// return () => clearTimeout(timer);
// } else {
// 선택 약관 팝업이 필요 없는 경우, 바로 서비스 초기화
initService(true);
}
// }
} else {
// 필수 약관에 동의하지 않은 경우
dispatch(
@@ -400,7 +426,7 @@ function AppBase(props) {
);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
}
}, [introTermsAgree, shouldShowOptionalTermsPopup, dispatch, initService]);
}, [introTermsAgree, dispatch, initService]);
useEffect(() => {
const launchParmas = getLaunchParams();
@@ -432,21 +458,19 @@ function AppBase(props) {
return (
<ErrorBoundary>
<>
{webOSVersion === "" ? null : Number(webOSVersion) < 4 ? (
<NotSupportedVersion />
) : (
<MainView
initService={initService}
className={
typeof window === "object" &&
!window.PalmSystem &&
!cursorVisible &&
css.preventMouse
}
/>
)}
</>
{webOSVersion === "" ? null : Number(webOSVersion) < 4 ? (
<NotSupportedVersion />
) : (
<MainView
initService={initService}
className={
typeof window === "object" &&
!window.PalmSystem &&
!cursorVisible &&
css.preventMouse
}
/>
)}
</ErrorBoundary>
);
}