Skip to content

Do not show MFA button when the project does not have MFA enabled#1338

Open
megastep wants to merge 2 commits intofirebase:mainfrom
megastep:main
Open

Do not show MFA button when the project does not have MFA enabled#1338
megastep wants to merge 2 commits intofirebase:mainfrom
megastep:main

Conversation

@megastep
Copy link
Copy Markdown
Contributor

@megastep megastep commented May 4, 2026

This is a simple change to the SignedIn view to conditionally disable showing the manage MFA button when this feature is not enabled in the Firebase project, to prevent user confusion.

Also added a corresponding UI test for this behavior.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces conditional visibility for the MFA management button in SignedInView based on the authentication configuration. Feedback includes a suggestion to mark the internal helper property as private for better encapsulation and a recommendation to add UI or view-level tests to verify the button's presence in the hierarchy, as the current unit tests only validate the underlying logic.

Comment thread FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/SignedInView.swift Outdated
Comment on lines +20 to +32
@Test("MFA management button is hidden when MFA is disabled")
func mfaManagementButtonHiddenWhenMfaDisabled() {
let configuration = AuthConfiguration(mfaEnabled: false)

#expect(SignedInView.showsMfaManagementButton(configuration: configuration) == false)
}

@Test("MFA management button is shown when MFA is enabled")
func mfaManagementButtonShownWhenMfaEnabled() {
let configuration = AuthConfiguration(mfaEnabled: true)

#expect(SignedInView.showsMfaManagementButton(configuration: configuration) == true)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The PR description mentions adding a UI test, but the implementation provides unit tests for a helper method. While testing the logic is a good practice, these tests do not verify that the button is actually hidden or shown in the view hierarchy. Consider adding a UI test or a view-level test (e.g., using ViewInspector) to verify the actual presence of the mfa-management-button based on the configuration.

….swift

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant