Reduce noisy runtime logging in frontend flows.
This keeps chat, notification, and post interactions cleaner in production while preserving error-level visibility.
This commit is contained in:
@@ -68,7 +68,6 @@ class SystemNotificationService {
|
||||
}
|
||||
|
||||
if (finalStatus !== 'granted') {
|
||||
console.log('[SystemNotification] 通知权限未授权');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -100,7 +99,6 @@ class SystemNotificationService {
|
||||
});
|
||||
|
||||
this.isInitialized = true;
|
||||
console.log('[SystemNotification] 通知服务初始化成功');
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('[SystemNotification] 初始化失败:', error);
|
||||
@@ -138,7 +136,6 @@ class SystemNotificationService {
|
||||
trigger: null, // null 表示立即显示
|
||||
});
|
||||
|
||||
console.log('[SystemNotification] 通知已显示:', notificationId);
|
||||
return notificationId;
|
||||
} catch (error) {
|
||||
console.error('[SystemNotification] 显示通知失败:', error);
|
||||
@@ -182,23 +179,20 @@ class SystemNotificationService {
|
||||
}
|
||||
|
||||
async handleWSMessage(message: WSChatMessage | WSNotificationMessage | WSAnnouncementMessage): Promise<void> {
|
||||
console.log('[SystemNotification] handleWSMessage 被调用, 当前AppState:', this.currentAppState);
|
||||
|
||||
// 仅在后台时显示通知,前台时不显示(用户正在使用应用,可以直接看到消息)
|
||||
if (this.currentAppState !== 'active') {
|
||||
// 判断是否是聊天消息(通过 segments 字段)
|
||||
if ('segments' in message) {
|
||||
const chatMsg = message as WSChatMessage;
|
||||
const body = extractTextFromSegments(chatMsg.segments);
|
||||
console.log('[SystemNotification] 后台模式 - 显示聊天通知:', chatMsg.id, body);
|
||||
void chatMsg;
|
||||
void body;
|
||||
await this.showChatNotification(chatMsg);
|
||||
} else {
|
||||
const notifMsg = message as WSNotificationMessage | WSAnnouncementMessage;
|
||||
console.log('[SystemNotification] 后台模式 - 显示系统通知:', notifMsg.id, notifMsg.content);
|
||||
void notifMsg;
|
||||
await this.showWSNotification(notifMsg);
|
||||
}
|
||||
} else {
|
||||
console.log('[SystemNotification] 前台模式 - 不显示通知');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user