feat: add AI retouch task center

This commit is contained in:
2026-08-14 15:06:57 +08:00
parent 0f3b26991e
commit 30bfe0313f
26 changed files with 3679 additions and 50 deletions
@@ -25,6 +25,7 @@ final class TravelAlbumPhotoPreviewViewController: UIViewController {
private let loadMore: TravelAlbumPreviewLoadMore?
private let reload: TravelAlbumPreviewReload?
private let onProjectDeleted: ((Int) -> Void)?
private let allowsActions: Bool
private var nodes: [TravelAlbumPreviewNode] = []
private var currentNodeIndex = 0
private var dragStartIndex = 0
@@ -63,6 +64,8 @@ final class TravelAlbumPhotoPreviewViewController: UIViewController {
projects: [TravelAlbumPreviewProject],
totalCount: Int,
startProjectIndex: Int,
startKind: TravelAlbumPreviewAssetKind = .original,
allowsActions: Bool = true,
configuration: TravelAlbumPreviewConfiguration = .init(),
actionHandler: any TravelAlbumPreviewActionHandling = PlaceholderTravelAlbumPreviewActionHandler(),
albumId: Int = 0,
@@ -82,9 +85,10 @@ final class TravelAlbumPhotoPreviewViewController: UIViewController {
self.loadMore = loadMore
self.reload = reload
self.onProjectDeleted = onProjectDeleted
self.allowsActions = allowsActions
super.init(nibName: nil, bundle: nil)
modalPresentationStyle = .fullScreen
rebuildNodes(keepingProjectIndex: max(0, min(startProjectIndex, projects.count - 1)), kind: .original)
rebuildNodes(keepingProjectIndex: max(0, min(startProjectIndex, projects.count - 1)), kind: startKind)
}
@available(*, unavailable)
@@ -196,6 +200,7 @@ final class TravelAlbumPhotoPreviewViewController: UIViewController {
configureHighResolutionButton()
configureComparisonButton()
configureActions()
actionStack.isHidden = !allowsActions
let titleStack = UIStackView(arrangedSubviews: [titleLabel, sizeLabel])
titleStack.axis = .vertical
@@ -721,15 +726,34 @@ final class TravelAlbumPhotoPreviewViewController: UIViewController {
workflow: workflow
),
api: aiRetouchAPI,
onSubmitted: { [weak self] in
onSubmitted: { [weak self] submission in
guard let self else { return }
self.showPreviewToast("AI修图任务已提交")
self.reloadProjects(showGlobalLoading: false, forceRefreshImage: false)
self.presentAIRetouchSubmitted(submission)
}
)
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(