-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(AuthUIConfiguration): implement configuration model, DSL builder and tests #2216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
auth/src/main/java/com/firebase/ui/auth/compose/configuration/AuthProvider.kt
Outdated
Show resolved
Hide resolved
auth/src/main/java/com/firebase/ui/auth/compose/configuration/AuthUITheme.kt
Outdated
Show resolved
Hide resolved
import kotlin.reflect.KMutableProperty | ||
import kotlin.reflect.full.memberProperties | ||
|
||
class AuthUIConfigurationTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like to see a test for the Builder pattern as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if i understand, doesn't the authUIConfiguration dsl function tests handle the builder pattern test also?
/** | ||
* The expected length of the SMS verification code. Defaults to 6. | ||
*/ | ||
val smsCodeLength: Int = 6, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this verified against what we get from Firebase by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need documentation for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's a different ticket here
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
…droid into feat/C1