- Add BookmarkState enum with unread, favorite, and archived states - Extend API layer with query parameter filtering for bookmark states - Update Bookmark domain model to match complete API response schema - Implement BookmarkListView with card-based UI and preview images - Add BookmarkListViewModel with state management and error handling - Enhance BookmarkDetailView with meta information and WebView rendering - Create comprehensive DTO mapping for all bookmark fields - Add TabView with state-based bookmark filtering - Implement date formatting utilities for ISO8601 timestamps - Add progress indicators and pull-to-refresh functionality
35 lines
981 B
Swift
35 lines
981 B
Swift
import Foundation
|
|
|
|
class AuthRepository: PAuthRepository {
|
|
private let api: PAPI
|
|
private let settingsRepository: PSettingsRepository
|
|
|
|
init(api: PAPI, settingsRepository: PSettingsRepository) {
|
|
self.api = api
|
|
self.settingsRepository = settingsRepository
|
|
}
|
|
|
|
func login(username: String, password: String) async throws -> User {
|
|
let userDto = try await api.login(username: username, password: password)
|
|
// Token wird automatisch von der API gespeichert
|
|
return User(id: userDto.id, token: userDto.token)
|
|
}
|
|
|
|
func logout() async throws {
|
|
await api.tokenProvider.clearToken()
|
|
}
|
|
|
|
func getCurrentSettings() async throws -> Settings? {
|
|
return try await settingsRepository.loadSettings()
|
|
}
|
|
|
|
func saveSettings(_ settings: Settings) async throws {
|
|
try await settingsRepository.saveSettings(settings)
|
|
}
|
|
}
|
|
|
|
struct User {
|
|
let id: String
|
|
let token: String
|
|
}
|