From fbe77c01dec3588284bca648315fcb1426ca4f74 Mon Sep 17 00:00:00 2001 From: sheikh-20 Date: Wed, 26 Jun 2024 11:26:25 +0530 Subject: [PATCH] login response UI updated --- app/build.gradle.kts | 4 ++-- .../com/application/moviesapp/ui/detail/DetailScreen.kt | 2 +- .../ui/onboarding/login/LoginWithPasswordScreen.kt | 8 +++++++- .../ui/onboarding/signup/SignupWithPasswordScreen.kt | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 23cf02b..b84993d 100755 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -53,8 +53,8 @@ android { applicationId = "com.application.moviesapp" minSdk = 24 targetSdk = 33 - versionCode = 22 - versionName = "1.0.21" + versionCode = 23 + versionName = "1.0.22" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { diff --git a/app/src/main/java/com/application/moviesapp/ui/detail/DetailScreen.kt b/app/src/main/java/com/application/moviesapp/ui/detail/DetailScreen.kt index 109e711..3653e99 100755 --- a/app/src/main/java/com/application/moviesapp/ui/detail/DetailScreen.kt +++ b/app/src/main/java/com/application/moviesapp/ui/detail/DetailScreen.kt @@ -1049,7 +1049,7 @@ fun CommentsCompose(modifier: Modifier = Modifier, contentPadding = PaddingValues(horizontal = 16.dp), ) { - items(userReviewFlow.itemCount) { index -> + items(userReviewFlow.itemCount.until(2).last) { index -> CommentsPeopleCompose(review = userReviewFlow[index] ?: return@items) } } diff --git a/app/src/main/java/com/application/moviesapp/ui/onboarding/login/LoginWithPasswordScreen.kt b/app/src/main/java/com/application/moviesapp/ui/onboarding/login/LoginWithPasswordScreen.kt index d9667ed..9901fbc 100755 --- a/app/src/main/java/com/application/moviesapp/ui/onboarding/login/LoginWithPasswordScreen.kt +++ b/app/src/main/java/com/application/moviesapp/ui/onboarding/login/LoginWithPasswordScreen.kt @@ -59,6 +59,7 @@ import com.application.moviesapp.ui.onboarding.component.SocialLoginComponent import com.application.moviesapp.ui.theme.MoviesAppTheme import com.application.moviesapp.ui.viewmodel.OnboardUIState import com.google.firebase.auth.AuthResult +import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException import com.google.firebase.auth.FirebaseAuthInvalidUserException import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.collectLatest @@ -116,7 +117,11 @@ fun LoginWithPasswordScreen(modifier: Modifier = Modifier, isLoading = false if (it.throwable is FirebaseAuthInvalidUserException) { snackbarHostState.showSnackbar(message = "Email does not exists, Try signup!") - } else { + } + else if (it.throwable is FirebaseAuthInvalidCredentialsException) { + snackbarHostState.showSnackbar(message = "Incorrect email or password") + } + else { snackbarHostState.showSnackbar(message = "Failure!") Timber.tag("Login").e(it.throwable) } @@ -185,6 +190,7 @@ fun LoginWithPasswordScreen(modifier: Modifier = Modifier, shape = RoundedCornerShape(50) ) .fillMaxWidth(), + enabled = email.contains("@") && password.isNotEmpty(), colors = ButtonDefaults.filledTonalButtonColors(containerColor = Color.Red)) { if (isLoading) { diff --git a/app/src/main/java/com/application/moviesapp/ui/onboarding/signup/SignupWithPasswordScreen.kt b/app/src/main/java/com/application/moviesapp/ui/onboarding/signup/SignupWithPasswordScreen.kt index 1272de1..7f40e6e 100755 --- a/app/src/main/java/com/application/moviesapp/ui/onboarding/signup/SignupWithPasswordScreen.kt +++ b/app/src/main/java/com/application/moviesapp/ui/onboarding/signup/SignupWithPasswordScreen.kt @@ -198,7 +198,7 @@ fun SignupWithPasswordScreen(modifier: Modifier = Modifier, shape = RoundedCornerShape(50) ) .fillMaxWidth(), - enabled = isTermsConditions, + enabled = isTermsConditions && email.contains("@") && password.isNotEmpty(), colors = ButtonDefaults.filledTonalButtonColors(containerColor = Color.Red)) { if (isLoading) {