Files
frontend/src/stores/message/index.ts
lafay 57d7c7405c
All checks were successful
Frontend CI / build-and-push-web (push) Successful in 2m29s
Frontend CI / ota-android (push) Successful in 10m35s
Frontend CI / build-android-apk (push) Successful in 37m48s
refactor(stores): reorganize flat store files into modular directory structure
Migrate from flat file organization to modular directory structure under src/stores/:

- auth/: authStore, registerStore, verificationStore, sessionStore
- call/: callStore
- settings/: chatSettingsStore, themeStore
- ui/: homeTabBarVisibilityStore, homeTabPressStore
- utils/: routePayloadCache
- group/sources.ts, group/profileResolver.ts
- message/sources.ts
- post/sources.ts

Update all import paths across components and screens to use new module paths. Maintain backward compatibility through deprecated re-export files for gradual migration.
2026-04-13 04:56:58 +08:00

117 lines
2.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 消息模块统一导出
*
* 重构说明:
* - 移除了 MessageStateManager 包装层
* - 直接使用 zustand store 进行状态管理
* - 服务层移至 services/ 目录
* - 新增 hooks.ts 封装常用逻辑
* - 移除了 SubscriptionManager改用 Zustand selector 进行响应式订阅
*/
// ==================== 主管理器 ====================
export { messageManager, MessageManager } from './MessageManager';
// ==================== 状态管理 ====================
export {
useMessageStore,
normalizeConversationId,
mergeMessagesById,
} from './store';
export type { MessageState, MessageActions, MessageStore } from './store';
// ==================== 类型导出 ====================
// 从 types.ts 导出所有类型
export type {
MessageManagerState,
ReadStateRecord,
MessageManagerConversationListDeps,
HandleNewMessageOptions,
IMessageDeduplication,
IUserCacheService,
IReadReceiptManager,
IConversationOperations,
IMessageSendService,
IMessageSyncService,
IWSMessageHandler,
} from './types';
// ==================== 常量导出 ====================
export {
READ_STATE_PROTECTION_DELAY,
PROCESSED_MESSAGE_ID_EXPIRY,
PROCESSED_MESSAGE_ID_MAX_SIZE,
MAX_FLUSH_ITERATIONS,
CONVERSATION_REFRESH_THROTTLE,
MIN_RECONNECT_SYNC_INTERVAL,
} from './constants';
// ==================== 服务导出 ====================
export {
// 消息去重服务
MessageDeduplication,
messageDeduplication,
// 用户缓存服务
UserCacheService,
userCacheService,
// 已读回执管理器
ReadReceiptManager,
// 会话操作服务
ConversationOperations,
// 消息发送服务
MessageSendService,
// 消息同步服务
MessageSyncService,
// WebSocket 消息处理器
WSMessageHandler,
} from './services';
// ==================== Hooks 导出(便捷版,使用 messageManager 单例) ====================
export {
// 会话相关
useConversations,
useConversation,
useCreateConversation,
useUpdateConversation,
// 消息相关
useMessages,
useSendMessage,
useMarkAsRead,
// 未读数相关
useUnreadCount,
useTotalUnreadCount,
useSystemUnreadCount,
// 群聊相关
useGroupTyping,
useGroupMuted,
// 通用
useMessageManager,
useMessageListRefresh,
useChat,
useMessageList,
} from './hooks';
// ==================== 数据源导出 ====================
export {
CONVERSATION_LIST_PAGE_SIZE,
type ConversationListPage,
type IConversationListPagedSource,
type RemoteConversationListSourceKind,
NetworkRemoteConversationListPagedSource,
SqliteConversationListPagedSource,
createRemoteConversationListSource,
} from './sources';
// ==================== 默认导出 ====================
export { default } from './MessageManager';