From 9358244b7309f526e4710d2746f23083933b34a5 Mon Sep 17 00:00:00 2001 From: sheikh-20 Date: Fri, 28 Jun 2024 18:40:47 +0530 Subject: [PATCH] login snackbar UI updated --- app/build.gradle.kts | 4 ++-- .../application/moviesapp/ui/onboarding/OnboardingApp.kt | 1 - .../ui/onboarding/login/LoginWithPasswordScreen.kt | 9 ++++++++- .../ui/onboarding/signup/SignupWithPasswordScreen.kt | 9 +++++++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c009308..8ad0eb0 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 = 24 - versionName = "1.0.23" + versionCode = 25 + versionName = "1.0.24" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { diff --git a/app/src/main/java/com/application/moviesapp/ui/onboarding/OnboardingApp.kt b/app/src/main/java/com/application/moviesapp/ui/onboarding/OnboardingApp.kt index 95c4540..687ba88 100755 --- a/app/src/main/java/com/application/moviesapp/ui/onboarding/OnboardingApp.kt +++ b/app/src/main/java/com/application/moviesapp/ui/onboarding/OnboardingApp.kt @@ -99,7 +99,6 @@ fun OnboardingApp(modifier: Modifier = Modifier, Spacer(modifier = modifier.weight(1f)) - Text( text = it.visuals.actionLabel ?: "", fontWeight = FontWeight.SemiBold, 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 13574bb..59ef0c5 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 @@ -25,6 +25,7 @@ import androidx.compose.material3.Divider import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.SnackbarHostState +import androidx.compose.material3.SnackbarResult import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable @@ -51,6 +52,7 @@ import com.application.moviesapp.R import com.application.moviesapp.data.common.Resource import com.application.moviesapp.domain.usecase.SignInGoogleInteractor import com.application.moviesapp.ui.accountsetup.AccountSetupActivity +import com.application.moviesapp.ui.home.BottomNavigationScreens import com.application.moviesapp.ui.home.HomeActivity import com.application.moviesapp.ui.onboarding.OnboardingActivity import com.application.moviesapp.ui.onboarding.component.EmailComponent @@ -116,7 +118,12 @@ fun LoginWithPasswordScreen(modifier: Modifier = Modifier, is Resource.Failure -> { isLoading = false if (it.throwable is FirebaseAuthInvalidUserException) { - snackbarHostState.showSnackbar(message = "Email does not exists, Try signup!") + val result = snackbarHostState.showSnackbar(message = "Email does not exists", actionLabel = "Try signup!") + + when (result) { + SnackbarResult.ActionPerformed -> onSignupClick() + else -> { } + } } else if (it.throwable is FirebaseAuthInvalidCredentialsException) { snackbarHostState.showSnackbar(message = "Incorrect email or password") 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 1e1f272..40a15f0 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 @@ -36,6 +36,7 @@ import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.SnackbarHostState +import androidx.compose.material3.SnackbarResult import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable @@ -125,8 +126,12 @@ fun SignupWithPasswordScreen(modifier: Modifier = Modifier, isLoading = false if (it.throwable is FirebaseAuthUserCollisionException) { - snackbarHostState.showSnackbar(message = "Already created, Try Login!") - Timber.tag("Login").e(it.throwable) + val result = snackbarHostState.showSnackbar(message = "Already created", actionLabel = "Try Login!") + + when (result) { + SnackbarResult.ActionPerformed -> onSignInClick() + else -> { } + } } else { snackbarHostState.showSnackbar(message = "Failure!") Timber.tag("Login").e(it.throwable)