Skip to content

Commit

Permalink
[feature/#1011] 화면 간 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeyubin committed Jan 2, 2025
1 parent fc04b47 commit bdb0e67
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 13 deletions.
20 changes: 10 additions & 10 deletions app/src/main/java/org/sopt/official/feature/auth/AuthScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 = {}
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -83,6 +84,7 @@ internal fun CertificationRoute(
is CertificationSideEffect.ShowToast -> {
context.toast(sideEffect.message)
}
is CertificationSideEffect.NavigateToSocialAccount -> navigateToSocialAccount()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Original file line number Diff line number Diff line change
Expand Up @@ -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("실패ㅠㅠ"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ fun NavController.navigateCertification(

fun NavGraphBuilder.certificationNavGraph(
onBackClick: () -> Unit,
onShowSnackBar: () -> Unit
onShowSnackBar: () -> Unit,
navigateToSocialAccount: () -> Unit
) {
composable<CertificationNavigation> {
CertificationRoute(
onBackClick = onBackClick,
onShowSnackBar = onShowSnackBar
onShowSnackBar = onShowSnackBar,
navigateToSocialAccount = navigateToSocialAccount
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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<SocialAccount>(
) {
SocialAccountRoute(
onGoogleLoginCLick = onGoogleLoginCLick
)
}
}

@Serializable
data object SocialAccount

0 comments on commit bdb0e67

Please sign in to comment.