feat: 更新CreateFeedFeature和CreateFeedView以增强发布功能
- 修改发布逻辑,允许在内容为空时仍可发布图片,提升用户灵活性。 - 更新错误提示信息,明确用户需要输入内容或选择图片。 - 调整发布按钮显示逻辑,仅在键盘隐藏时显示,优化界面布局。 - 增加工具栏标题,提升用户界面友好性。 - 优化发布按钮样式,增加圆角和渐变背景,提升视觉效果。
This commit is contained in:
@@ -16,7 +16,7 @@ struct CreateFeedFeature {
|
||||
processedImages.count < 9
|
||||
}
|
||||
var canPublish: Bool {
|
||||
!content.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty && !isLoading
|
||||
(!content.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || !processedImages.isEmpty) && !isLoading
|
||||
}
|
||||
var isLoading: Bool = false
|
||||
|
||||
@@ -108,7 +108,7 @@ struct CreateFeedFeature {
|
||||
|
||||
case .publishButtonTapped:
|
||||
guard state.canPublish else {
|
||||
state.errorMessage = "请输入内容"
|
||||
state.errorMessage = "请输入内容或选择图片"
|
||||
return .none
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ struct CreateFeedFeature {
|
||||
let userId = await UserInfoManager.getCurrentUserId() ?? ""
|
||||
let type = resList.isEmpty ? "0" : "2" // 0: 纯文字, 2: 图片
|
||||
let request = await PublishFeedRequest.make(
|
||||
content: content,
|
||||
content: content.isEmpty ? "" : content,
|
||||
uid: userId,
|
||||
type: type,
|
||||
resList: resList.isEmpty ? nil : resList
|
||||
|
Reference in New Issue
Block a user