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
114 lines
2.8 KiB
TypeScript
114 lines
2.8 KiB
TypeScript
/**
|
|
* Hooks 导出
|
|
*/
|
|
|
|
// ==================== 新的响应式 Hooks (推荐) ====================
|
|
export {
|
|
// 核心 hooks
|
|
useBreakpoint,
|
|
useFineBreakpoint,
|
|
useBreakpointGTE,
|
|
useBreakpointLT,
|
|
useBreakpointBetween,
|
|
useScreenSize,
|
|
useWindowDimensions,
|
|
useOrientation,
|
|
usePlatform,
|
|
useMediaQuery,
|
|
useResponsiveValue,
|
|
useResponsiveStyle,
|
|
useColumnCount,
|
|
useResponsiveSpacing,
|
|
// 兼容层
|
|
useResponsive,
|
|
useLegacyResponsive,
|
|
// 工具函数
|
|
getBreakpoint,
|
|
getFineBreakpoint,
|
|
isBreakpointGTE,
|
|
isBreakpointLT,
|
|
isBreakpointBetween,
|
|
// 常量
|
|
BREAKPOINTS,
|
|
FINE_BREAKPOINTS,
|
|
} from '../presentation/hooks/responsive';
|
|
|
|
export type {
|
|
BreakpointKey,
|
|
FineBreakpointKey,
|
|
BreakpointValue,
|
|
ResponsiveValue,
|
|
Orientation,
|
|
PlatformInfo,
|
|
ScreenSize,
|
|
MediaQueryOptions,
|
|
// 兼容层类型
|
|
ResponsiveInfo,
|
|
} from '../presentation/hooks/responsive';
|
|
|
|
// ==================== 旧版响应式 Hooks (保持向后兼容) ====================
|
|
// 注意:这些导出将在未来版本中移除,请使用新的 hooks
|
|
export {
|
|
BREAKPOINTS as BREAKPOINTS_OLD,
|
|
FINE_BREAKPOINTS as FINE_BREAKPOINTS_OLD,
|
|
} from './useResponsive';
|
|
|
|
export type {
|
|
ResponsiveInfo as ResponsiveInfo_OLD,
|
|
BreakpointKey as BreakpointKey_OLD,
|
|
BreakpointValue as BreakpointValue_OLD,
|
|
FineBreakpointKey as FineBreakpointKey_OLD,
|
|
ResponsiveValue as ResponsiveValue_OLD,
|
|
} from './useResponsive';
|
|
|
|
// ==================== 其他 Hooks ====================
|
|
export {
|
|
usePrefetch,
|
|
prefetchPosts,
|
|
prefetchConversations,
|
|
prefetchUserInfo,
|
|
prefetchOnAppLaunch,
|
|
prefetchMessageScreen,
|
|
prefetchHomeScreen,
|
|
} from './usePrefetch';
|
|
|
|
// ==================== 分页 Hooks ====================
|
|
export {
|
|
usePagination,
|
|
usePaginationManager,
|
|
} from './usePagination';
|
|
|
|
export type {
|
|
UsePaginationOptions,
|
|
UsePaginationReturn,
|
|
} from './usePagination';
|
|
|
|
// ==================== 游标分页 Hooks ====================
|
|
export { useCursorPagination } from './useCursorPagination';
|
|
|
|
// ==================== 连接状态 Hooks ====================
|
|
export { useConnectionState } from './useConnectionState';
|
|
|
|
export type { UseConnectionStateResult } from './useConnectionState';
|
|
|
|
// ==================== 媒体缓存 Hooks ====================
|
|
export { useMediaCache } from './useMediaCache';
|
|
|
|
export type { UseMediaCacheReturn } from './useMediaCache';
|
|
|
|
// ==================== 差异更新 Hooks ====================
|
|
export { useDifferentialMessages } from './useDifferentialMessages';
|
|
|
|
export type {
|
|
UseDifferentialMessagesOptions,
|
|
UseDifferentialMessagesResult,
|
|
} from './useDifferentialMessages';
|
|
|
|
export { useDifferentialPosts } from './useDifferentialPosts';
|
|
|
|
export type {
|
|
UseDifferentialPostsOptions,
|
|
UseDifferentialPostsResult,
|
|
DiffUpdatesInfo,
|
|
} from './useDifferentialPosts';
|