expo-popcore-app/hooks
imeepos bf11241d68 feat: 实现用户名和头像编辑功能
使用 Better Auth 的 updateUser API 更新用户信息,使用 SDK 的 FileController 上传头像。

## 新增功能
- 创建 useUpdateProfile hook 处理用户信息更新
- 支持选择图片上传头像(使用 expo-image-picker)
- 先上传头像到 S3,再更新用户信息

## 更新文件
- lib/auth.ts: 导出 updateUser 方法
- hooks/use-update-profile.ts: 新建更新资料 hook
- hooks/index.ts: 导出 useUpdateProfile
- components/drawer/EditProfileDrawer.tsx:
  - 添加头像选择功能(点击相机按钮)
  - 调用 updateProfile API 保存更改
  - 添加加载状态和禁用状态
  - 更新 onSave 回调参数类型
- app/(tabs)/my.tsx:
  - 传递 initialAvatar 给编辑抽屉
  - 显示用户真实头像(如有)
  - 更新 onSave 回调处理

## 功能流程
1. 点击相机按钮选择图片
2. 调用 uploadFile 上传到 S3
3. 调用 updateUser 更新用户信息
4. 保存成功后刷新 session

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 19:42:13 +08:00
..
CLAUDE.md Initial commit: expo-popcore-app 2025-12-25 16:25:55 +08:00
REVIEW.md docs: add hooks review and finalize task plan 2026-01-21 12:22:02 +08:00
index.ts feat: 实现用户名和头像编辑功能 2026-01-23 19:42:13 +08:00
use-activates.ts refactor: 优化代码和添加类型检查脚本 2026-01-16 12:34:27 +08:00
use-announcement-actions.test.ts feat: add announcement action hooks with TDD 2026-01-21 14:53:03 +08:00
use-announcement-actions.ts feat: add announcement action hooks with TDD 2026-01-21 14:53:03 +08:00
use-announcement-unread-count.test.ts feat: add announcement action hooks with TDD 2026-01-21 14:53:03 +08:00
use-announcement-unread-count.ts feat: add announcement action hooks with TDD 2026-01-21 14:53:03 +08:00
use-announcements.test.ts feat: add use-announcements hook with TDD 2026-01-21 14:44:16 +08:00
use-announcements.ts feat: add use-announcements hook with TDD 2026-01-21 14:44:16 +08:00
use-categories.test.ts fix: 修复 use-categories 测试中的 TypeScript 类型错误 2026-01-19 11:45:25 +08:00
use-categories.ts fix: 修复 Jest 测试配置和 useCategories hook 实现 2026-01-19 11:46:51 +08:00
use-change-password.ts feat: 实现 API 接口对接功能 (删除作品、作品搜索、修改密码) 2026-01-23 19:15:24 +08:00
use-color-scheme.ts Initial commit: expo-popcore-app 2025-12-25 16:25:55 +08:00
use-color-scheme.web.ts Initial commit: expo-popcore-app 2025-12-25 16:25:55 +08:00
use-debounce.ts feat: integrate UI components into Search pages with pagination and loading 2026-01-21 12:20:11 +08:00
use-error.ts feat: 对接 templateDetail 页面后端接口 2026-01-16 11:56:38 +08:00
use-message-actions.test.ts feat: add message action hooks with TDD 2026-01-21 14:48:27 +08:00
use-message-actions.ts feat: add message action hooks with TDD 2026-01-21 14:48:27 +08:00
use-message-unread-count.test.ts feat: add message action hooks with TDD 2026-01-21 14:48:27 +08:00
use-message-unread-count.ts feat: add message action hooks with TDD 2026-01-21 14:48:27 +08:00
use-messages.test.ts refactor: migrate use-messages hook to MessageController with TDD 2026-01-21 14:41:47 +08:00
use-messages.ts fix: change type parameter from array to single value for API compatibility 2026-01-21 15:15:47 +08:00
use-resource.tsx Initial commit: expo-popcore-app 2025-12-25 16:25:55 +08:00
use-search-history.ts fix: bug 2026-01-16 15:16:49 +08:00
use-tags.ts fix: 修复所有 TypeScript 类型错误 2026-01-16 14:14:05 +08:00
use-template-actions.test.ts feat: add retry functionality to use-template-actions hook 2026-01-21 12:00:07 +08:00
use-template-actions.ts feat: add retry functionality to use-template-actions hook 2026-01-21 12:00:07 +08:00
use-template-detail.test.ts test: add comprehensive tests for use-template-detail hook 2026-01-21 11:57:17 +08:00
use-template-detail.ts feat: 对接 templateDetail 页面后端接口 2026-01-16 11:56:38 +08:00
use-template-generation-actions.ts feat: 实现 API 接口对接功能 (删除作品、作品搜索、修改密码) 2026-01-23 19:15:24 +08:00
use-template-generations.ts refactor: 优化代码和添加类型检查脚本 2026-01-16 12:34:27 +08:00
use-templates.test.ts test: verify use-templates hook has complete functionality 2026-01-21 11:54:34 +08:00
use-templates.ts fix: bug 2026-01-16 15:16:49 +08:00
use-theme-color.ts Initial commit: expo-popcore-app 2025-12-25 16:25:55 +08:00
use-update-profile.ts feat: 实现用户名和头像编辑功能 2026-01-23 19:42:13 +08:00
use-works-search.ts fix: 移除对 @tanstack/react-query 的依赖,使用项目现有 hooks 模式 2026-01-23 19:26:24 +08:00
useWorksList.test.ts feat: integrate UI components into Works List with pagination and refresh 2026-01-21 12:15:53 +08:00
useWorksList.ts feat: integrate UI components into Works List with pagination and refresh 2026-01-21 12:15:53 +08:00