mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-02-06 20:28:39 +01:00
44 lines
1.2 KiB
Swift
44 lines
1.2 KiB
Swift
import Foundation
|
|
import AppleAPI
|
|
|
|
enum XcodesSheet: Identifiable {
|
|
case signIn
|
|
case twoFactor(SecondFactorData)
|
|
case securityKeyTouchToConfirm
|
|
|
|
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), securityKeyTouchToConfirm
|
|
|
|
enum TwoFactorOption {
|
|
case smsSent
|
|
case codeSent
|
|
case smsPendingChoice
|
|
case securityKeyPin
|
|
}
|
|
|
|
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)
|
|
case .securityKey: self = .twoFactor(.securityKeyPin)
|
|
}
|
|
case .securityKeyTouchToConfirm: self = .securityKeyTouchToConfirm
|
|
}
|
|
}
|
|
}
|
|
}
|