ReadKeep/readeck/Domain/UseCase/SaveServerSettingsUseCase.swift
Ilyas Hallak 1763dd6fa1 feat: Complete Share Extension implementation with Keychain integration
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
2025-07-04 00:00:35 +02:00

17 lines
594 B
Swift

import Foundation
class SaveServerSettingsUseCase {
private let repository: PSettingsRepository
init(repository: PSettingsRepository) {
self.repository = repository
}
func execute(endpoint: String, username: String, password: String, token: String) async throws {
try await repository.saveServerSettings(endpoint: endpoint, username: username, password: password, token: token)
KeychainHelper.shared.saveToken(token)
KeychainHelper.shared.saveEndpoint(endpoint)
print("token saved", KeychainHelper.shared.loadToken())
}
}