Skip to content

Commit

Permalink
✨ :: Connect the find password
Browse files Browse the repository at this point in the history
  • Loading branch information
diejdkll committed Feb 28, 2024
1 parent aa5cffb commit d5a7257
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 9 deletions.
16 changes: 14 additions & 2 deletions app/src/main/java/com/msg/dotori/DotoriNavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import com.msg.presentation.view.find_password.navigation.findPasswordScreen
import com.msg.presentation.view.find_password.navigation.navigateToFindPassword
import com.msg.presentation.view.find_password.navigation.navigateToPasswordAuthentication
import com.msg.presentation.view.find_password.navigation.passwordAuthenticationScreen
import com.msg.presentation.view.home.navigation.mainScreen
import com.msg.presentation.view.home.navigation.navigateToMain
import com.msg.presentation.view.login.navigation.loginScreen
Expand Down Expand Up @@ -39,7 +42,8 @@ fun DotoriNavHost(
) {
loginScreen(
navigateToMain = { navController.navigateToMain() },
navigateToSignUp = { navController.navigateToSignUp() }
navigateToSignUp = { navController.navigateToSignUp() },
navigateToFindPassword = { navController.navigateToPasswordAuthentication() }
)
signUpScreen(
viewModelStoreOwner = viewModelStoreOwner,
Expand All @@ -58,7 +62,15 @@ fun DotoriNavHost(
navigateToBack = { navController.popBackStack() },
navigateToLogin = { navController.navigateToLogin() }
)
findPasswordScreen()
passwordAuthenticationScreen(
navigateToBack = { navController.popBackStack() },
navigateToLogin = { navController.navigateToLogin() },
navigateToFindPassword = { navController.navigateToFindPassword() }
)
findPasswordScreen(
navigateToBack = { navController.popBackStack() },
navigateToLogin = { navController.navigateToLogin() }
)
massageChairScreen()
selfStudyScreen()
musicScreen()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,41 @@ import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.msg.presentation.view.find_password.FindPasswordScreen
import com.msg.presentation.view.find_password.PasswordAuthenticationScreen

const val passwordAuthenticationRoute = "password_authentication_route"
const val findPasswordRoute = "find_password_route"

fun NavController.navigateToPasswordAuthentication() {
this.navigate(passwordAuthenticationRoute)
}

fun NavGraphBuilder.passwordAuthenticationScreen(
navigateToBack: () -> Unit,
navigateToLogin: () -> Unit,
navigateToFindPassword: () -> Unit
) {
composable(passwordAuthenticationRoute) {
PasswordAuthenticationScreen(
navigateToBack = navigateToBack,
navigateToLogin = navigateToLogin,
navigateToFindPassword = navigateToFindPassword
)
}
}

fun NavController.navigateToFindPassword() {
this.navigate(findPasswordRoute)
}

fun NavGraphBuilder.findPasswordScreen() {
fun NavGraphBuilder.findPasswordScreen(
navigateToBack: () -> Unit,
navigateToLogin: () -> Unit
) {
composable(findPasswordRoute) {
FindPasswordScreen()
FindPasswordScreen(
navigateToBack = navigateToBack,
navigateToLogin = navigateToLogin
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ fun LoginScreen(
modifier: Modifier = Modifier,
loginViewModel: LoginViewModel = hiltViewModel(),
navigateToMain: () -> Unit,
navigateToSignUp: () -> Unit
navigateToSignUp: () -> Unit,
navigateToFindPassword: () -> Unit
) {
val context = LocalContext.current
var idText by remember { mutableStateOf("") }
Expand Down Expand Up @@ -138,7 +139,7 @@ fun LoginScreen(
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = null
) {},
) { navigateToFindPassword() },
text = "비밀번호 찾기",
style = DotoriTheme.typography.body2,
color = DotoriTheme.colors.neutral20,
Expand Down Expand Up @@ -191,6 +192,7 @@ fun LoginScreen(
@Composable
fun LoginScreenPreview() {
LoginScreen(
navigateToMain = {}
navigateToMain = {},
navigateToSignUp = {}
) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ fun NavController.navigateToLogin() {

fun NavGraphBuilder.loginScreen(
navigateToMain: () -> Unit,
navigateToSignUp: () -> Unit
navigateToSignUp: () -> Unit,
navigateToFindPassword: () -> Unit
) {
composable(loginRoute) {
LoginScreen(
navigateToMain = navigateToMain,
navigateToSignUp = navigateToSignUp
navigateToSignUp = navigateToSignUp,
navigateToFindPassword = navigateToFindPassword
)
}
}

0 comments on commit d5a7257

Please sign in to comment.