Refactor: 优化关注列表和代码逻辑

本次提交主要包含以下更改:

- **关注/粉丝列表逻辑修正**:修复了在 `FollowerListViewModel` 和 `FollowingListViewModel` 中 `followerId` 和 `followingId` 属性赋值错误的问题,确保正确加载关注和粉丝列表。
- **分页大小调整**:将 `BaseFollowModel` 中分页加载的 `pageSize` 从 5 调整为 20,以提高用户体验。
- **个人资料页智能体展示**:
    - 在 `AccountProfileV2` 和 `AccountProfileViewModel` 中增加了对用户智能体列表的加载和展示逻辑。
    - 修复了 `MyProfileViewModel` 中加载当前用户智能体时 `authorId` 传递错误的问题。
    - 优化了 `UserAgentsRow` 和 `UserAgentsViewModel` 的逻辑,确保正确加载和显示用户智能体,并在用户切换时清理旧数据。
- **代码清理**:移除了部分冗余的 `println` 调试信息。
- **Agent创建流程优化**:在 `AddAgentViewModel` 和 `AgentImageCropScreen` 中,确保在已有裁剪图片时直接使用,避免重复裁剪。
This commit is contained in:
2025-08-31 23:50:52 +08:00
parent 281169cfcb
commit 2907e7f9a6
15 changed files with 35 additions and 47 deletions

View File

@@ -36,12 +36,12 @@ open class BaseFollowModel:ViewModel() {
isLoading = true
viewModelScope.launch {
Pager(
config = PagingConfig(pageSize = 5, enablePlaceholders = false),
config = PagingConfig(pageSize = 20, enablePlaceholders = false),
pagingSourceFactory = {
AccountPagingSource(
userService,
followerId = followingId,
followingId = followerId
followerId = followerId,
followingId = followingId
)
}
).flow.cachedIn(viewModelScope).collectLatest {

View File

@@ -3,5 +3,5 @@ package com.aiosman.ravenow.ui.follower
class FollowerListViewModel(
val userId: Int
) : BaseFollowModel() {
override var followingId: Int? = userId
override var followerId: Int? = userId
}

View File

@@ -21,5 +21,5 @@ import kotlinx.coroutines.launch
class FollowingListViewModel(
val userId: Int
) : BaseFollowModel() {
override var followerId: Int? = userId
override var followingId: Int? = userId
}