ReadKeep/readeck/Data/Mappers/BookmarkMapper.swift
Ilyas Hallak be68538da3 Refactor UI navigation and settings management
- Split TabView and Sidebar logic into PhoneTabView, PadSidebarView, SidebarTab, and BookmarkState for better device adaptation
- Remove old SettingsViewModel, introduce SettingsGeneralViewModel and SettingsServerViewModel for modular settings
- Update BookmarksView and BookmarksViewModel for new paginated and filtered data model
- Clean up and modularize settings UI (SettingsGeneralView, SettingsServerView, FontSettingsView)
- Remove obsolete files (old TabView, File.swift, SettingsViewModel, etc.)
- Add BookmarksPageDto and update related data flow
- Various UI/UX improvements and code cleanup

BREAKING: Settings and navigation structure refactored, old settings logic removed
2025-07-02 16:26:07 +02:00

74 lines
1.9 KiB
Swift

import Foundation
extension BookmarksPageDto {
func toDomain() -> BookmarksPage {
return BookmarksPage(
bookmarks: bookmarks.map { $0.toDomain() },
currentPage: currentPage,
totalCount: totalCount,
totalPages: totalPages,
links: links
)
}
}
// 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)
}
}