UI/UX Improvements: - Replace SLComposeServiceViewController with custom UIViewController - Add beautiful green-themed UI with Readeck branding and logo - Implement modern card-based layout with shadows and rounded corners - Add custom cancel button and proper navigation styling - Include loading states and comprehensive user feedback Backend Integration: - Add KeychainHelper integration for secure token/endpoint storage - Implement proper API integration with async/await - Add comprehensive error handling and status messages - Include DTOs for API communication Security & Configuration: - Add keychain access groups to entitlements for both main app and extension - Update TokenProvider to save tokens to keychain - Modify LogoutUseCase to clear keychain data - Update SaveServerSettingsUseCase to persist endpoint in keychain - Configure proper build settings and file sharing between targets Extension Lifecycle: - Implement proper URL extraction from various sources - Add automatic extension dismissal on success - Ensure proper extension context handling
47 lines
1.3 KiB
Swift
47 lines
1.3 KiB
Swift
//
|
|
// LogoutUseCase.swift
|
|
// readeck
|
|
//
|
|
// Created by Ilyas Hallak on 29.06.25.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
protocol LogoutUseCaseProtocol {
|
|
func execute() async throws
|
|
}
|
|
|
|
class LogoutUseCase: LogoutUseCaseProtocol {
|
|
private let settingsRepository: SettingsRepository
|
|
private let tokenManager: TokenManager
|
|
|
|
init(
|
|
settingsRepository: SettingsRepository = SettingsRepository(),
|
|
tokenManager: TokenManager = TokenManager.shared
|
|
) {
|
|
self.settingsRepository = settingsRepository
|
|
self.tokenManager = tokenManager
|
|
}
|
|
|
|
func execute() async throws {
|
|
// Clear the token
|
|
try await tokenManager.clearToken()
|
|
|
|
// Reset hasFinishedSetup to false
|
|
try await settingsRepository.saveHasFinishedSetup(false)
|
|
|
|
// Clear user session data
|
|
try await settingsRepository.saveToken("")
|
|
try await settingsRepository.saveUsername("")
|
|
try await settingsRepository.savePassword("")
|
|
|
|
KeychainHelper.shared.saveToken("")
|
|
KeychainHelper.shared.saveEndpoint("")
|
|
|
|
// Note: We keep the endpoint for potential re-login
|
|
// but clear the authentication data
|
|
|
|
print("LogoutUseCase: User logged out successfully")
|
|
}
|
|
}
|