From bdb0e677d9af9079593c8f117c7b3e58970ffaae Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 2 Jan 2025 09:29:13 +0900 Subject: [PATCH] =?UTF-8?q?[feature/#1011]=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EA=B0=84=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/official/feature/auth/AuthScreen.kt | 20 ++++++------ .../certificate/CertificationScreen.kt | 2 ++ .../certificate/CertificationSideEffect.kt | 1 + .../certificate/CertificationViewModel.kt | 2 +- .../navigation/CertificationNavigation.kt | 6 ++-- .../navigation/SocialAccountNavigation.kt | 31 +++++++++++++++++++ 6 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 app/src/main/java/org/sopt/official/feature/auth/feature/socialaccount/navigation/SocialAccountNavigation.kt diff --git a/app/src/main/java/org/sopt/official/feature/auth/AuthScreen.kt b/app/src/main/java/org/sopt/official/feature/auth/AuthScreen.kt index 3fb69c163..f2803075b 100644 --- a/app/src/main/java/org/sopt/official/feature/auth/AuthScreen.kt +++ b/app/src/main/java/org/sopt/official/feature/auth/AuthScreen.kt @@ -23,6 +23,8 @@ import org.sopt.official.feature.auth.feature.authmain.navigation.AuthMainNaviga import org.sopt.official.feature.auth.feature.authmain.navigation.authMainNavGraph import org.sopt.official.feature.auth.feature.certificate.navigation.certificationNavGraph import org.sopt.official.feature.auth.feature.certificate.navigation.navigateCertification +import org.sopt.official.feature.auth.feature.socialaccount.navigation.navigateSocialAccount +import org.sopt.official.feature.auth.feature.socialaccount.navigation.socialAccountNavGraph @Composable internal fun AuthScreen( @@ -69,20 +71,18 @@ internal fun AuthScreen( startDestination = AuthMainNavigation ) { authMainNavGraph( - navigateToUnAuthenticatedHome = { - navigateToUnAuthenticatedHome() - }, - onGoogleLoginCLick = { - onGoogleLoginCLick() - }, - navigateToCertification = { - navController.navigateCertification() - }, + navigateToUnAuthenticatedHome = navigateToUnAuthenticatedHome, + onGoogleLoginCLick = onGoogleLoginCLick, + navigateToCertification = navController::navigateCertification, navigateToChannel = navigateToChannel ) certificationNavGraph( onBackClick = navController::navigateUp, - onShowSnackBar = onShowSnackBar + onShowSnackBar = onShowSnackBar, + navigateToSocialAccount = navController::navigateSocialAccount + ) + socialAccountNavGraph( + onGoogleLoginCLick = {} ) } } diff --git a/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/CertificationScreen.kt b/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/CertificationScreen.kt index 7301b2219..4bf22bac5 100644 --- a/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/CertificationScreen.kt +++ b/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/CertificationScreen.kt @@ -71,6 +71,7 @@ import org.sopt.official.feature.auth.component.PhoneCertification internal fun CertificationRoute( onBackClick: () -> Unit, onShowSnackBar: () -> Unit, + navigateToSocialAccount:()-> Unit, viewModel: CertificationViewModel = hiltViewModel() ) { val lifecycleOwner = LocalLifecycleOwner.current @@ -83,6 +84,7 @@ internal fun CertificationRoute( is CertificationSideEffect.ShowToast -> { context.toast(sideEffect.message) } + is CertificationSideEffect.NavigateToSocialAccount -> navigateToSocialAccount() } } } diff --git a/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/CertificationSideEffect.kt b/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/CertificationSideEffect.kt index e6af9064d..636655347 100644 --- a/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/CertificationSideEffect.kt +++ b/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/CertificationSideEffect.kt @@ -2,4 +2,5 @@ package org.sopt.official.feature.auth.feature.certificate sealed class CertificationSideEffect { data class ShowToast(val message: String): CertificationSideEffect() + data object NavigateToSocialAccount: CertificationSideEffect() } \ No newline at end of file diff --git a/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/CertificationViewModel.kt b/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/CertificationViewModel.kt index 864d6317b..39e5507fc 100644 --- a/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/CertificationViewModel.kt +++ b/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/CertificationViewModel.kt @@ -46,7 +46,7 @@ class CertificationViewModel @Inject constructor( type = AuthStatus.REGISTER.type ) ).onSuccess { - _sideEffect.emit(CertificationSideEffect.ShowToast("성공!!!")) + _sideEffect.emit(CertificationSideEffect.NavigateToSocialAccount) }.onFailure { _sideEffect.emit(CertificationSideEffect.ShowToast("실패ㅠㅠ")) } diff --git a/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/navigation/CertificationNavigation.kt b/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/navigation/CertificationNavigation.kt index 8cdda07e0..5b910402c 100644 --- a/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/navigation/CertificationNavigation.kt +++ b/app/src/main/java/org/sopt/official/feature/auth/feature/certificate/navigation/CertificationNavigation.kt @@ -18,12 +18,14 @@ fun NavController.navigateCertification( fun NavGraphBuilder.certificationNavGraph( onBackClick: () -> Unit, - onShowSnackBar: () -> Unit + onShowSnackBar: () -> Unit, + navigateToSocialAccount: () -> Unit ) { composable { CertificationRoute( onBackClick = onBackClick, - onShowSnackBar = onShowSnackBar + onShowSnackBar = onShowSnackBar, + navigateToSocialAccount = navigateToSocialAccount ) } } diff --git a/app/src/main/java/org/sopt/official/feature/auth/feature/socialaccount/navigation/SocialAccountNavigation.kt b/app/src/main/java/org/sopt/official/feature/auth/feature/socialaccount/navigation/SocialAccountNavigation.kt new file mode 100644 index 000000000..fd0d4df2d --- /dev/null +++ b/app/src/main/java/org/sopt/official/feature/auth/feature/socialaccount/navigation/SocialAccountNavigation.kt @@ -0,0 +1,31 @@ +package org.sopt.official.feature.auth.feature.socialaccount.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import kotlinx.serialization.Serializable +import org.sopt.official.feature.auth.feature.socialaccount.SocialAccountRoute + +fun NavController.navigateSocialAccount( + navOptions: NavOptions? = null +) { + navigate( + route = SocialAccount, + navOptions = navOptions + ) +} + +fun NavGraphBuilder.socialAccountNavGraph( + onGoogleLoginCLick: () -> Unit +) { + composable( + ) { + SocialAccountRoute( + onGoogleLoginCLick = onGoogleLoginCLick + ) + } +} + +@Serializable +data object SocialAccount \ No newline at end of file