Refactorings: - Extract HTMLImageEmbedder and HTMLImageExtractor utilities - Create UseCases for cached data access (GetCachedBookmarksUseCase, GetCachedArticleUseCase) - Create CreateAnnotationUseCase to remove API dependency from ViewModel - Simplify CachedAsyncImage by extracting helper methods - Fix Kingfisher API compatibility (Source types, Result handling) - Add documentation to OfflineCacheSyncUseCase - Remove unused TestView from production code Enforces Clean Architecture: - ViewModels now only use UseCases, no direct Repository or API access - All data layer access goes through Domain layer
25 lines
585 B
Swift
25 lines
585 B
Swift
//
|
|
// GetCachedBookmarksUseCase.swift
|
|
// readeck
|
|
//
|
|
// Created by Ilyas Hallak on 30.11.25.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
protocol PGetCachedBookmarksUseCase {
|
|
func execute() async throws -> [Bookmark]
|
|
}
|
|
|
|
class GetCachedBookmarksUseCase: PGetCachedBookmarksUseCase {
|
|
private let offlineCacheRepository: POfflineCacheRepository
|
|
|
|
init(offlineCacheRepository: POfflineCacheRepository) {
|
|
self.offlineCacheRepository = offlineCacheRepository
|
|
}
|
|
|
|
func execute() async throws -> [Bookmark] {
|
|
return try await offlineCacheRepository.getCachedBookmarks()
|
|
}
|
|
}
|