增加智能体头像裁剪页面
- 新增 `AgentImageCropScreen.kt` 用于智能体头像的裁剪和预览。 - 调整导航逻辑,添加智能体时跳转到新的 `AgentImageCrop` 路由。 - 原有的 `ImageCropScreen` 专门用于处理个人资料头像的裁剪。 - `AddAgentViewModel` 中移除 `isFromAddAgent` 标志,通过不同的导航路由区分头像裁剪来源。
This commit is contained in:
@@ -114,23 +114,13 @@ fun ImageCropScreen() {
|
||||
imageCrop?.let {
|
||||
val bitmap = it.onCrop()
|
||||
println("ImageCrop: Cropped bitmap created: ${bitmap != null}")
|
||||
if (AddAgentViewModel.isFromAddAgent) {
|
||||
println("ImageCrop: Setting bitmap to AddAgentViewModel")
|
||||
// 如果是从AddAgent页面跳转过来的
|
||||
AddAgentViewModel.croppedBitmap = bitmap
|
||||
AddAgentViewModel.viewModelScope.launch {
|
||||
AddAgentViewModel.updateAgentAvatar(context)
|
||||
AddAgentViewModel.isFromAddAgent = false
|
||||
navController.popBackStack()
|
||||
}
|
||||
} else {
|
||||
println("ImageCrop: Setting bitmap to AccountEditViewModel")
|
||||
// 默认处理AccountEdit
|
||||
AccountEditViewModel.croppedBitmap = bitmap
|
||||
AccountEditViewModel.viewModelScope.launch {
|
||||
AccountEditViewModel.updateUserProfile(context)
|
||||
navController.popBackStack()
|
||||
}
|
||||
|
||||
// 专门处理个人资料头像
|
||||
println("ImageCrop: Setting bitmap to AccountEditViewModel for user profile")
|
||||
AccountEditViewModel.croppedBitmap = bitmap
|
||||
AccountEditViewModel.viewModelScope.launch {
|
||||
AccountEditViewModel.updateUserProfile(context)
|
||||
navController.popBackStack()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user