Skip to content

Commit 17f3bd3

Browse files
initial view for email auth button
1 parent f0a3811 commit 17f3bd3

File tree

2 files changed

+73
-4
lines changed

2 files changed

+73
-4
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/FirebaseAuthSwiftUI/FirebaseAuthSwiftUI.swift

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public class FirebaseAuthSwiftUI {
1414
private var authProviders: [FUIAuthProvider] = []
1515

1616
public init(auth: Auth? = nil) {
17-
// Use the provided Auth instance or default
1817
self.auth = auth ?? Auth.auth()
1918
}
2019

@@ -49,15 +48,47 @@ public protocol AuthPickerView: View {
4948
}
5049

5150
public struct FUIAuthPicker: AuthPickerView {
52-
public init(title: String? = nil) {
51+
public var title: String
52+
private var emailAuthButton: any EmailAuthButton
53+
54+
public init(title: String? = nil, _emailAuthButton: (any EmailAuthButton)? = nil) {
5355
self.title = title ?? "Auth Picker View"
56+
self.emailAuthButton = _emailAuthButton ?? EmailProviderButton() as! any EmailAuthButton
5457
}
55-
public var title: String = "Main View"
58+
5659
public var body: some View {
5760
VStack {
5861
Text(title)
5962
.font(.largeTitle)
6063
.padding()
61-
}
64+
AnyView(emailAuthButton)
65+
}.padding(20)
66+
.background(Color.white)
67+
.cornerRadius(12)
68+
.shadow(radius: 10)
69+
.padding()
70+
71+
}
72+
}
73+
74+
public protocol EmailAuthButton: View {
75+
var text: String { get }
76+
}
77+
78+
public struct EmailProviderButton: EmailAuthButton {
79+
public var text: String = "Sign in with email"
80+
public var body: some View {
81+
VStack {
82+
Button(action: {
83+
// Add the action you want to perform when the button is tapped
84+
print("Email sign-in button tapped")
85+
}) {
86+
Text(text)
87+
.padding()
88+
.background(Color.red)
89+
.foregroundColor(.white)
90+
.cornerRadius(8)
91+
}
6292
}
93+
}
6394
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CLIENT_ID</key>
6+
<string>406099696497-134k3722m01rtrsklhf3b7k8sqa5r7in.apps.googleusercontent.com</string>
7+
<key>REVERSED_CLIENT_ID</key>
8+
<string>com.googleusercontent.apps.406099696497-134k3722m01rtrsklhf3b7k8sqa5r7in</string>
9+
<key>ANDROID_CLIENT_ID</key>
10+
<string>406099696497-17qn06u8a0dc717u8ul7s49ampk13lul.apps.googleusercontent.com</string>
11+
<key>API_KEY</key>
12+
<string>AIzaSyDooSUGSf63Ghq02_iIhtnmwMDs4HlWS6c</string>
13+
<key>GCM_SENDER_ID</key>
14+
<string>406099696497</string>
15+
<key>PLIST_VERSION</key>
16+
<string>1</string>
17+
<key>BUNDLE_ID</key>
18+
<string>io.flutter.plugins.firebase.auth.example</string>
19+
<key>PROJECT_ID</key>
20+
<string>flutterfire-e2e-tests</string>
21+
<key>STORAGE_BUCKET</key>
22+
<string>flutterfire-e2e-tests.appspot.com</string>
23+
<key>IS_ADS_ENABLED</key>
24+
<false></false>
25+
<key>IS_ANALYTICS_ENABLED</key>
26+
<false></false>
27+
<key>IS_APPINVITE_ENABLED</key>
28+
<true></true>
29+
<key>IS_GCM_ENABLED</key>
30+
<true></true>
31+
<key>IS_SIGNIN_ENABLED</key>
32+
<true></true>
33+
<key>GOOGLE_APP_ID</key>
34+
<string>1:406099696497:ios:58cbc26aca8e5cf83574d0</string>
35+
<key>DATABASE_URL</key>
36+
<string>https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app</string>
37+
</dict>
38+
</plist>

0 commit comments

Comments
 (0)