-
Notifications
You must be signed in to change notification settings - Fork 490
Expand file tree
/
Copy pathContentView.swift
More file actions
48 lines (43 loc) · 1.3 KB
/
ContentView.swift
File metadata and controls
48 lines (43 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// ContentView.swift
// FirebaseSwiftUIExample
//
// Created by Russell Wheatley on 23/04/2025.
//
import FirebaseAuth
import FirebaseAuthSwiftUI
import FirebaseFacebookSwiftUI
import FirebaseGoogleSwiftUI
import FirebasePhoneAuthSwiftUI
import SwiftUI
struct ContentView: View {
let authService: AuthService
init() {
Auth.auth().signInAnonymously()
let actionCodeSettings = ActionCodeSettings()
actionCodeSettings.handleCodeInApp = true
actionCodeSettings
.url = URL(string: "https://flutterfire-e2e-tests.firebaseapp.com")
actionCodeSettings.linkDomain = "flutterfire-e2e-tests.firebaseapp.com"
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
let configuration = AuthConfiguration(
shouldAutoUpgradeAnonymousUsers: true,
emailLinkSignInActionCodeSettings: actionCodeSettings
)
let facebookProvider = FacebookProviderAuthUI()
let phoneAuthProvider = PhoneAuthProviderAuthUI()
authService = AuthService(
configuration: configuration,
facebookProvider: facebookProvider,
phoneAuthProvider: phoneAuthProvider
)
.withGoogleSignIn()
}
var body: some View {
AuthPickerView {
SignInWithGoogleButton()
SignInWithFacebookButton()
PhoneAuthButtonView()
}.environment(authService)
}
}