refactor:esign 페이지 및 전역 레이아웃 React CDN 통합
- esign 전자서명 관련 9개 파일 업데이트 - layouts/app.blade.php 업데이트 - fcm.js React 관련 변경사항 반영
This commit is contained in:
@@ -11,7 +11,8 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
console.log('[FCM] fcm.js LOADED v2');
|
||||
const DEBUG = window.SAM_CONFIG?.debug || false;
|
||||
const log = (...args) => { if (DEBUG) console.log('[FCM]', ...args); };
|
||||
|
||||
const CONFIG = {
|
||||
apiBaseUrl: window.SAM_CONFIG?.apiBaseUrl || 'https://api.codebridge-x.com',
|
||||
@@ -36,12 +37,12 @@
|
||||
// Capacitor 네이티브 환경(ios, android)에서만 실행
|
||||
const platform = window.Capacitor?.getPlatform?.();
|
||||
if (platform !== 'ios' && platform !== 'android') {
|
||||
console.log('[FCM] Not running in native app (platform:', platform || 'web', ')');
|
||||
log(' Not running in native app (platform:', platform || 'web', ')');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!window.Capacitor?.Plugins?.PushNotifications) {
|
||||
console.log('[FCM] PushNotifications plugin not available');
|
||||
log(' PushNotifications plugin not available');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@
|
||||
|
||||
App.addListener('appStateChange', ({ isActive }) => {
|
||||
isAppForeground = isActive;
|
||||
console.log('[FCM] App state:', isActive ? 'foreground' : 'background');
|
||||
log(' App state:', isActive ? 'foreground' : 'background');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,8 +68,8 @@
|
||||
|
||||
// ✅ 2. 리스너를 먼저 등록 (가장 중요)
|
||||
PushNotifications.addListener('registration', async (token) => {
|
||||
console.log('[FCM] 🔥 registration event fired');
|
||||
console.log('[FCM] Token received:', token.value?.substring(0, 20) + '...');
|
||||
log(' 🔥 registration event fired');
|
||||
log(' Token received:', token.value?.substring(0, 20) + '...');
|
||||
await handleTokenRegistration(token.value);
|
||||
});
|
||||
|
||||
@@ -77,12 +78,12 @@
|
||||
});
|
||||
|
||||
PushNotifications.addListener('pushNotificationReceived', (notification) => {
|
||||
console.log('[FCM] Push received (foreground):', notification);
|
||||
log(' Push received (foreground):', notification);
|
||||
handleForegroundNotification(notification);
|
||||
});
|
||||
|
||||
PushNotifications.addListener('pushNotificationActionPerformed', (action) => {
|
||||
console.log('[FCM] Push action performed:', action);
|
||||
log(' Push action performed:', action);
|
||||
const data = action.notification?.data;
|
||||
if (data?.url) {
|
||||
window.location.href = data.url;
|
||||
@@ -91,10 +92,10 @@
|
||||
|
||||
// ✅ 3. 그 다음에 권한 요청
|
||||
const perm = await PushNotifications.requestPermissions();
|
||||
console.log('[FCM] Push permission:', perm.receive);
|
||||
log(' Push permission:', perm.receive);
|
||||
|
||||
if (perm.receive !== 'granted') {
|
||||
console.log('[FCM] Push permission not granted');
|
||||
log(' Push permission not granted');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -110,7 +111,7 @@
|
||||
const oldToken = sessionStorage.getItem(CONFIG.fcmTokenKey);
|
||||
|
||||
if (oldToken === newToken) {
|
||||
console.log('[FCM] Token unchanged, skip');
|
||||
log(' Token unchanged, skip');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -118,7 +119,7 @@
|
||||
|
||||
if (success) {
|
||||
sessionStorage.setItem(CONFIG.fcmTokenKey, newToken);
|
||||
console.log('[FCM] Token saved to sessionStorage');
|
||||
log(' Token saved to sessionStorage');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
console.log('[FCM] Token registered successfully');
|
||||
log(' Token registered successfully');
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -216,7 +217,7 @@
|
||||
const url = data.url;
|
||||
const soundKey = data.sound_key;
|
||||
|
||||
console.log('[FCM] Notification data:', { type, url, soundKey });
|
||||
log(' Notification data:', { type, url, soundKey });
|
||||
|
||||
// 1. 포그라운드에서만 사운드 재생 (백그라운드는 OS 채널 사운드)
|
||||
if (isAppForeground && soundKey) {
|
||||
@@ -299,7 +300,7 @@
|
||||
if (typeof showToast === 'function') {
|
||||
showToast(`${title}: ${body}`, 'info');
|
||||
}
|
||||
console.log('[FCM] showClickableToast not implemented, URL click ignored');
|
||||
log(' showClickableToast not implemented, URL click ignored');
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user