Initial implementation of Fantasy Hockey watchOS app
Implemented complete TCA architecture for iOS and watchOS targets: - Authentication flow (Sign in with Apple + Yahoo OAuth) - OAuth token management with iCloud Key-Value Storage - Yahoo Fantasy Sports API client with async/await - Watch Connectivity for iPhone ↔ Watch data sync - Complete UI for both iPhone and Watch platforms Core features: - Matchup score display - Category breakdown with win/loss/tie indicators - Roster status tracking - Manual refresh functionality - Persistent data caching on Watch Technical stack: - The Composable Architecture for state management - Swift Concurrency (async/await, actors) - WatchConnectivity framework - Sign in with Apple - OAuth 2.0 authentication flow 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
43
FantasyWatch/Shared/Networking/OAuth/OAuthModels.swift
Normal file
43
FantasyWatch/Shared/Networking/OAuth/OAuthModels.swift
Normal file
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// OAuthModels.swift
|
||||
// FantasyWatch
|
||||
//
|
||||
// Created by Claude Code
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct TokenPair: Codable, Equatable, Sendable {
|
||||
let accessToken: String
|
||||
let refreshToken: String
|
||||
let expiresIn: Int
|
||||
let tokenType: String
|
||||
|
||||
var expiryDate: Date {
|
||||
Date().addingTimeInterval(TimeInterval(expiresIn))
|
||||
}
|
||||
}
|
||||
|
||||
struct OAuthTokenResponse: Codable {
|
||||
let access_token: String
|
||||
let refresh_token: String
|
||||
let expires_in: Int
|
||||
let token_type: String
|
||||
|
||||
func toTokenPair() -> TokenPair {
|
||||
TokenPair(
|
||||
accessToken: access_token,
|
||||
refreshToken: refresh_token,
|
||||
expiresIn: expires_in,
|
||||
tokenType: token_type
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
enum OAuthError: Error, Equatable {
|
||||
case noRefreshToken
|
||||
case tokenExpired
|
||||
case authorizationFailed
|
||||
case networkError(String)
|
||||
case invalidResponse
|
||||
}
|
||||
Reference in New Issue
Block a user