Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d698c29
ui changes
demolaf Oct 27, 2025
47b3a60
refactor: use provider styles
demolaf Oct 28, 2025
d5745c3
fix: move limited login to sample app
demolaf Oct 28, 2025
ef278eb
refactor: AuthPickerView layout and styling
demolaf Oct 28, 2025
94f1a36
refactor: use sheet and navigation links
demolaf Oct 29, 2025
4f997f9
refactor: phone auth view and use navigation path instead
demolaf Oct 29, 2025
2ceeb7a
add firebase auth logo
demolaf Oct 29, 2025
61ae6dc
refactor: auto resolve limited login from ATT
demolaf Oct 30, 2025
d192d4e
fix: button for email link auth
demolaf Oct 30, 2025
ce4a146
Merge branch 'development' of https://github.com/firebase/FirebaseUI-…
demolaf Oct 30, 2025
cee4579
fix package.swift errors
demolaf Oct 30, 2025
08eeaf6
Update samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExample/…
demolaf Oct 31, 2025
3259d7f
format
russellwheatley Oct 31, 2025
6846c4d
fix: remove duplicate back buttons
russellwheatley Oct 31, 2025
ebaeb87
fix: password recovery email button label
russellwheatley Oct 31, 2025
969a9da
fix: descriptive text of what it does
russellwheatley Oct 31, 2025
557a005
chore: add button to open authpickerview
russellwheatley Oct 31, 2025
c6469d7
chore: update SignedInView UI
russellwheatley Oct 31, 2025
c97bcec
chore: remove sign in title when authenticated
russellwheatley Oct 31, 2025
0825807
chore: remove "as"
russellwheatley Oct 31, 2025
c53cfcf
fix: update password view to match UI
russellwheatley Oct 31, 2025
4f6e0f3
fix: MFA management View UI fix
russellwheatley Oct 31, 2025
0e532d0
fix: mfa enrolment View
russellwheatley Oct 31, 2025
ad4a0f6
fix: mfa enrolment phone number
russellwheatley Oct 31, 2025
cf5a6cc
fix: ensure everything can fit on the page
russellwheatley Oct 31, 2025
815d8ca
fix: delete account confirmation sheet
russellwheatley Oct 31, 2025
7285f12
refactor: remove signedInCredential and used persisted tokenresult to…
russellwheatley Oct 31, 2025
ffc8436
refactor: send email view to match UI and remove surplus file
russellwheatley Oct 31, 2025
cd9f261
format
russellwheatley Oct 31, 2025
1550af0
refactor: improve sheet when email link sent
russellwheatley Oct 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

import FirebaseAuthSwiftUI
import FirebaseAuthUIComponents
import SwiftUI

/// A button for signing in with Apple
Expand All @@ -27,27 +28,14 @@ public struct SignInWithAppleButton {

extension SignInWithAppleButton: View {
public var body: some View {
Button(action: {
AuthProviderButton(
label: "Sign in with Apple",
style: .apple,
accessibilityId: "sign-in-with-apple-button"
) {
Task {
try? await authService.signIn(provider)
}
}) {
HStack {
Image(systemName: "apple.logo")
.resizable()
.renderingMode(.template)
.scaledToFit()
.frame(width: 24, height: 24)
.foregroundColor(.white)
Text("Sign in with Apple")
.fontWeight(.semibold)
.foregroundColor(.white)
}
.frame(maxWidth: .infinity, alignment: .leading)
.padding()
.background(Color.black)
.cornerRadius(8)
}
.accessibilityIdentifier("sign-in-with-apple-button")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public protocol DeleteUserSwift {

public protocol PhoneAuthProviderSwift: AuthProviderSwift {
@MainActor func verifyPhoneNumber(phoneNumber: String) async throws -> String
func setVerificationCode(verificationID: String, code: String)
}

public enum AuthenticationState {
Expand All @@ -44,14 +45,15 @@ public enum AuthenticationFlow {
case signUp
}

public enum AuthView {
case authPicker
public enum AuthView: Hashable {
case passwordRecovery
case emailLink
case updatePassword
case mfaEnrollment
case mfaManagement
case mfaResolution
case enterPhoneNumber
case enterVerificationCode(verificationID: String, fullPhoneNumber: String)
}

public enum SignInOutcome: @unchecked Sendable {
Expand Down Expand Up @@ -85,6 +87,24 @@ private final class AuthListenerManager {
}
}

@Observable
public class Navigator {
var routes: [AuthView] = []

public func push(_ route: AuthView) {
routes.append(route)
}

@discardableResult
public func pop() -> AuthView? {
routes.popLast()
}

public func clear() {
routes.removeAll()
}
}

@MainActor
@Observable
public final class AuthService {
Expand All @@ -98,7 +118,10 @@ public final class AuthService {
@ObservationIgnored @AppStorage("email-link") public var emailLink: String?
public let configuration: AuthConfiguration
public let auth: Auth
public var authView: AuthView = .authPicker
public private(set) var navigator = Navigator()
public var authViewRoutes: [AuthView] {
navigator.routes
}
public let string: StringUtils
public var currentUser: User?
public var authenticationState: AuthenticationState = .unauthenticated
Expand All @@ -117,6 +140,10 @@ public final class AuthService {
var emailSignInEnabled = false

private var providers: [AuthProviderUI] = []

public var currentPhoneProvider: PhoneAuthProviderSwift? {
providers.compactMap { $0.provider as? PhoneAuthProviderSwift }.first
}
public func registerProvider(providerWithButton: AuthProviderUI) {
providers.append(providerWithButton)
}
Expand Down Expand Up @@ -794,7 +821,7 @@ public extension AuthService {
let hints = extractMFAHints(from: resolver)
currentMFARequired = MFARequired(hints: hints)
currentMFAResolver = resolver
authView = .mfaResolution
navigator.push(.mfaResolution)
return .mfaRequired(MFARequired(hints: hints))
}

Expand Down
Loading