- Add cache settings UseCases (get/update size, clear cache) - Create CacheSettingsViewModel and OfflineSettingsViewModel - Replace direct UserDefaults access with repository pattern - Add CachedArticlesPreviewView for viewing offline articles - Integrate offline settings into main SettingsContainerView - Wire up new UseCases in factory pattern
18 lines
434 B
Swift
18 lines
434 B
Swift
import Foundation
|
|
|
|
protocol PGetMaxCacheSizeUseCase {
|
|
func execute() async throws -> UInt
|
|
}
|
|
|
|
class GetMaxCacheSizeUseCase: PGetMaxCacheSizeUseCase {
|
|
private let settingsRepository: PSettingsRepository
|
|
|
|
init(settingsRepository: PSettingsRepository) {
|
|
self.settingsRepository = settingsRepository
|
|
}
|
|
|
|
func execute() async throws -> UInt {
|
|
return try await settingsRepository.getMaxCacheSize()
|
|
}
|
|
}
|