Skip to content

Commit 5a32a61

Browse files
phone auth provide init
1 parent 00f6f00 commit 5a32a61

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// AuthService+Phone.swift
3+
// FirebaseUI
4+
//
5+
// Created by Russell Wheatley on 09/05/2025.
6+
//
7+
8+
import FirebaseAuthSwiftUI
9+
10+
public extension AuthService {
11+
@discardableResult
12+
func withPhoneSignIn() -> AuthService {
13+
phoneAuthProvider = PhoneAuthProviderAuthUI()
14+
register(provider: phoneAuthProvider!)
15+
return self
16+
}
17+
}

FirebaseSwiftUI/FirebasePhoneAuthSwiftUI/Sources/Services/PhoneAuthProviderAuthUI.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ public typealias VerificationID = String
77
public class PhoneAuthProviderAuthUI: @preconcurrency PhoneAuthProviderAuthUIProtocol {
88
public let id: String = "phone"
99

10-
public init() {}
11-
1210
@MainActor public func authButton() -> AnyView {
13-
AnyView(Text("phone button TODO"))
11+
AnyView(PhoneAuthButtonView())
1412
}
1513

1614
@MainActor public func verifyPhoneNumber(phoneNumber: String) async throws -> VerificationID {

samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExample/ContentView.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@ struct ContentView: View {
2828
shouldAutoUpgradeAnonymousUsers: true,
2929
emailLinkSignInActionCodeSettings: actionCodeSettings
3030
)
31-
let phoneAuthProvider = PhoneAuthProviderAuthUI()
3231
authService = AuthService(
33-
configuration: configuration,
34-
phoneAuthProvider: phoneAuthProvider
32+
configuration: configuration
3533
)
3634
.withGoogleSignIn()
3735
.withFacebookSignIn()
36+
.withPhoneSignIn()
3837
}
3938

4039
var body: some View {

samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExample/FirebaseSwiftUIExampleApp.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
import FacebookCore
88
import FirebaseAuth
99
import FirebaseCore
10-
import FirebaseGoogleSwiftUI
11-
import FirebasePhoneAuthSwiftUI
1210
import GoogleSignIn
13-
import SwiftData
1411
import SwiftUI
1512

1613
class AppDelegate: NSObject, UIApplicationDelegate {
@@ -61,8 +58,6 @@ class AppDelegate: NSObject, UIApplicationDelegate {
6158
struct FirebaseSwiftUIExampleApp: App {
6259
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
6360

64-
init() {}
65-
6661
var body: some Scene {
6762
WindowGroup {
6863
NavigationView {

0 commit comments

Comments
 (0)