diff --git a/public/js/fcm.js b/public/js/fcm.js
index 07133a9d..49a5c9a7 100644
--- a/public/js/fcm.js
+++ b/public/js/fcm.js
@@ -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');
};
}
diff --git a/resources/views/esign/create.blade.php b/resources/views/esign/create.blade.php
index b080c48d..83054b22 100644
--- a/resources/views/esign/create.blade.php
+++ b/resources/views/esign/create.blade.php
@@ -8,9 +8,7 @@
@endsection
@push('scripts')
-
-
-
+@include('partials.react-cdn')
@verbatim
@endverbatim
@endpush
diff --git a/resources/views/esign/dashboard.blade.php b/resources/views/esign/dashboard.blade.php
index 57b11fec..fd87204b 100644
--- a/resources/views/esign/dashboard.blade.php
+++ b/resources/views/esign/dashboard.blade.php
@@ -8,10 +8,8 @@
@endsection
@push('scripts')
-
-
-
-
+@include('partials.react-cdn')
+
@verbatim
@endverbatim
@endpush
diff --git a/resources/views/esign/detail.blade.php b/resources/views/esign/detail.blade.php
index 5379c1eb..b7e4bdbc 100644
--- a/resources/views/esign/detail.blade.php
+++ b/resources/views/esign/detail.blade.php
@@ -8,9 +8,7 @@
@endsection
@push('scripts')
-
-
-
+@include('partials.react-cdn')
@verbatim
@endverbatim
@endpush
diff --git a/resources/views/esign/fields.blade.php b/resources/views/esign/fields.blade.php
index 45c0c043..141be1ee 100644
--- a/resources/views/esign/fields.blade.php
+++ b/resources/views/esign/fields.blade.php
@@ -8,9 +8,7 @@
@endsection
@push('scripts')
-
-
-
+@include('partials.react-cdn')
@verbatim
@@ -249,7 +247,7 @@ className="border rounded px-2 py-1 text-xs" />
);
};
-ReactDOM.render(