Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request centralizes the Android Lint configuration in the root build file, applying a uniform policy across all subprojects and removing redundant lint blocks from individual modules. It also refactors error handling and localization in the auth module, mapping specific Firebase Auth error codes to localized messages via AuthUIStringProvider, and improves session cleanup during sign-out. Additionally, ContinueUrlBuilder was refactored to use Uri for safer parameter appending, and numerous localized string resources were updated. The review feedback recommends ensuring the tools namespace is declared in all XML files using tools:ignore to prevent compilation errors, and suggests optimizing regex instantiation by extracting the pattern to a companion object constant.
| locales. minimumPasswordLength is an unbounded Int, so 1 is reachable and would read | ||
| "at least 1 characters"; a policy of 1 is not worth 61 translations, and the check is | ||
| suppressed here rather than module-wide so it still guards every other string. --> | ||
| <string name="fui_error_password_too_short" tools:ignore="PluralsCandidate" translation_description="Error message when password is too short">Password must be at least %1$d characters long</string> |
There was a problem hiding this comment.
Please ensure that xmlns:tools="http://schemas.android.com/tools" is declared in the root <resources> element of this file (and other regional strings.xml files like values-en-rAU, values-en-rCA, values-en-rGB where tools:ignore was added). If the namespace is not bound in the XML, AAPT2 will fail to compile the resources with a namespace binding error.
| private fun firstNumberIn(text: String): Int? = | ||
| Regex("\\d+").find(text)?.value?.toIntOrNull() |
There was a problem hiding this comment.
Instantiating a Regex object on every call to firstNumberIn is inefficient. It is recommended to extract the regular expression to a private companion object constant to avoid redundant object allocation.
| private fun firstNumberIn(text: String): Int? = | |
| Regex("\\d+").find(text)?.value?.toIntOrNull() | |
| private val NUMBER_REGEX = Regex("\\d+") | |
| private fun firstNumberIn(text: String): Int? = | |
| NUMBER_REGEX.find(text)?.value?.toIntOrNull() |
a13ce0a to
f0883e5
Compare
auth/README.mddocumented an API that does not exist:AuthStateas a sealed hierarchy of data classes, an MFA section that builds a config object and never passes it anywhere, and an errorwhencovering half the exception types with noelse. Corrected against the source onpre-GA, with the hand-maintained test-tag table replaced by the naming rule the test suite already enforces.Changes
AuthStateblock:abstractnotsealed, nothing is a data class,Error.exceptionis typedException, plusSuccess.reauthenticatedUid,isNotificationand theAuthState.Reauthenticationhierarchy, with a note on what each means for caller code.MFA Configuration now passes
mfaConfigurationtoFirebaseAuthScreen, which is where it goes. It is a screen parameter, not a property ofauthUIConfiguration, and the old example dropped the object it built.Error Handling covers all 21
AuthExceptionsubclasses and ends with anelse, sinceAuthExceptionis not sealed and the missing branches previously failed silently.Test tags: the 32-row table becomes the
fui_<object_snake_case>_<CONSTANT_lowercase>rule, the 13 grouping objects, and a pointer toFirebaseAuthTestTags, citing the reflective assertions inFirebaseAuthTestTagsTest.The stability promise is rescoped from "a value documented here" to every constant on
FirebaseAuthTestTags, bringing the 27 constants the table omitted inside it.Sign Out documents that
signOutclears Google Credential Manager state and the FacebookLoginManagersession for linked providers, with the Facebook step guarded by a classpath probe.The
FirebaseAuthScreenparameter table is marked partial and points at Custom UI with Slots for the seven slot parameters; the drifting "~170 abstractvals" count is dropped rather than re-pinned.Fixes the localization example, which defined
SpanishStringProviderwith no constructor parameters and then calledSpanishStringProvider(context), so the snippet did not compile.Repairs two
AuthExceptionmessages that read "You are are attempting...", the second also missing a word. Own commit, since it is source rather than docs.Validation
Five sweeps re-run on the finished README: symbol resolution, named arguments against each callee, required arguments against each signature, Compose calling context, and anchor/TOC resolution (56 anchors, all resolve, modelling GitHub's duplicate-heading suffixing).
The string change carries
./gradlew :auth:testDebugUnitTest --rerun-tasks: BUILD SUCCESSFUL, 49 tasks executed, 1101 tests, 0 failures or errors. Verified as a real run rather than cached results by diffing the 82 test classes underauth/src/testagainst the 82 inauth/build/test-results, none missing, all XMLs written during this run.Maintainer note: Refs internal CPRN-490