Commit Graph

170 Commits

Author SHA1 Message Date
lafay
de94447844 fix(frontend): 修复 TypeScript 类型错误,与后端 API 响应结构对齐
Some checks failed
Frontend CI / build-android-apk (push) Has been cancelled
Frontend CI / build-and-push-web (push) Has been cancelled
Frontend CI / ota-android (push) Has been cancelled
- 修复 UserDTO 类型定义,字段改为非 nullable 类型
- 修复 PostMapper 使用正确的 snake_case 字段名
- 修复 UserMapper 移除不存在的 is_blocked 和 updated_at 字段
- 修复 MessageMapper 使用 segments 替代已移除的字段
- 修复 MessageSyncService 正确处理 API 响应类型
- 修复 LocalDataSource SQLite 参数类型问题
- 修复导航相关类型错误
- 修复 PostDetailScreen 和 EditProfileScreen 的 null/undefined 类型不匹配
2026-03-19 10:53:09 +08:00
lan
a91637466c refactor(messaging): replace WebSocket with SSE for real-time message handling
Some checks failed
Frontend CI / build-android-apk (push) Has been cancelled
Frontend CI / build-and-push-web (push) Has been cancelled
Frontend CI / ota-android (push) Has been cancelled
Frontend CI / ota-android (pull_request) Has been skipped
Frontend CI / build-and-push-web (pull_request) Has been cancelled
Frontend CI / build-android-apk (pull_request) Has been cancelled
Replace WebSocket-based real-time communication with Server-Sent Events (SSE) across the messaging infrastructure. This includes:

- Create new SSEClient datasource to manage SSE connections
- Create new SSEMessageHandler to process SSE events
- Update ProcessMessageUseCase to use SSEClient instead of WebSocketClient
- Update MessageManager and MessageStateManager to work with SSE handlers
- Rename connection state variables from `isWebSocketConnected` to `isSSEConnected`
- Update type definitions in dto.ts (WSEventType → SSEEventType, etc.)
- Delete obsolete WebSocketClient and WebSocketMessageHandler files
- Update comments and documentation to reflect SSE terminology

This refactoring aligns with the backend's SSE implementation for better compatibility with React Native's networking capabilities.
2026-03-19 00:56:41 +08:00
lafay
62b55aec31 feat(infrastructure): add pagination, cache, and sync infrastructure
All checks were successful
Frontend CI / ota-android (push) Successful in 14m38s
Frontend CI / build-android-apk (push) Successful in 1h0m2s
Frontend CI / build-and-push-web (push) Successful in 10m29s
- Add pagination infrastructure with usePagination and usePaginationManager hooks
- Add connection state management hook for network status tracking
- Add media caching infrastructure with useMediaCache hook
- Add differential message synchronization infrastructure
- Export new hooks from central index file
- Remove backup file MainNavigator.tsx.bak
2026-03-18 23:05:28 +08:00
lafay
a9c514f664 fix(post): prevent duplicate submission and fix navigation after posting
All checks were successful
Frontend CI / ota-android (push) Successful in 13m26s
Frontend CI / build-android-apk (push) Successful in 54m22s
Frontend CI / build-and-push-web (push) Successful in 10m44s
- add guard clause to prevent duplicate clicks when posting is in progress
- replace navigation.goBack() with navigation.reset to Main screen for cleaner navigation stack after post creation, update, and voting post submission
2026-03-18 21:09:55 +08:00
lafay
2321c2dc06 refactor(navigation): replace direct navigation with navigation service
Some checks failed
Frontend CI / ota-android (push) Has been cancelled
Frontend CI / build-android-apk (push) Has been cancelled
Frontend CI / build-and-push-web (push) Has been cancelled
Replace direct `navigation.navigate()` and `navigation.getParent()?.navigate()` calls with centralized `navigationService.navigate()` across multiple screens. Convert screen component functions from JSX elements to array-returning functions in RootNavigator to fix React key warnings and improve render consistency.

- HomeScreen: use navigationService for post and user navigation
- PrivateChatInfoScreen: use navigationService for profile navigation
- ChatScreen: use navigationService for avatar press and user profile navigation
- RootNavigator: convert PublicScreens and AuthenticatedScreens to getPublicScreens() and getAuthenticatedScreens() functions returning arrays with proper keys
2026-03-18 14:52:58 +08:00
lafay
937e8112f4 fix: 修复安卓端帖子卡片点击事件冲突问题
Some checks failed
Frontend CI / ota-android (push) Failing after 4m51s
Frontend CI / build-and-push-web (push) Has been cancelled
Frontend CI / build-android-apk (push) Has been cancelled
- 为嵌套TouchableOpacity添加stopPropagation防止事件冒泡
- 修复grid模式下图片和用户头像点击事件
- 修复列表模式下所有交互按钮点击事件
- 优化手势配置添加shouldCancelWhenOutside
2026-03-18 14:21:24 +08:00
lafay
a6cdb97e24 refactor: 架构重构 - 解耦过度耦合模块
主要改动:
1. 创建乐观更新工具函数 (optimisticUpdate.ts)
   - 消除 userStore.ts 中的重复代码

2. 拆分 useResponsive.ts (485行 -> 12个专注模块)
   - useBreakpoint: 断点检测
   - useOrientation: 方向检测
   - usePlatform: 平台检测
   - useScreenSize: 屏幕尺寸
   - useResponsiveValue: 响应式值
   - useResponsiveStyle: 响应式样式
   - useMediaQuery: 媒体查询
   - useColumnCount: 列数计算
   - useResponsiveSpacing: 响应式间距

