diff --git a/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/LoginActivity.kt b/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/LoginActivity.kt index 83357f7..437cd7f 100644 --- a/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/LoginActivity.kt +++ b/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/LoginActivity.kt @@ -5,9 +5,20 @@ import android.content.Intent import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.navigation.NavHostController +import androidx.navigation.compose.NavHost +import androidx.navigation.compose.composable +import androidx.navigation.compose.rememberNavController import com.meongmoryteam.presentation.ui.theme.MeongmoryTheme import dagger.hilt.android.AndroidEntryPoint +sealed class LoginNaviRoute(val route: String) { + object CertificationScreen : LoginNaviRoute("CertificationScreen") + object TermScreen : LoginNaviRoute("TermScreen") +} + @AndroidEntryPoint class LoginActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { @@ -19,7 +30,7 @@ class LoginActivity : ComponentActivity() { private fun setUnivSelectScreen() { setContent { MeongmoryTheme { - LoginScreen() + LoginNavigation() } } } @@ -30,4 +41,23 @@ class LoginActivity : ComponentActivity() { context.startActivity(intent) } } +} + +@Composable +fun LoginNavigation( + modifier: Modifier = Modifier, + navController: NavHostController = rememberNavController() +) { + NavHost( + navController = navController, + startDestination = LoginNaviRoute.CertificationScreen.route, + modifier = modifier + ) { + composable(route = LoginNaviRoute.CertificationScreen.route) { + LoginScreen( + navController = navController, + navigateToTermScreen = { navController.navigate(LoginNaviRoute.TermScreen.route) } + ) + } + } } \ No newline at end of file diff --git a/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/LoginScreen.kt b/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/LoginScreen.kt index 58de1f6..02157f8 100644 --- a/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/LoginScreen.kt +++ b/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/LoginScreen.kt @@ -29,9 +29,12 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.hilt.navigation.compose.hiltViewModel +import androidx.navigation.NavHostController +import androidx.navigation.compose.rememberNavController import com.meongmoryteam.presentation.R import com.meongmoryteam.presentation.base.TextButtonComponent import com.meongmoryteam.presentation.base.TextFieldComponent +import com.meongmoryteam.presentation.ui.register_family.RouteScreen import com.meongmoryteam.presentation.ui.theme.ButtonContent import com.meongmoryteam.presentation.ui.theme.DarkGrey import com.meongmoryteam.presentation.ui.theme.LightGrey @@ -43,7 +46,9 @@ import kotlinx.coroutines.launch @Composable fun LoginScreen( + navController: NavHostController, loginViewModel: LoginViewModel = hiltViewModel(), + navigateToTermScreen: () -> Unit, ) { val loginViewState by loginViewModel.viewState.collectAsState() @@ -76,7 +81,7 @@ fun LoginScreen( .height(50.dp) .padding(horizontal = 16.dp), ) { - + loginViewModel.setEvent(LoginContract.LoginEvent.ToTermScreenButtonClicked) } } @@ -84,7 +89,7 @@ fun LoginScreen( loginViewModel.effect.collect { effect -> when (effect) { is LoginContract.LoginEffect.MoveToTerm -> { - + navigateToTermScreen() } is LoginContract.LoginEffect.FailCertification -> { /*