Uh oh!
There was an error while loading. Please reload this page.
feat(AuthUIConfiguration): implement configuration model, DSL builder and tests - #2216
Conversation
demolaf
commented
Sep 15, 2025
- Add AuthUIConfiguration data class with all properties
- Implement authUIConfiguration DSL builder function
- Add AuthProvider, AuthUITheme, AuthUIStringProvider, and PasswordRule models
- Create comprehensive tests for default and custom configurations
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| import kotlin.reflect.KMutableProperty | ||
| import kotlin.reflect.full.memberProperties | ||
| class AuthUIConfigurationTest { |
There was a problem hiding this comment.
Would like to see a test for the Builder pattern as well
There was a problem hiding this comment.
not sure if i understand, doesn't the authUIConfiguration dsl function tests handle the builder pattern test also?
Uh oh!
There was an error while loading. Please reload this page.
| /** | ||
| * The expected length of the SMS verification code. Defaults to 6. | ||
| */ | ||
| val smsCodeLength: Int = 6, |
There was a problem hiding this comment.
is this verified against what we get from Firebase by default?
There was a problem hiding this comment.
I got this from the API Design docs, is there somewhere else I could check this from?
| interface AuthUIStringProvider { | ||
| fun initializing(): String | ||
| fun signInWithGoogle(): String | ||
| fun invalidEmail(): String | ||
| fun passwordsDoNotMatch(): String | ||
| } | ||
| class DefaultAuthUIStringProvider(private val context: Context) : AuthUIStringProvider { | ||
| override fun initializing(): String = "" | ||
| override fun signInWithGoogle(): String = | ||
| context.getString(R.string.fui_sign_in_with_google) | ||
| override fun invalidEmail(): String = "" | ||
| override fun passwordsDoNotMatch(): String = "" |
There was a problem hiding this comment.
We'll need documentation for this
| sealed class PasswordRule { | ||
| /** | ||
| * Requires the password to have at least a certain number of characters. | ||
| */ | ||
| data class MinimumLength(val value: Int) : PasswordRule() | ||
| /** | ||
| * Requires the password to contain at least one uppercase letter (A-Z). | ||
| */ | ||
| object RequireUppercase : PasswordRule() | ||
| /** | ||
| * Requires the password to contain at least one lowercase letter (a-z). | ||
| */ | ||
| object RequireLowercase: PasswordRule() | ||
| /** | ||
| * Requires the password to contain at least one numeric digit (0-9). | ||
| */ | ||
| object RequireDigit: PasswordRule() | ||
| /** | ||
| * Requires the password to contain at least one special character (e.g., !@#$%^&*). | ||
| */ | ||
| object RequireSpecialCharacter: PasswordRule() | ||
| /** | ||
| * Defines a custom validation rule using a regular expression and provides a specific error | ||
| * message on failure. | ||
| */ | ||
| data class Custom(val regex: Regex, val errorMessage: String) | ||
| } No newline at end of file |
There was a problem hiding this comment.
Would be nice to have the actual validation inside of this sealed class (maybe even something that can validate a list of PasswordRules
There was a problem hiding this comment.
Yeah this is a different ticket too here, don't want to cramp them all in a single PR.
replaced sealed with abstract class, data with regular class use isXX prefix for booleans