feat(Dependencies): add new libraries for enhanced functionality and update existing ones
Some checks failed
Frontend CI / ota-android (push) Successful in 11m11s
Frontend CI / build-and-push-web (push) Successful in 11m41s
Frontend CI / build-android-apk (push) Has been cancelled

- Added `katex`, `markdown-it`, and `prismjs` for improved rendering of mathematical expressions and markdown content.
- Included `react-native-webview` to support web content within the app.
- Updated package versions in `package-lock.json` and `package.json` for better compatibility and performance.
- Refactored notification handling in `sseService` and `systemNotificationService` to improve user experience with vibration feedback.
- Introduced buffering for SSE messages in `messageManager` to prevent race conditions during initialization.
This commit is contained in:
lafay
2026-03-25 16:09:43 +08:00
parent 4ee3079b9f
commit f875b417c8
5 changed files with 225 additions and 15 deletions

View File

@@ -4,8 +4,6 @@ import EventSource from 'react-native-sse';
import { api, SSE_URL } from './api';
import { MessageCategory, SystemMessageType, SystemMessageExtraData, MessageSegment } from '../types/dto';
import { systemNotificationService } from './systemNotificationService';
import { getNotificationPreferencesSync } from './notificationPreferences';
import { vibrateOnMessage } from './messageVibrationService';
export type WSMessageType =
| 'chat'
@@ -280,7 +278,6 @@ class SSEService {
created_at: m.created_at || new Date().toISOString(),
};
this.emit('group_message', gm);
vibrateOnMessage('group_message').catch(() => {});
} else {
const cm: WSChatMessage = {
type: 'chat',
@@ -292,7 +289,6 @@ class SSEService {
created_at: m.created_at || new Date().toISOString(),
};
this.emit('chat', cm);
vibrateOnMessage('chat').catch(() => {});
}
return;
}
@@ -385,9 +381,6 @@ class SSEService {
created_at: payload.created_at || new Date().toISOString(),
};
this.emit('notification', m);
if (getNotificationPreferencesSync().pushEnabled) {
vibrateOnMessage('notification').catch(() => {});
}
systemNotificationService.handleWSMessage(m as any).catch(() => {});
}
}

View File

@@ -9,6 +9,7 @@ import { Platform, AppState, AppStateStatus } from 'react-native';
import type { WSChatMessage, WSNotificationMessage, WSAnnouncementMessage } from './sseService';
import { extractTextFromSegments } from '../types/dto';
import { getNotificationPreferencesSync } from './notificationPreferences';
import { vibrateOnMessage } from './messageVibrationService';
// 通知渠道配置
const CHANNEL_ID = 'default';
@@ -185,6 +186,8 @@ class SystemNotificationService {
} else {
const notifMsg = message as WSNotificationMessage | WSAnnouncementMessage;
void notifMsg;
// 系统通知只在后台显示,因此震动也在该分支触发
vibrateOnMessage('notification').catch(() => {});
await this.showWSNotification(notifMsg);
}
}