refactor: migrate post operations to use case architecture with differential updates
Migrate post-related operations from direct service/store calls to a new use case architecture featuring differential updates. Key changes include: (1) introduce ProcessPostUseCase to handle like, unlike, favorite, unfavorite, delete, and fetch operations with proper state management, (2) add useDifferentialPosts hook for efficient list rendering with minimal re-renders, (3) add PostDiffCalculator and PostUpdateBatcher in infrastructure layer for incremental updates, (4) deprecate NotificationItem component in favor of SystemMessageItem, (5) remove deprecated interactive methods from userStore, (6) add posts_cache table to local datasource, (7) clean up legacy MessageDTO and ConversationDTO types, (8) remove deprecated hook useBreakpointCheck, (9) refactor MessageBubble to use measureInWindow directly for better React Native compatibility
This commit is contained in:
@@ -671,32 +671,6 @@ class MessageService {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 兼容旧API的方法(将逐步废弃) ====================
|
||||
|
||||
/**
|
||||
* @deprecated 使用 getConversations 代替
|
||||
*/
|
||||
async getConversation(conversationId: string): Promise<ConversationDetailResponse | null> {
|
||||
try {
|
||||
return await this.getConversationById(conversationId);
|
||||
} catch (error) {
|
||||
console.error('获取会话详情失败:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 使用 createConversation(userId: string) 代替
|
||||
*/
|
||||
async createConversationByString(userId: string): Promise<ConversationResponse | null> {
|
||||
try {
|
||||
return await this.createConversation(userId);
|
||||
} catch (error) {
|
||||
console.error('创建会话失败:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 导出消息服务实例
|
||||
|
||||
Reference in New Issue
Block a user