File tree Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Original file line number Diff line number Diff line change 8
8
import Foundation
9
9
10
10
public class ComponentInformation {
11
- public static let version = " 1.0.0-dev-preview "
11
+ public static let version = " 1.0.1 "
12
12
public static let name = " amplify-ui-swift-authenticator "
13
13
}
Original file line number Diff line number Diff line change @@ -89,7 +89,18 @@ public class SignUpState: AuthenticatorBaseState {
89
89
90
90
setBusy ( true )
91
91
let cognitoConfiguration = authenticatorState. configuration
92
- var inputs = signUpFields. map { Field ( field: $0) }
92
+
93
+ var existingFields : Set < String > = [ ]
94
+ var inputs = signUpFields. compactMap { field -> Field ? in
95
+ guard !existingFields. contains ( field. rawValue) else {
96
+ log. warn ( " Skipping configuring field of type ' \( field. rawValue) ' because it was already present. " )
97
+ return nil
98
+ }
99
+
100
+ existingFields. insert ( field. rawValue)
101
+ return Field ( field: field)
102
+ }
103
+
93
104
for attribute in cognitoConfiguration. verificationMechanisms {
94
105
if let index = inputs. firstIndex ( where: { $0. field. attributeType == attribute. asSignUpAttribute } ) {
95
106
if !inputs[ index] . field. isRequired {
@@ -160,3 +171,18 @@ public extension SignUpState {
160
171
}
161
172
}
162
173
}
174
+
175
+ private extension SignUpField {
176
+ var rawValue : String {
177
+ switch attributeType {
178
+ case . username:
179
+ return " username "
180
+ case . password:
181
+ return " password "
182
+ case . passwordConfirmation:
183
+ return " passwordConfirmation "
184
+ default :
185
+ return attributeType. attributeKey? . rawValue ?? " unknown "
186
+ }
187
+ }
188
+ }
Original file line number Diff line number Diff line change @@ -59,8 +59,10 @@ struct PhoneNumberField: View {
59
59
CallingCodeField ( callingCode: $callingCode)
60
60
. foregroundColor ( foregroundColor)
61
61
. focused ( $focusedField, equals: . callingCode)
62
- . onChange ( of: callingCode) { text in
63
- self . text = " \( text) \( phoneNumber) "
62
+ . onChange ( of: callingCode) { code in
63
+ if !phoneNumber. isEmpty {
64
+ text = " \( code) \( phoneNumber) "
65
+ }
64
66
}
65
67
66
68
Divider ( )
You can’t perform that action at this time.
0 commit comments