1
+ import FirebaseCore
1
2
import SwiftUI
2
3
3
4
struct PasswordPromptSheet {
@@ -9,26 +10,47 @@ struct PasswordPromptSheet {
9
10
extension PasswordPromptSheet : View {
10
11
var body : some View {
11
12
VStack ( spacing: 20 ) {
12
- SecureField ( authService. string. passwordInputLabel, text: $password)
13
- . textFieldStyle ( . roundedBorder)
13
+ Text ( authService. string. confirmPasswordInputLabel)
14
+ . font ( . largeTitle)
15
+ . fontWeight ( . bold)
14
16
. padding ( )
15
17
16
- HStack {
17
- Button ( authService. string. cancelButtonLabel) {
18
- coordinator. cancel ( )
19
- }
20
- Spacer ( )
21
- Button ( authService. string. okButtonLabel) {
18
+ Divider ( )
19
+
20
+ LabeledContent {
21
+ TextField ( authService. string. passwordInputLabel, text: $password)
22
+ . textInputAutocapitalization ( . never)
23
+ . disableAutocorrection ( true )
24
+ . submitLabel ( . next)
25
+ } label: {
26
+ Image ( systemName: " lock " )
27
+ } . padding ( . vertical, 10 )
28
+ . background ( Divider ( ) , alignment: . bottom)
29
+ . padding ( . bottom, 4 )
30
+
31
+ Button ( action: {
32
+ Task {
22
33
coordinator. submit ( password: password)
23
34
}
24
- . disabled ( password. isEmpty)
35
+ } ) {
36
+ Text ( authService. string. okButtonLabel)
37
+ . padding ( . vertical, 8 )
38
+ . frame ( maxWidth: . infinity)
39
+ }
40
+ . disabled ( password. isEmpty)
41
+ . padding ( [ . top, . bottom, . horizontal] , 8 )
42
+ . frame ( maxWidth: . infinity)
43
+ . buttonStyle ( . borderedProminent)
44
+
45
+ Button ( authService. string. cancelButtonLabel) {
46
+ coordinator. cancel ( )
25
47
}
26
- . padding ( . horizontal)
27
48
}
28
49
. padding ( )
29
50
}
30
51
}
31
52
32
53
#Preview {
33
- PasswordPromptSheet ( coordinator: PasswordPromptCoordinator ( ) )
54
+ FirebaseOptions . dummyConfigurationForPreview ( )
55
+ return PasswordPromptSheet ( coordinator: PasswordPromptCoordinator ( ) ) . environment ( AuthService ( ) )
34
56
}
0 commit comments