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
559 B
Swift
25 lines
559 B
Swift
//
|
|
// GetCachedArticleUseCase.swift
|
|
// readeck
|
|
//
|
|
// Created by Ilyas Hallak on 30.11.25.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
protocol PGetCachedArticleUseCase {
|
|
func execute(id: String) -> String?
|
|
}
|
|
|
|
class GetCachedArticleUseCase: PGetCachedArticleUseCase {
|
|
private let offlineCacheRepository: POfflineCacheRepository
|
|
|
|
init(offlineCacheRepository: POfflineCacheRepository) {
|
|
self.offlineCacheRepository = offlineCacheRepository
|
|
}
|
|
|
|
func execute(id: String) -> String? {
|
|
return offlineCacheRepository.getCachedArticle(id: id)
|
|
}
|
|
}
|