mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
39 lines
988 B
Swift
39 lines
988 B
Swift
import Foundation
|
|
import AppleAPI
|
|
|
|
enum XcodesSheet: Identifiable {
|
|
case signIn
|
|
case twoFactor(SecondFactorData)
|
|
|
|
var id: Int { Kind(self).hashValue }
|
|
|
|
struct SecondFactorData {
|
|
let option: TwoFactorOption
|
|
let authOptions: AuthOptionsResponse
|
|
let sessionData: AppleSessionData
|
|
}
|
|
}
|
|
|
|
extension XcodesSheet {
|
|
private enum Kind: Hashable {
|
|
case signIn, twoFactor(TwoFactorOption)
|
|
|
|
enum TwoFactorOption {
|
|
case smsSent
|
|
case codeSent
|
|
case smsPendingChoice
|
|
}
|
|
|
|
init(_ sheet: XcodesSheet) {
|
|
switch sheet {
|
|
case .signIn: self = .signIn
|
|
case .twoFactor(let data):
|
|
switch data.option {
|
|
case .smsSent: self = .twoFactor(.smsSent)
|
|
case .smsPendingChoice: self = .twoFactor(.smsPendingChoice)
|
|
case .codeSent: self = .twoFactor(.codeSent)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|