fix(auth): allow customizing top app bar colors via AuthUITheme - #2391
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to customize top app bar colors on authentication screens by adding a topAppBarColors property to AuthUITheme and applying it across various UI screens. The review feedback highlights a compilation error in HighLevelApiDemoActivity.kt due to the use of a non-existent subtitleContentColor parameter in Material 3's TopAppBarColors. Additionally, because TopAppBarColors is an experimental API, the reviewer recommends adding the @OptIn(ExperimentalMaterial3Api::class) annotation locally in the demo activity and propagating the @property:ExperimentalMaterial3Api annotation to the public property in AuthUITheme.
russellwheatley
left a comment
There was a problem hiding this comment.
A few bits of feedback
SelectFactorUI's TopAppBar in MfaEnrollmentDefaults.kt doesn't take colors at all, so it won't pick up topAppBarColors (or even the existing default). Can you wire that one up too, otherwise the 2FA screen won't match once someone sets a custom color.
see auth/src/main/java/com/firebase/ui/auth/ui/screens/MfaEnrollmentDefaults.kt:255 (the TopAppBar call inside SelectFactorUI)
84a8b5d to
d382bd5
Compare
There was a problem hiding this comment.
A few bits of feedback
topAppBarColors on AuthUITheme (and the matching copy() param) is typed as TopAppBarColors, which is still @ExperimentalMaterial3Api, but neither is annotated. Anyone who actually sets it - the whole point of this PR -gets a compile error with no hint why unless they already have @OptIn in scope elsewhere. Can you propagate the opt-in onto the property and the copy() param?
see auth/src/main/java/com/firebase/ui/auth/configuration/theme/AuthUITheme.kt:90 and :110
Same issue bites the demo itself — TopAppBarColors(...) is constructed inside onCreate/setContent, but the only @OptIn(ExperimentalMaterial3Api::class) in the file is on the unrelated composable further down. As it stands this won't compile.
see app/src/main/java/com/firebaseui/android/demo/HighLevelApiDemoActivity.kt:88 (missing @OptIn on onCreate, existing one is at line 252)
Nit: README and demo both construct TopAppBarColors(...) with all six params instead of going through TopAppBarDefaults.topAppBarColors(...) like the rest of the codebase does (including our own default at AuthUITheme.kt:247). Worth switching for consistency and so we don't break if Material3 adds params later.
I think it compiles fine. In newer versions of compose bom the APIs are now stable, before the compose bom was updated this (i.e. |
Valid point, i'll make the necessary changes to the demo and README. |
d382bd5 to
1ecd498
Compare
|
@russellwheatley anything else blocking this from being merged? |
|
@demolaf - just the merge conflict and I think we're good to go 👍 |
…AppBarDefaults factory for topAppBarColors
10ab21e to
223eb77
Compare
…2404) * fix(auth): validate display name only when required in sign-up form (#2383) * fix(auth): validate display name only when required in sign-up form * fix(auth): use locale-safe matcher for sign-up button in test * fix(internal): append CHAR_LIMIT to translation descriptions in export script (#2417) Fixes #1613 * fix(auth): mitigate tapjacking on the auth activity window (#2416) Fixes #2041 * sample(app): add Firestore, Database & Storage demos to sample app (#2406) * fix(auth): allow customizing top app bar colors via AuthUITheme (#2391) * fix(auth): handle edge-to-edge insets in MFA challenge and auth screens (#2413) * fix(auth): use fixed padding for method picker provider buttons (#2424) (#2426) * fix(firestore): catch InterruptedException in FirestorePagingSource * fix(firestore): drop load error logging and restore rx error handler in test * fix(firestore): return LoadResult.Error for every load failure instead of throwing * fix(firestore): fix PageKey.equals NPE on null snapshots and add hashCode * test(firestore): run paging source test in CI via robolectric and replace sleeps with latches * fix(firestore): log genuine load failures while keeping cancellations silent --------- Co-authored-by: Oluwatobi Shokunbi <ayoshokz@gmail.com>
Fixes #2390.
AuthUITheme.topAppBarColorswas a companion-object getter derived from the ambientMaterialTheme.colorScheme, so there was no way to override it perAuthUIThemeinstance — apps couldn't align the auth screens' top app bar with their own branding.Usage
Preview