Implemented ability to delete annotations via swipe-to-delete gesture in the annotations list view. Added close button with X icon to dismiss the annotations sheet. Changes: - Added DeleteAnnotationUseCase with repository integration - Extended API with DELETE endpoint for annotations - Implemented swipe-to-delete in AnnotationsListView - Added error handling and optimistic UI updates - Updated toolbar with close button (X icon)
18 lines
511 B
Swift
18 lines
511 B
Swift
import Foundation
|
|
|
|
protocol PDeleteAnnotationUseCase {
|
|
func execute(bookmarkId: String, annotationId: String) async throws
|
|
}
|
|
|
|
class DeleteAnnotationUseCase: PDeleteAnnotationUseCase {
|
|
private let repository: PAnnotationsRepository
|
|
|
|
init(repository: PAnnotationsRepository) {
|
|
self.repository = repository
|
|
}
|
|
|
|
func execute(bookmarkId: String, annotationId: String) async throws {
|
|
try await repository.deleteAnnotation(bookmarkId: bookmarkId, annotationId: annotationId)
|
|
}
|
|
}
|