1- import SwiftUI
21import AppleAPI
2+ import SwiftUI
33
44struct SignInPhoneListView : View {
55 @EnvironmentObject var appState : AppState
66 @Binding var isPresented : Bool
77 @State private var selectedPhoneNumberID : AuthOptionsResponse . TrustedPhoneNumber . ID ?
88 let authOptions : AuthOptionsResponse
99 let sessionData : AppleSessionData
10-
10+
1111 var body : some View {
1212 VStack ( alignment: . leading) {
1313 if let phoneNumbers = authOptions. trustedPhoneNumbers, !phoneNumbers. isEmpty {
1414 Text ( String ( format: localizeString ( " SelectTrustedPhone " ) , authOptions. securityCode. length) )
15-
15+
1616 List ( phoneNumbers, selection: $selectedPhoneNumberID) {
1717 Text ( $0. numberWithDialCode)
1818 }
@@ -22,19 +22,18 @@ struct SignInPhoneListView: View {
2222 }
2323 }
2424 } else {
25- AttributedText (
26- NSAttributedString ( string: localizeString ( " NoTrustedPhones " ) )
27- . convertingURLsToLinkAttributes ( )
28- )
25+ Text ( " NoTrustedPhones " )
26+ . font ( . callout)
2927 Spacer ( )
3028 }
31-
29+
3230 HStack {
3331 Button ( " Cancel " , action: { isPresented = false } )
3432 . keyboardShortcut ( . cancelAction)
3533 Spacer ( )
3634 ProgressButton ( isInProgress: appState. isProcessingAuthRequest,
37- action: { appState. requestSMS ( to: authOptions. trustedPhoneNumbers!. first { $0. id == selectedPhoneNumberID } !, authOptions: authOptions, sessionData: sessionData) } ) {
35+ action: { appState. requestSMS ( to: authOptions. trustedPhoneNumbers!. first { $0. id == selectedPhoneNumberID } !, authOptions: authOptions, sessionData: sessionData) } )
36+ {
3837 Text ( " Continue " )
3938 }
4039 . keyboardShortcut ( . defaultAction)
@@ -54,19 +53,21 @@ struct SignInPhoneListView_Previews: PreviewProvider {
5453 SignInPhoneListView (
5554 isPresented: . constant( true ) ,
5655 authOptions: AuthOptionsResponse (
57- trustedPhoneNumbers: [ . init( id: 0 , numberWithDialCode: " (•••) •••-••90 " ) ] ,
56+ trustedPhoneNumbers: [ . init( id: 0 , numberWithDialCode: " (•••) •••-••90 " ) ] ,
5857 trustedDevices: nil ,
59- securityCode: . init( length: 6 ) ) ,
58+ securityCode: . init( length: 6 )
59+ ) ,
6060 sessionData: AppleSessionData ( serviceKey: " " , sessionID: " " , scnt: " " )
6161 )
6262 . environmentObject ( AppState ( ) )
6363
6464 SignInPhoneListView (
6565 isPresented: . constant( true ) ,
6666 authOptions: AuthOptionsResponse (
67- trustedPhoneNumbers: [ ] ,
67+ trustedPhoneNumbers: [ ] ,
6868 trustedDevices: nil ,
69- securityCode: . init( length: 6 ) ) ,
69+ securityCode: . init( length: 6 )
70+ ) ,
7071 sessionData: AppleSessionData ( serviceKey: " " , sessionID: " " , scnt: " " )
7172 )
7273 . environmentObject ( AppState ( ) )
0 commit comments