ReadKeep/readeck/Data/Mappers/BookmarkMapper.swift
Ilyas Hallak c8368f0a70 feat: Implement bookmark filtering, enhanced UI, and API integration
- Add BookmarkState enum with unread, favorite, and archived states
- Extend API layer with query parameter filtering for bookmark states
- Update Bookmark domain model to match complete API response schema
- Implement BookmarkListView with card-based UI and preview images
- Add BookmarkListViewModel with state management and error handling
- Enhance BookmarkDetailView with meta information and WebView rendering
- Create comprehensive DTO mapping for all bookmark fields
- Add TabView with state-based bookmark filtering
- Implement date formatting utilities for ISO8601 timestamps
- Add progress indicators and pull-to-refresh functionality
2025-06-11 22:02:44 +02:00

61 lines
1.6 KiB
Swift

import Foundation
// MARK: - BookmarkDto to Domain Mapping
extension BookmarkDto {
func toDomain() -> Bookmark {
return Bookmark(
id: id,
title: title,
url: url,
href: href,
description: description,
authors: authors,
created: created,
published: published,
updated: updated,
siteName: siteName,
site: site,
readingTime: readingTime,
wordCount: wordCount,
hasArticle: hasArticle,
isArchived: isArchived,
isDeleted: isDeleted,
isMarked: isMarked,
labels: labels,
lang: lang,
loaded: loaded,
readProgress: readProgress,
documentType: documentType,
state: state,
textDirection: textDirection,
type: type,
resources: resources.toDomain()
)
}
}
// MARK: - Resources Mapping
extension BookmarkResourcesDto {
func toDomain() -> BookmarkResources {
return BookmarkResources(
article: article?.toDomain(),
icon: icon?.toDomain(),
image: image?.toDomain(),
log: log?.toDomain(),
props: props?.toDomain(),
thumbnail: thumbnail?.toDomain()
)
}
}
extension ResourceDto {
func toDomain() -> Resource {
return Resource(src: src)
}
}
extension ImageResourceDto {
func toDomain() -> ImageResource {
return ImageResource(src: src, height: height, width: width)
}
}