@@ -3,6 +3,7 @@ package com.firebase.ui.auth.compose.ui.screens
33import android.content.Context
44import android.os.Looper
55import androidx.compose.runtime.Composable
6+ import androidx.compose.runtime.CompositionLocalProvider
67import androidx.compose.runtime.collectAsState
78import androidx.compose.runtime.getValue
89import androidx.compose.ui.test.assertIsDisplayed
@@ -22,16 +23,11 @@ import com.firebase.ui.auth.compose.configuration.authUIConfiguration
2223import com.firebase.ui.auth.compose.configuration.auth_provider.AuthProvider
2324import com.firebase.ui.auth.compose.configuration.string_provider.AuthUIStringProvider
2425import com.firebase.ui.auth.compose.configuration.string_provider.DefaultAuthUIStringProvider
26+ import com.firebase.ui.auth.compose.configuration.string_provider.LocalAuthUIStringProvider
2527import com.firebase.ui.auth.compose.testutil.AUTH_STATE_WAIT_TIMEOUT_MS
2628import com.firebase.ui.auth.compose.testutil.EmulatorAuthApi
27- import com.firebase.ui.auth.compose.testutil.awaitWithLooper
2829import com.firebase.ui.auth.compose.testutil.ensureFreshUser
2930import com.firebase.ui.auth.compose.testutil.verifyEmailInEmulator
30- import com.firebase.ui.auth.compose.ui.screens.EmailAuthMode
31- import com.firebase.ui.auth.compose.ui.screens.EmailAuthScreen
32- import com.firebase.ui.auth.compose.ui.screens.ResetPasswordUI
33- import com.firebase.ui.auth.compose.ui.screens.SignInUI
34- import com.firebase.ui.auth.compose.ui.screens.SignUpUI
3531import com.google.common.truth.Truth.assertThat
3632import com.google.firebase.FirebaseApp
3733import com.google.firebase.FirebaseOptions
@@ -540,57 +536,61 @@ class EmailAuthScreenTest {
540536 onError : ((AuthException ) -> Unit ) = {},
541537 onCancel : (() -> Unit ) = {},
542538 ) {
543- EmailAuthScreen (
544- context = applicationContext,
545- configuration = configuration,
546- authUI = authUI,
547- onSuccess = onSuccess,
548- onError = onError,
549- onCancel = onCancel,
550- ) { state ->
551- when (state.mode) {
552- EmailAuthMode .SignIn -> {
553- SignInUI (
554- configuration = configuration,
555- email = state.email,
556- isLoading = state.isLoading,
557- emailSignInLinkSent = state.emailSignInLinkSent,
558- password = state.password,
559- onEmailChange = state.onEmailChange,
560- onPasswordChange = state.onPasswordChange,
561- onSignInClick = state.onSignInClick,
562- onGoToSignUp = state.onGoToSignUp,
563- onGoToResetPassword = state.onGoToResetPassword,
564- )
565- }
566-
567- EmailAuthMode .SignUp -> {
568- SignUpUI (
569- configuration = configuration,
570- isLoading = state.isLoading,
571- displayName = state.displayName,
572- email = state.email,
573- password = state.password,
574- confirmPassword = state.confirmPassword,
575- onDisplayNameChange = state.onDisplayNameChange,
576- onEmailChange = state.onEmailChange,
577- onPasswordChange = state.onPasswordChange,
578- onConfirmPasswordChange = state.onConfirmPasswordChange,
579- onSignUpClick = state.onSignUpClick,
580- onGoToSignIn = state.onGoToSignIn,
581- )
582- }
583-
584- EmailAuthMode .ResetPassword -> {
585- ResetPasswordUI (
586- configuration = configuration,
587- isLoading = state.isLoading,
588- email = state.email,
589- resetLinkSent = state.resetLinkSent,
590- onEmailChange = state.onEmailChange,
591- onSendResetLink = state.onSendResetLinkClick,
592- onGoToSignIn = state.onGoToSignIn
593- )
539+ CompositionLocalProvider (
540+ LocalAuthUIStringProvider provides DefaultAuthUIStringProvider (applicationContext)
541+ ) {
542+ EmailAuthScreen (
543+ context = applicationContext,
544+ configuration = configuration,
545+ authUI = authUI,
546+ onSuccess = onSuccess,
547+ onError = onError,
548+ onCancel = onCancel,
549+ ) { state ->
550+ when (state.mode) {
551+ EmailAuthMode .SignIn -> {
552+ SignInUI (
553+ configuration = configuration,
554+ email = state.email,
555+ isLoading = state.isLoading,
556+ emailSignInLinkSent = state.emailSignInLinkSent,
557+ password = state.password,
558+ onEmailChange = state.onEmailChange,
559+ onPasswordChange = state.onPasswordChange,
560+ onSignInClick = state.onSignInClick,
561+ onGoToSignUp = state.onGoToSignUp,
562+ onGoToResetPassword = state.onGoToResetPassword,
563+ )
564+ }
565+
566+ EmailAuthMode .SignUp -> {
567+ SignUpUI (
568+ configuration = configuration,
569+ isLoading = state.isLoading,
570+ displayName = state.displayName,
571+ email = state.email,
572+ password = state.password,
573+ confirmPassword = state.confirmPassword,
574+ onDisplayNameChange = state.onDisplayNameChange,
575+ onEmailChange = state.onEmailChange,
576+ onPasswordChange = state.onPasswordChange,
577+ onConfirmPasswordChange = state.onConfirmPasswordChange,
578+ onSignUpClick = state.onSignUpClick,
579+ onGoToSignIn = state.onGoToSignIn,
580+ )
581+ }
582+
583+ EmailAuthMode .ResetPassword -> {
584+ ResetPasswordUI (
585+ configuration = configuration,
586+ isLoading = state.isLoading,
587+ email = state.email,
588+ resetLinkSent = state.resetLinkSent,
589+ onEmailChange = state.onEmailChange,
590+ onSendResetLink = state.onSendResetLinkClick,
591+ onGoToSignIn = state.onGoToSignIn
592+ )
593+ }
594594 }
595595 }
596596 }
0 commit comments