feat: 更新CreateFeedFeature和FeedListFeature以增强发布和关闭功能
- 修改CreateFeedFeature中的发布逻辑,确保在发布成功时同时发送关闭通知。 - 更新FeedListFeature以在创建Feed成功时触发刷新并关闭编辑页面。 - 优化CreateFeedView中的键盘管理和通知处理,提升用户体验。
This commit is contained in:
@@ -83,9 +83,7 @@ struct CreateFeedFeature {
|
||||
newImages.append(image)
|
||||
}
|
||||
}
|
||||
await MainActor.run {
|
||||
send(.updateProcessedImages(newImages))
|
||||
}
|
||||
await send(.updateProcessedImages(newImages))
|
||||
}
|
||||
|
||||
case .updateProcessedImages(let images):
|
||||
@@ -239,17 +237,26 @@ struct CreateFeedFeature {
|
||||
return .none
|
||||
|
||||
case .dismissView:
|
||||
guard isPresented else {
|
||||
return .none
|
||||
}
|
||||
// 始终发送通知,让外层处理关闭逻辑
|
||||
return .run { _ in
|
||||
await dismiss()
|
||||
await MainActor.run {
|
||||
NotificationCenter.default.post(name: .init("CreateFeedDismiss"), object: nil)
|
||||
}
|
||||
}
|
||||
case .publishSuccess:
|
||||
// 发送通知给外层刷新列表
|
||||
return .run { _ in
|
||||
NotificationCenter.default.post(name: .init("CreateFeedPublishSuccess"), object: nil)
|
||||
}
|
||||
// 发送通知给外层刷新列表和关闭页面
|
||||
return .merge(
|
||||
.run { _ in
|
||||
await MainActor.run {
|
||||
NotificationCenter.default.post(name: .init("CreateFeedPublishSuccess"), object: nil)
|
||||
}
|
||||
},
|
||||
.run { _ in
|
||||
await MainActor.run {
|
||||
NotificationCenter.default.post(name: .init("CreateFeedDismiss"), object: nil)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user