Add comprehensive annotations feature to bookmark detail views: - Implement annotations list view with date formatting and state machine - Add CSS-based highlighting for rd-annotation tags in WebView components - Support Readeck color scheme (yellow, green, blue, red) for annotations - Enable tap-to-scroll functionality to navigate to selected annotations - Integrate annotations button in bookmark detail toolbar - Add API endpoint and repository layer for fetching annotations
25 lines
699 B
Swift
25 lines
699 B
Swift
import Foundation
|
|
|
|
class AnnotationsRepository: PAnnotationsRepository {
|
|
private let api: PAPI
|
|
|
|
init(api: PAPI) {
|
|
self.api = api
|
|
}
|
|
|
|
func fetchAnnotations(bookmarkId: String) async throws -> [Annotation] {
|
|
let annotationDtos = try await api.getBookmarkAnnotations(bookmarkId: bookmarkId)
|
|
return annotationDtos.map { dto in
|
|
Annotation(
|
|
id: dto.id,
|
|
text: dto.text,
|
|
created: dto.created,
|
|
startOffset: dto.startOffset,
|
|
endOffset: dto.endOffset,
|
|
startSelector: dto.startSelector,
|
|
endSelector: dto.endSelector
|
|
)
|
|
}
|
|
}
|
|
}
|