fix: streamline AI retouch submission feedback

This commit is contained in:
2026-08-14 15:46:17 +08:00
parent 30bfe0313f
commit 83afcb6deb
6 changed files with 56 additions and 48 deletions
@@ -731,7 +731,7 @@ private final class AIJobDetailTargetRow: UIView {
make.height.equalTo(28)
}
errorContainer.snp.makeConstraints { make in
make.top.equalTo(thumbnailView.snp.bottom).offset(10)
make.top.equalTo(templateLabel.snp.bottom).offset(12)
make.leading.equalTo(titleLabel)
make.trailing.equalToSuperview().inset(4)
make.bottom.equalToSuperview().inset(12)
@@ -781,7 +781,11 @@ private final class AIJobDetailTargetRow: UIView {
let showsError = target.displayFailureMessage != nil
errorContainer.isHidden = !showsError
errorContainer.snp.remakeConstraints { make in
make.top.equalTo(thumbnailView.snp.bottom).offset(showsError ? 10 : 0)
if showsError {
make.top.equalTo(templateLabel.snp.bottom).offset(12)
} else {
make.top.equalTo(thumbnailView.snp.bottom)
}
make.leading.equalTo(titleLabel)
make.trailing.equalToSuperview().inset(4)
make.bottom.equalToSuperview().inset(12)
@@ -458,29 +458,14 @@ final class TravelAlbumDetailViewController: BaseViewController {
materialIds: materialIds
),
api: api,
onSubmitted: { [weak self] submission in
guard let self else { return }
self.viewModel.completeAIRetouchSubmission()
self.presentAIRetouchSubmitted(submission)
}
onSubmitted: { [weak self] _ in self?.handleAIRetouchSubmitted() }
)
present(controller, animated: true)
}
private func presentAIRetouchSubmitted(_ submission: TravelAlbumAIJobSubmission) {
let alert = UIAlertController(
title: "AI修图任务已提交",
message: "完成后将通过消息通知,你也可以随时查看处理进度。",
preferredStyle: .alert
)
alert.addAction(UIAlertAction(title: "稍后查看", style: .cancel))
alert.addAction(UIAlertAction(title: "查看任务", style: .default) { [weak self] _ in
self?.navigationController?.pushViewController(
TravelAlbumAIJobDetailViewController(batchId: submission.aiRetouchBatchId),
animated: true
)
})
present(alert, animated: true)
private func handleAIRetouchSubmitted() {
showToast("AI修图任务已提交,完成后将通过消息通知")
Task { await viewModel.refreshAfterAIRetouchSubmission(api: api) }
}
@objc private func deleteSelectedTapped() {
@@ -533,7 +518,8 @@ final class TravelAlbumDetailViewController: BaseViewController {
},
onProjectDeleted: { materialId in
previewViewModel.removeMaterialAfterPreviewDeletion(id: materialId)
}
},
onAIRetouchSubmitted: { [weak self] in self?.handleAIRetouchSubmitted() }
)
present(controller, animated: true)
}
@@ -25,6 +25,7 @@ final class TravelAlbumPhotoPreviewViewController: UIViewController {
private let loadMore: TravelAlbumPreviewLoadMore?
private let reload: TravelAlbumPreviewReload?
private let onProjectDeleted: ((Int) -> Void)?
private let onAIRetouchSubmitted: (() -> Void)?
private let allowsActions: Bool
private var nodes: [TravelAlbumPreviewNode] = []
private var currentNodeIndex = 0
@@ -73,7 +74,8 @@ final class TravelAlbumPhotoPreviewViewController: UIViewController {
aiRetouchAPI: (any TravelAlbumServing)? = nil,
loadMore: TravelAlbumPreviewLoadMore? = nil,
reload: TravelAlbumPreviewReload? = nil,
onProjectDeleted: ((Int) -> Void)? = nil
onProjectDeleted: ((Int) -> Void)? = nil,
onAIRetouchSubmitted: (() -> Void)? = nil
) {
self.projects = Self.deduplicated(projects)
self.totalCount = max(totalCount, projects.count)
@@ -85,6 +87,7 @@ final class TravelAlbumPhotoPreviewViewController: UIViewController {
self.loadMore = loadMore
self.reload = reload
self.onProjectDeleted = onProjectDeleted
self.onAIRetouchSubmitted = onAIRetouchSubmitted
self.allowsActions = allowsActions
super.init(nibName: nil, bundle: nil)
modalPresentationStyle = .fullScreen
@@ -726,34 +729,14 @@ final class TravelAlbumPhotoPreviewViewController: UIViewController {
workflow: workflow
),
api: aiRetouchAPI,
onSubmitted: { [weak self] submission in
onSubmitted: { [weak self] _ in
guard let self else { return }
self.reloadProjects(showGlobalLoading: false, forceRefreshImage: false)
self.presentAIRetouchSubmitted(submission)
self.dismiss(animated: true) { self.onAIRetouchSubmitted?() }
}
)
present(controller, animated: true)
}
private func presentAIRetouchSubmitted(_ submission: TravelAlbumAIJobSubmission) {
let alert = UIAlertController(
title: "AI修图任务已提交",
message: "完成后将通过消息通知。",
preferredStyle: .alert
)
alert.addAction(UIAlertAction(title: "知道了", style: .cancel))
alert.addAction(UIAlertAction(title: "查看任务", style: .default) { [weak self] _ in
guard let self, let navigationController = presentingViewController?.navigationController else { return }
dismiss(animated: true) {
navigationController.pushViewController(
TravelAlbumAIJobDetailViewController(batchId: submission.aiRetouchBatchId),
animated: true
)
}
})
present(alert, animated: true)
}
@objc private func deleteTapped() {
guard currentProject != nil, !isDeletingProject else { return }
let alert = UIAlertController(