[251124] fix: Log정리-1
🕐 커밋 시간: 2025. 11. 24. 11:48:34 📊 변경 통계: • 총 파일: 1개 • 추가: +91줄 • 삭제: -71줄 📝 수정된 파일: ~ com.twin.app.shoptime/src/actions/playActions.js 🔧 함수 변경 내용: 📄 com.twin.app.shoptime/src/actions/playActions.js (javascript): ✅ Added: dwarn(), derror() 🔄 Modified: pauseFullscreenVideo(), CLEAR_PLAYER_INFO() 🔧 주요 변경 내용: • 핵심 비즈니스 로직 개선
This commit is contained in:
@@ -6,6 +6,20 @@ import { panel_names } from '../utils/Config';
|
||||
import { types } from './actionTypes';
|
||||
import { popPanel, pushPanel, updatePanel } from './panelActions';
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
// 🔽 [251116] 새로운 비디오 상태 관리 시스템 - 재생 상태
|
||||
export const PLAYBACK_STATUS = {
|
||||
LOADING: 'loading',
|
||||
@@ -48,12 +62,12 @@ export const clearAllVideoTimers = () => {
|
||||
if (startVideoFocusTimer) {
|
||||
clearTimeout(startVideoFocusTimer);
|
||||
startVideoFocusTimer = null;
|
||||
console.log('[playActions] startVideoFocusTimer cleared');
|
||||
dlog('[playActions] startVideoFocusTimer cleared');
|
||||
}
|
||||
if (startVideoTimer) {
|
||||
clearTimeout(startVideoTimer);
|
||||
startVideoTimer = null;
|
||||
console.log('[playActions] startVideoTimer cleared');
|
||||
dlog('[playActions] startVideoTimer cleared');
|
||||
}
|
||||
};
|
||||
export const startVideoPlayer =
|
||||
@@ -68,7 +82,7 @@ export const startVideoPlayer =
|
||||
...rest
|
||||
}) =>
|
||||
(dispatch, getState) => {
|
||||
console.log(
|
||||
dlog(
|
||||
'[startVideoPlayer] ✅ START - videoId:',
|
||||
videoId,
|
||||
', showUrl:',
|
||||
@@ -81,7 +95,7 @@ export const startVideoPlayer =
|
||||
const videoIdentifier = videoId || showUrl;
|
||||
if (videoIdentifier) {
|
||||
const displayMode = modal ? DISPLAY_STATUS.VISIBLE : DISPLAY_STATUS.FULLSCREEN;
|
||||
console.log(
|
||||
dlog(
|
||||
'[startVideoPlayer] 📌 Setting playback loading - identifier:',
|
||||
videoIdentifier,
|
||||
', displayMode:',
|
||||
@@ -89,7 +103,7 @@ export const startVideoPlayer =
|
||||
);
|
||||
dispatch(setPlaybackLoading(videoIdentifier, displayMode));
|
||||
} else {
|
||||
console.log(
|
||||
dlog(
|
||||
'[startVideoPlayer] ⚠️ No videoIdentifier provided (videoId and showUrl are both missing)'
|
||||
);
|
||||
}
|
||||
@@ -99,7 +113,7 @@ export const startVideoPlayer =
|
||||
let panelWorkingAction = pushPanel;
|
||||
|
||||
const panelName = panel_names.PLAYER_PANEL;
|
||||
console.log(
|
||||
dlog(
|
||||
'[startVideoPlayer] 📊 Panel state - panelsCount:',
|
||||
panels.length,
|
||||
', topPanelName:',
|
||||
@@ -108,9 +122,9 @@ export const startVideoPlayer =
|
||||
|
||||
if (topPanel && topPanel.name === panelName) {
|
||||
panelWorkingAction = updatePanel;
|
||||
console.log('[startVideoPlayer] 🔄 UPDATING existing PLAYER_PANEL');
|
||||
dlog('[startVideoPlayer] 🔄 UPDATING existing PLAYER_PANEL');
|
||||
} else {
|
||||
console.log('[startVideoPlayer] ➕ PUSHING new PLAYER_PANEL');
|
||||
dlog('[startVideoPlayer] ➕ PUSHING new PLAYER_PANEL');
|
||||
}
|
||||
|
||||
dispatch(
|
||||
@@ -129,7 +143,7 @@ export const startVideoPlayer =
|
||||
true
|
||||
)
|
||||
);
|
||||
console.log('[startVideoPlayer] ✨ Panel action dispatched');
|
||||
dlog('[startVideoPlayer] ✨ Panel action dispatched');
|
||||
|
||||
// [COMMENTED OUT] 비디오 재생 시 강제 포커스 이동 비활성화
|
||||
// if (modal && modalContainerId && !spotlightDisable) {
|
||||
@@ -143,7 +157,7 @@ export const startVideoPlayer =
|
||||
// console.log('[startVideoPlayer] ⏭️ Spotlight focus skipped - modal:', modal, ', modalContainerId:', !!modalContainerId, ', spotlightDisable:', spotlightDisable);
|
||||
// }
|
||||
|
||||
console.log('[startVideoPlayer] ✅ END');
|
||||
dlog('[startVideoPlayer] ✅ END');
|
||||
};
|
||||
|
||||
// 중복 재생 방지: 정말 동일한 요청인지 확인
|
||||
@@ -180,7 +194,7 @@ export const startVideoPlayerNew =
|
||||
...rest
|
||||
}) =>
|
||||
(dispatch, getState) => {
|
||||
console.log(
|
||||
dlog(
|
||||
'[startVideoPlayerNew] *** ✅ START - bannerId:',
|
||||
bannerId,
|
||||
', videoId:',
|
||||
@@ -195,7 +209,7 @@ export const startVideoPlayerNew =
|
||||
const videoIdentifier = videoId || showUrl || bannerId;
|
||||
if (videoIdentifier) {
|
||||
const displayMode = modal ? DISPLAY_STATUS.VISIBLE : DISPLAY_STATUS.FULLSCREEN;
|
||||
console.log(
|
||||
dlog(
|
||||
'[startVideoPlayerNew] *** 📌 Setting playback loading - identifier:',
|
||||
videoIdentifier,
|
||||
', displayMode:',
|
||||
@@ -203,7 +217,7 @@ export const startVideoPlayerNew =
|
||||
);
|
||||
dispatch(setPlaybackLoading(videoIdentifier, displayMode));
|
||||
} else {
|
||||
console.log('[startVideoPlayerNew] *** ⚠️ No videoIdentifier provided');
|
||||
dlog('[startVideoPlayerNew] *** ⚠️ No videoIdentifier provided');
|
||||
}
|
||||
|
||||
const panels = getState().panels.panels;
|
||||
@@ -212,7 +226,7 @@ export const startVideoPlayerNew =
|
||||
|
||||
// const panelName = useNewPlayer ? panel_names.PLAYER_PANEL_NEW : panel_names.PLAYER_PANEL;
|
||||
const panelName = panel_names.PLAYER_PANEL;
|
||||
console.log(
|
||||
dlog(
|
||||
'[startVideoPlayerNew] *** 📊 Panel state - panelsCount:',
|
||||
panels.length,
|
||||
', topPanelName:',
|
||||
@@ -221,10 +235,7 @@ export const startVideoPlayerNew =
|
||||
|
||||
if (topPanel && topPanel.name === panelName) {
|
||||
panelWorkingAction = updatePanel;
|
||||
console.log(
|
||||
'[startVideoPlayerNew] *** 📋 Current PLAYER_PANEL panelInfo:',
|
||||
topPanel.panelInfo
|
||||
);
|
||||
dlog('[startVideoPlayerNew] *** 📋 Current PLAYER_PANEL panelInfo:', topPanel.panelInfo);
|
||||
}
|
||||
|
||||
// 중복 실행 방지: 같은 배너 + 같은 modal 상태/컨테이너 + 같은 URL이면 skip
|
||||
@@ -236,7 +247,7 @@ export const startVideoPlayerNew =
|
||||
const isSameShowUrl = currentPanelInfo.showUrl === showUrl;
|
||||
const isSameVideoId = currentPanelInfo.videoId === videoId;
|
||||
|
||||
console.log(
|
||||
dlog(
|
||||
'[startVideoPlayerNew] *** 🔍 Duplicate check - isSameBanner:',
|
||||
isSameBanner,
|
||||
', isSameModalType:',
|
||||
@@ -250,7 +261,7 @@ export const startVideoPlayerNew =
|
||||
);
|
||||
|
||||
if (isSameBanner && isSameModalType && isSameContainer && isSameShowUrl && isSameVideoId) {
|
||||
console.log('[startVideoPlayerNew] *** ⏭️ SKIPPED - 동일한 요청', {
|
||||
dlog('[startVideoPlayerNew] *** ⏭️ SKIPPED - 동일한 요청', {
|
||||
bannerId,
|
||||
modal,
|
||||
modalContainerId,
|
||||
@@ -264,7 +275,7 @@ export const startVideoPlayerNew =
|
||||
...currentPlayerState,
|
||||
currentBannerId: bannerId,
|
||||
};
|
||||
console.log('[startVideoPlayerNew] *** 🔄 Player state updated - currentBannerId:', bannerId);
|
||||
dlog('[startVideoPlayerNew] *** 🔄 Player state updated - currentBannerId:', bannerId);
|
||||
|
||||
dispatch(
|
||||
panelWorkingAction(
|
||||
@@ -284,7 +295,7 @@ export const startVideoPlayerNew =
|
||||
true
|
||||
)
|
||||
);
|
||||
console.log(
|
||||
dlog(
|
||||
'[startVideoPlayerNew] *** ✨ Panel action dispatched - action:',
|
||||
panelWorkingAction === updatePanel ? 'updatePanel' : 'pushPanel'
|
||||
);
|
||||
@@ -301,11 +312,13 @@ export const startVideoPlayerNew =
|
||||
// console.log('[startVideoPlayerNew] *** ⏭️ Spotlight focus skipped - modal:', modal, ', modalContainerId:', !!modalContainerId, ', spotlightDisable:', spotlightDisable);
|
||||
// }
|
||||
|
||||
console.log('[startVideoPlayerNew] *** ✅ END');
|
||||
dlog('[startVideoPlayerNew] *** ✅ END');
|
||||
};
|
||||
|
||||
export const finishVideoPreview = () => (dispatch, getState) => {
|
||||
console.log('###-finishVideoPreview');
|
||||
if (DEBUG_MODE === true) {
|
||||
dlog('###-finishVideoPreview');
|
||||
}
|
||||
const panels = getState().panels.panels;
|
||||
const topPanel = panels[panels.length - 1];
|
||||
if (topPanel && topPanel.name === panel_names.PLAYER_PANEL && topPanel.panelInfo.modal) {
|
||||
@@ -319,7 +332,9 @@ export const finishVideoPreview = () => (dispatch, getState) => {
|
||||
|
||||
export const finishModalVideoForce = () => (dispatch, getState) => {
|
||||
const panels = getState().panels.panels;
|
||||
console.log('###-finishModalVideoForce');
|
||||
if (DEBUG_MODE === true) {
|
||||
dlog('###-finishModalVideoForce');
|
||||
}
|
||||
// modal PlayerPanel이 존재하는지 확인 (스택 어디에 있든)
|
||||
const hasModalPlayerPanel = panels.some(
|
||||
(panel) => panel.name === panel_names.PLAYER_PANEL && panel.panelInfo?.modal
|
||||
@@ -338,7 +353,9 @@ export const finishModalVideoForce = () => (dispatch, getState) => {
|
||||
// 모든 PlayerPanel을 강제 제거 (modal과 fullscreen 모두)
|
||||
export const finishAllVideoForce = () => (dispatch, getState) => {
|
||||
const panels = getState().panels.panels;
|
||||
console.log('###-finishAllVideoForce');
|
||||
if (DEBUG_MODE === true) {
|
||||
dlog('###-finishAllVideoForce');
|
||||
}
|
||||
// 모든 PlayerPanel이 존재하는지 확인 (스택 어디에 있든)
|
||||
const hasPlayerPanel = panels.some((panel) => panel.name === panel_names.PLAYER_PANEL);
|
||||
|
||||
@@ -355,7 +372,9 @@ export const finishAllVideoForce = () => (dispatch, getState) => {
|
||||
// 모달 비디오를 일시정지 (패널은 유지)
|
||||
export const pauseModalVideo = () => (dispatch, getState) => {
|
||||
const panels = getState().panels.panels;
|
||||
console.log('###-pauseModalVideo');
|
||||
if (DEBUG_MODE === true) {
|
||||
dlog('###-pauseModalVideo');
|
||||
}
|
||||
|
||||
// modal PlayerPanel 찾기
|
||||
const modalPlayerPanel = panels.find(
|
||||
@@ -363,7 +382,9 @@ export const pauseModalVideo = () => (dispatch, getState) => {
|
||||
);
|
||||
|
||||
if (modalPlayerPanel) {
|
||||
console.log('[pauseModalVideo] Pausing modal video');
|
||||
if (DEBUG_MODE === true) {
|
||||
dlog('[pauseModalVideo] Pausing modal video');
|
||||
}
|
||||
dispatch(
|
||||
updatePanel({
|
||||
name: panel_names.PLAYER_PANEL,
|
||||
@@ -386,7 +407,9 @@ export const resumeModalVideo = () => (dispatch, getState) => {
|
||||
);
|
||||
|
||||
if (modalPlayerPanel && modalPlayerPanel.panelInfo?.isPaused) {
|
||||
console.log('[resumeModalVideo] Resuming modal video');
|
||||
if (DEBUG_MODE === true) {
|
||||
dlog('[resumeModalVideo] Resuming modal video');
|
||||
}
|
||||
dispatch(
|
||||
updatePanel({
|
||||
name: panel_names.PLAYER_PANEL,
|
||||
@@ -450,7 +473,9 @@ export const resumeFullscreenVideo = () => (dispatch, getState) => {
|
||||
})
|
||||
);
|
||||
} else {
|
||||
console.log('[BgVideo] resumeFullscreenVideo - Not resuming (not found or not paused)');
|
||||
if (DEBUG_MODE === true) {
|
||||
dlog('[BgVideo] resumeFullscreenVideo - Not resuming (not found or not paused)');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -502,7 +527,8 @@ export const hideModalVideo = () => (dispatch, getState) => {
|
||||
})
|
||||
);
|
||||
} else {
|
||||
console.log('[HomePanel] hideModalVideo: No modal PlayerPanel found', {
|
||||
if (DEBUG_MODE === true) {
|
||||
dlog('[HomePanel] hideModalVideo: No modal PlayerPanel found', {
|
||||
panels: panels.map((p) => ({
|
||||
name: p.name,
|
||||
modal: p.panelInfo?.modal,
|
||||
@@ -510,13 +536,18 @@ export const hideModalVideo = () => (dispatch, getState) => {
|
||||
})),
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 축소된 모달 비디오를 원래 크기로 복구
|
||||
export const showModalVideo = () => (dispatch, getState) => {
|
||||
console.log('[showModalVideo] *** ✅ START');
|
||||
if (DEBUG_MODE === true) {
|
||||
dlog('[showModalVideo] *** ✅ START');
|
||||
}
|
||||
const panels = getState().panels.panels;
|
||||
console.log('[showModalVideo] *** 📊 Total panels count:', panels.length);
|
||||
if (DEBUG_MODE === true) {
|
||||
dlog('[showModalVideo] *** 📊 Total panels count:', panels.length);
|
||||
}
|
||||
|
||||
// 축소된 modal PlayerPanel 찾기
|
||||
const shrunkModalPlayerPanel = panels.find(
|
||||
@@ -526,14 +557,18 @@ export const showModalVideo = () => (dispatch, getState) => {
|
||||
panel.panelInfo?.shouldShrinkTo1px
|
||||
);
|
||||
|
||||
console.log('[showModalVideo] *** 🔍 Shrunk modal PlayerPanel found:', !!shrunkModalPlayerPanel);
|
||||
if (DEBUG_MODE === true) {
|
||||
dlog('[showModalVideo] *** 🔍 Shrunk modal PlayerPanel found:', !!shrunkModalPlayerPanel);
|
||||
}
|
||||
|
||||
if (shrunkModalPlayerPanel) {
|
||||
const panelInfo = shrunkModalPlayerPanel.panelInfo;
|
||||
const shrinkInfo = panelInfo.playerState?.shrinkInfo;
|
||||
|
||||
console.log('[showModalVideo] *** 📋 ShrinkInfo available:', !!shrinkInfo);
|
||||
console.log('[showModalVideo] *** 📋 Current panelInfo state:', {
|
||||
if (DEBUG_MODE === true) {
|
||||
dlog('[showModalVideo] *** 📋 ShrinkInfo available:', !!shrinkInfo);
|
||||
}
|
||||
dlog('[showModalVideo] *** 📋 Current panelInfo state:', {
|
||||
shouldShrinkTo1px: panelInfo.shouldShrinkTo1px,
|
||||
modal: panelInfo.modal,
|
||||
modalContainerId: panelInfo.modalContainerId,
|
||||
@@ -553,11 +588,11 @@ export const showModalVideo = () => (dispatch, getState) => {
|
||||
skipModalStyleRecalculation: false, // 위치 변경 시 DOM 기준으로 다시 계산하도록 허용
|
||||
};
|
||||
|
||||
console.log(
|
||||
dlog(
|
||||
'[showModalVideo] *** 🔄 Updated panelInfo - shouldShrinkTo1px:',
|
||||
updatedPanelInfo.shouldShrinkTo1px
|
||||
);
|
||||
console.log('[showModalVideo] *** 📍 Restored modalStyle:', updatedPanelInfo.modalStyle);
|
||||
dlog('[showModalVideo] *** 📍 Restored modalStyle:', updatedPanelInfo.modalStyle);
|
||||
|
||||
dispatch(
|
||||
updatePanel({
|
||||
@@ -565,9 +600,9 @@ export const showModalVideo = () => (dispatch, getState) => {
|
||||
panelInfo: updatedPanelInfo,
|
||||
})
|
||||
);
|
||||
console.log('[showModalVideo] *** ✨ updatePanel dispatched');
|
||||
dlog('[showModalVideo] *** ✨ updatePanel dispatched');
|
||||
} else {
|
||||
console.log('[showModalVideo] *** ⚠️ No shrunk modal PlayerPanel found', {
|
||||
dlog('[showModalVideo] *** ⚠️ No shrunk modal PlayerPanel found', {
|
||||
panels: panels.map((p) => ({
|
||||
name: p.name,
|
||||
modal: p.panelInfo?.modal,
|
||||
@@ -576,7 +611,7 @@ export const showModalVideo = () => (dispatch, getState) => {
|
||||
});
|
||||
}
|
||||
|
||||
console.log('[showModalVideo] *** ✅ END');
|
||||
dlog('[showModalVideo] *** ✅ END');
|
||||
};
|
||||
|
||||
// 🔽 패널은 유지하고 비디오만 중지하는 함수들
|
||||
@@ -594,7 +629,7 @@ export const stopModalVideoWithoutClosingPanel = () => (dispatch, getState) => {
|
||||
);
|
||||
|
||||
if (modalPlayerPanel) {
|
||||
console.log('[stopModalVideoWithoutClosingPanel] Stopping modal video playback');
|
||||
dlog('[stopModalVideoWithoutClosingPanel] Stopping modal video playback');
|
||||
|
||||
// 타이머 정리
|
||||
if (startVideoFocusTimer) {
|
||||
@@ -632,7 +667,7 @@ export const stopFullscreenVideoWithoutClosingPanel = () => (dispatch, getState)
|
||||
);
|
||||
|
||||
if (fullscreenPlayerPanel) {
|
||||
console.log('[stopFullscreenVideoWithoutClosingPanel] Stopping fullscreen video playback');
|
||||
dlog('[stopFullscreenVideoWithoutClosingPanel] Stopping fullscreen video playback');
|
||||
|
||||
// 타이머 정리
|
||||
if (startVideoFocusTimer) {
|
||||
@@ -668,7 +703,7 @@ export const stopAllVideosWithoutClosingPanel = () => (dispatch, getState) => {
|
||||
const playerPanels = panels.filter((panel) => panel.name === panel_names.PLAYER_PANEL);
|
||||
|
||||
if (playerPanels.length > 0) {
|
||||
console.log('[stopAllVideosWithoutClosingPanel] Stopping all video playback');
|
||||
dlog('[stopAllVideosWithoutClosingPanel] Stopping all video playback');
|
||||
|
||||
// 타이머 정리
|
||||
if (startVideoFocusTimer) {
|
||||
@@ -701,7 +736,7 @@ export const getChatLog =
|
||||
({ patnrId, showId }) =>
|
||||
(dispatch, getState) => {
|
||||
const onSuccess = (response) => {
|
||||
console.log('getChatLog onSuccess', response.data);
|
||||
dlog('getChatLog onSuccess', response.data);
|
||||
|
||||
dispatch({
|
||||
type: types.GET_CHAT_LOG,
|
||||
@@ -710,7 +745,7 @@ export const getChatLog =
|
||||
};
|
||||
|
||||
const onFail = (error) => {
|
||||
console.error('getChatLog onFail', error);
|
||||
derror('getChatLog onFail', error);
|
||||
};
|
||||
|
||||
TAxios(dispatch, getState, 'get', URLS.CHAT_LOG, { patnrId, showId }, {}, onSuccess, onFail);
|
||||
@@ -721,7 +756,7 @@ export const getSubTitle =
|
||||
({ showSubtitleUrl }) =>
|
||||
(dispatch, getState) => {
|
||||
const onSuccess = (response) => {
|
||||
console.log('getSubTitle onSuccess', response.data);
|
||||
dlog('getSubTitle onSuccess', response.data);
|
||||
|
||||
dispatch({
|
||||
type: types.GET_SUBTITLE,
|
||||
@@ -730,7 +765,7 @@ export const getSubTitle =
|
||||
};
|
||||
|
||||
const onFail = (error) => {
|
||||
console.error('getSubTitle onFail', error);
|
||||
derror('getSubTitle onFail', error);
|
||||
dispatch({
|
||||
type: types.GET_SUBTITLE,
|
||||
payload: { url: showSubtitleUrl, data: 'Error' },
|
||||
@@ -740,7 +775,7 @@ export const getSubTitle =
|
||||
if (!getState().play.subTitleBlobs[showSubtitleUrl]) {
|
||||
TAxios(dispatch, getState, 'get', URLS.SUBTITLE, { showSubtitleUrl }, {}, onSuccess, onFail);
|
||||
} else {
|
||||
console.log("playActions getSubTitle no Nothing it's exist", showSubtitleUrl);
|
||||
dlog("playActions getSubTitle no Nothing it's exist", showSubtitleUrl);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -766,7 +801,7 @@ export const updateVideoPlayState = (playState) => (dispatch, getState) => {
|
||||
});
|
||||
|
||||
if (hasChanges) {
|
||||
console.log('🔄 [Redux] updateVideoPlayState action created', {
|
||||
dlog('🔄 [PlayerPanel] updateVideoPlayState action created', {
|
||||
...playState,
|
||||
timestamp: new Date().toISOString(),
|
||||
caller: new Error().stack?.split('\n')[2]?.trim() || 'unknown',
|
||||
|
||||
Reference in New Issue
Block a user