- Replace ServerConnectivity with CheckServerReachabilityUseCase - Add InfoApiClient for /api/info endpoint - Implement ServerInfoRepository with 30s cache TTL and 5s rate limiting - Update ShareBookmarkViewModel to use ShareExtensionServerCheck manager - Add server reachability check in AppViewModel on app start - Update OfflineSyncManager to use new UseCase - Extend SimpleAPI with checkServerReachability for Share Extension
29 lines
664 B
Swift
29 lines
664 B
Swift
//
|
|
// CheckServerReachabilityUseCase.swift
|
|
// readeck
|
|
//
|
|
// Created by Claude Code
|
|
|
|
import Foundation
|
|
|
|
protocol PCheckServerReachabilityUseCase {
|
|
func execute() async -> Bool
|
|
func getServerInfo() async throws -> ServerInfo
|
|
}
|
|
|
|
class CheckServerReachabilityUseCase: PCheckServerReachabilityUseCase {
|
|
private let repository: PServerInfoRepository
|
|
|
|
init(repository: PServerInfoRepository) {
|
|
self.repository = repository
|
|
}
|
|
|
|
func execute() async -> Bool {
|
|
return await repository.checkServerReachability()
|
|
}
|
|
|
|
func getServerInfo() async throws -> ServerInfo {
|
|
return try await repository.getServerInfo()
|
|
}
|
|
}
|