3. 整理数据层 (Repository 层)
   - ApiDataSource: API数据源
   - LocalDataSource: 本地数据源
   - CacheDataSource: 缓存数据源
   - MessageRepository: 消息仓库

4. 重构 messageManager.ts (2194行 -> 4个模块)
   - MessageStateManager: 状态管理
   - WebSocketMessageHandler: WebSocket处理
   - MessageSyncService: 消息同步
   - ReadReceiptManager: 已读管理

5. 导航解耦 (MainNavigator.tsx: 1118行 -> 100行)
   - 创建 NavigationService 解耦层
   - 拆分多个 Navigator 组件

架构改进:
- 单一职责原则: 每个模块职责明确
- 依赖倒置: 通过接口解耦
- 代码复用: 工具函数可被多处使用
- 可测试性: 各模块可独立测试
2026-03-18 12:11:49 +08:00
lafay
1ffbb63753 fix: 统一修复所有屏幕的安全区域问题
Some checks failed
Frontend CI / ota-android (push) Successful in 10m56s
Frontend CI / build-android-apk (push) Failing after 33m45s
Frontend CI / build-and-push-web (push) Failing after 46s
- 有 header 的屏幕使用 edges={['bottom']}(React Navigation 自动处理顶部)
- 没有 header 的屏幕使用 edges={['top', 'bottom']}(需要自己处理顶部)
- 修复了以下屏幕:
  - HomeScreen: edges={['bottom']} → ['top', 'bottom']
  - MessageListScreen: edges={['top']} → ['top', 'bottom']
  - ScheduleScreen: edges={['top']} → ['top', 'bottom']
  - ProfileScreen: edges={['top', 'bottom']} ✓ 已正确
  - PostDetailScreen: 空状态添加 edges={['bottom']}
  - UserScreen: 空状态添加 edges={['bottom']}
  - NotificationsScreen: edges={[]} → ['bottom']
  - SearchScreen: edges={['left', 'right']} → ['bottom']
  - BlockedUsersScreen: 加载状态添加 edges={['bottom']}
  - GroupInfoScreen: edges={['bottom']} ✓ 已正确
  - PrivateChatInfoScreen: 加载状态添加 edges={['bottom']}
2026-03-18 10:58:41 +08:00
lafay
e230e35ca2 fix: 修复安卓端发帖界面未避让状态栏的问题
Some checks failed
Frontend CI / ota-android (push) Successful in 10m53s
Frontend CI / build-android-apk (push) Failing after 10m15s
Frontend CI / build-and-push-web (push) Failing after 3m28s
2026-03-18 10:22:41 +08:00
71b4f8a679 修复了课程表和发帖按钮 2026-03-18 00:25:46 +08:00
b50bd9abb3 修复了课表周数硬编码 2026-03-17 12:29:04 +08:00
582589d252 Merge remote-tracking branch 'origin/master' into feature/adap-pc 2026-03-16 19:27:05 +08:00
cb2087f779 PC端的部分适配 2026-03-16 17:47:10 +08:00
lan
592167e667 feat: 优化图片加载和展示功能
- 新增 SmartImage 组件优化图片加载体验
- 新增 ImageGrid 组件支持多图布局展示
- 新增 imageHelper 工具函数
- 优化 PostCard 帖子卡片图片展示
- 优化消息页面 SegmentRenderer
- 优化日程页面 ScheduleScreen
- 优化上传服务 uploadService
2026-03-15 02:25:55 +08:00
lan
e9d42fdb01 feat(schedule): add academic system sync and course management improvements
- add educational system synchronization with username/password authentication
- implement long-press course deletion with single/all options
- add multi-lane course display for overlapping same-name courses
- refactor course detail screen with ScrollView and improved layout
- fix teacher display to show per-time-slot instructors instead of single field
- add settings modal with sync option and loading states
2026-03-13 20:40:32 +08:00
lan
798dd7c9a0 feat(navigation): add schedule tab and stack navigator
Add new ScheduleTab to main navigation with ScheduleStackNavigator for managing course schedule screens. Includes CourseDetailScreen with modal presentation. Also exports scheduleService and related types for the new schedule feature.

fix(message): add group_id parameter to invite and request handlers

Pass group_id from extra_data when calling respondInvite and reviewJoinRequest APIs, as the backend now requires this parameter.

refactor(message): extract mergeMessagesById helper method

Centralize message merging logic into a reusable private method to avoid duplication and ensure consistent message deduplication behavior.
2026-03-12 08:37:08 +08:00
lan
f10c9cc1d7 Switch frontend group and conversation requests to RESTful endpoints.
Update service API paths and message reply payload handling to match the backend route changes.

Made-with: Cursor
2026-03-10 20:52:50 +08:00
lan
be84c01abd Migrate frontend realtime messaging to SSE.
Switch service integrations and screen/store consumers from websocket events to SSE, and ignore generated dist-web artifacts.

Made-with: Cursor
2026-03-10 12:58:23 +08:00
lan
63e32b15a3 Reduce noisy runtime logging in frontend flows.
This keeps chat, notification, and post interactions cleaner in production while preserving error-level visibility.
2026-03-09 22:20:44 +08:00
lan
3968660048 Initial frontend repository commit.
Include app source and update .gitignore to exclude local release artifacts and signing files.

Made-with: Cursor
2026-03-09 21:29:03 +08:00