Conversation
91fb07b to
fcd2d87
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors error message resolution in FirebaseUI Auth by mapping specific Firebase error codes to distinct exceptions and localized strings, while removing unused progress dialog strings across numerous localization files. It also updates the TopLevelDialogController to resolve strings dynamically from LocalAuthUIStringProvider. Feedback on these changes includes a recommendation to provide a default implementation for the new passwordTooLong method in AuthUIStringProvider to prevent breaking external implementations, and a suggestion to extract the digit regex in firstNumberIn to a companion object constant to optimize performance.
I am having trouble creating individual review comments. Click here to see my feedback.
auth/src/main/java/com/firebase/ui/auth/configuration/string_provider/AuthUIStringProvider.kt (187-188)
Adding a new abstract method passwordTooLong to the public interface AuthUIStringProvider is a breaking change for any external clients implementing this interface. To maintain backward compatibility, we should provide a default implementation (e.g., returning an empty string ""), which will automatically fall back to the default/English string without breaking compilation for existing custom implementations.
/** Error message when the password is longer than the maximum length allowed. Should support string formatting with maximum length parameter. */
fun passwordTooLong(maximumLength: Int): String = ""
auth/src/main/java/com/firebase/ui/auth/AuthException.kt (1022-1023)
To avoid compiling the regular expression pattern \d+ on every invocation of firstNumberIn, we should extract it as a private constant DIGIT_REGEX in the companion object. This improves performance and avoids unnecessary object allocation.
private val DIGIT_REGEX = Regex("\\d+")
private fun firstNumberIn(text: String): Int? =
DIGIT_REGEX.find(text)?.value?.toIntOrNull()
b2519bf to
2447342
Compare
4956f24 to
1457f75
Compare
1457f75 to
7ed73c8
Compare
Deletes 35
fui_*string resources that nothing in:authreferences, and their 2,687 translations across 84 locale folders.Changes
fui_mfa_method_smsallowlist entry, added there on the basis that this PR would delete the string.lint-baseline.xmlentry, and thetools:textattribute that was the only thing referencingfui_welcome_back_password_prompt_body.Why this is not marked breaking
These are public resource surface, but the README documents overriding these names rather than reading them, and an override of a name the library no longer declares still compiles.
Maintainer note: Fixes internal CPRN-445