Skip to content

Commit

Permalink
[feature/#1011] 화면 별로 AuthStatus 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeyubin committed Jan 2, 2025
1 parent bdb0e67 commit fba3641
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ internal fun AuthScreen(
authMainNavGraph(
navigateToUnAuthenticatedHome = navigateToUnAuthenticatedHome,
onGoogleLoginCLick = onGoogleLoginCLick,
navigateToCertification = navController::navigateCertification,
navigateToCertification = { status ->
navController.navigateCertification(status)
},
navigateToChannel = navigateToChannel
)
certificationNavGraph(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,22 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import kotlinx.coroutines.delay
import org.sopt.official.R
import org.sopt.official.designsystem.Gray300
import org.sopt.official.designsystem.Gray700
import org.sopt.official.designsystem.SoptTheme
import org.sopt.official.designsystem.White
import org.sopt.official.feature.auth.AuthViewModel
import org.sopt.official.feature.auth.component.AuthButton
import org.sopt.official.feature.auth.component.AuthTextWithArrow
import org.sopt.official.feature.auth.component.LoginErrorDialog
import org.sopt.official.feature.auth.model.AuthStatus

@Composable
internal fun AuthMainRoute(
viewModel: AuthViewModel = hiltViewModel(),
navigateToUnAuthenticatedHome: () -> Unit,
onGoogleLoginCLick: () -> Unit,
navigateToCertification: () -> Unit,
navigateToCertification: (AuthStatus) -> Unit,
navigateToChannel: () -> Unit
) {
var loginDialogVisibility by remember { mutableStateOf(false) }
Expand All @@ -60,11 +58,11 @@ internal fun AuthMainRoute(
loginDialogVisibility = false
},
onFindAccountClick = {
navigateToCertification()
navigateToCertification(AuthStatus.SEARCH)
loginDialogVisibility = false
},
onResetAccountClick = {
navigateToCertification()
navigateToCertification(AuthStatus.CHANGE)
loginDialogVisibility = false
},
onContactChannelClick = {
Expand All @@ -78,13 +76,11 @@ internal fun AuthMainRoute(
showDialog = {
loginDialogVisibility = true
},
onGoogleLoginCLick = {
onGoogleLoginCLick()
},
onLoginLaterClick = {
navigateToUnAuthenticatedHome()
},
navigateToCertification = navigateToCertification
onGoogleLoginCLick = onGoogleLoginCLick,
onLoginLaterClick = navigateToUnAuthenticatedHome,
navigateToCertification = {
navigateToCertification(AuthStatus.REGISTER)
}
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import kotlinx.serialization.Serializable
import org.sopt.official.feature.auth.feature.authmain.AuthMainRoute
import org.sopt.official.feature.auth.model.AuthStatus

fun NavGraphBuilder.authMainNavGraph(
navigateToUnAuthenticatedHome: () -> Unit,
onGoogleLoginCLick: () -> Unit,
navigateToCertification: () -> Unit,
navigateToChannel:()-> Unit
navigateToCertification: (AuthStatus) -> Unit,
navigateToChannel: () -> Unit
) {
composable<AuthMainNavigation> {
AuthMainRoute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
Expand All @@ -66,12 +69,14 @@ import org.sopt.official.feature.auth.component.AuthButton
import org.sopt.official.feature.auth.component.AuthTextField
import org.sopt.official.feature.auth.component.AuthTextWithArrow
import org.sopt.official.feature.auth.component.PhoneCertification
import org.sopt.official.feature.auth.model.AuthStatus

@Composable
internal fun CertificationRoute(
status: AuthStatus,
onBackClick: () -> Unit,
onShowSnackBar: () -> Unit,
navigateToSocialAccount:()-> Unit,
navigateToSocialAccount: () -> Unit,
viewModel: CertificationViewModel = hiltViewModel()
) {
val lifecycleOwner = LocalLifecycleOwner.current
Expand All @@ -84,12 +89,14 @@ internal fun CertificationRoute(
is CertificationSideEffect.ShowToast -> {
context.toast(sideEffect.message)
}

is CertificationSideEffect.NavigateToSocialAccount -> navigateToSocialAccount()
}
}
}

CertificationScreen(
status = status,
onBackClick = onBackClick,
onCreateCodeClick = {
onShowSnackBar()
Expand All @@ -103,6 +110,7 @@ internal fun CertificationRoute(

@Composable
private fun CertificationScreen(
status: AuthStatus,
onBackClick: () -> Unit,
onCreateCodeClick: () -> Unit,
onCertificateClick: () -> Unit
Expand Down Expand Up @@ -135,34 +143,36 @@ private fun CertificationScreen(
hintText = "인증번호를 입력해 주세요.",
onTextChange = {},
)
Spacer(modifier = Modifier.height(41.dp))
AuthButton(
modifier = Modifier
.fillMaxWidth()
.border(
color = Blue500,
width = 1.dp,
shape = RoundedCornerShape(10.dp)
),
padding = PaddingValues(vertical = 14.dp, horizontal = 18.dp),
onClick = {},
containerColor = BlueAlpha100,
) {
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
Image(
painterResource(id = ic_auth_memeber_error),
contentDescription = "에러 아이콘",
)
Column {
AuthTextWithArrow(
text = "SOPT 회원 인증에 실패하셨나요?",
textStyle = SoptTheme.typography.body14M
)
Spacer(modifier = Modifier.height(10.dp))
Text(
text = "번호가 바뀌었거나, 인증이 어려우신 경우 추가 정보 인증을 통해 가입을 도와드리고 있어요!",
color = Gray60
if (status == AuthStatus.REGISTER) {
Spacer(modifier = Modifier.height(41.dp))
AuthButton(
modifier = Modifier
.fillMaxWidth()
.border(
color = Blue500,
width = 1.dp,
shape = RoundedCornerShape(10.dp)
),
padding = PaddingValues(vertical = 14.dp, horizontal = 18.dp),
onClick = {},
containerColor = BlueAlpha100,
) {
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
Image(
painterResource(id = ic_auth_memeber_error),
contentDescription = "에러 아이콘",
)
Column {
AuthTextWithArrow(
text = "SOPT 회원 인증에 실패하셨나요?",
textStyle = SoptTheme.typography.body14M
)
Spacer(modifier = Modifier.height(10.dp))
Text(
text = "번호가 바뀌었거나, 인증이 어려우신 경우 추가 정보 인증을 통해 가입을 도와드리고 있어요!",
color = Gray60
)
}
}
}
}
Expand Down Expand Up @@ -235,6 +245,7 @@ internal enum class ErrorCase(val message: String) {
private fun AuthCertificationPreview() {
SoptTheme {
CertificationScreen(
status = AuthStatus.REGISTER,
onBackClick = {},
onCreateCodeClick = {},
onCertificateClick = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import androidx.navigation.toRoute
import kotlinx.serialization.Serializable
import org.sopt.official.feature.auth.feature.certificate.CertificationRoute
import org.sopt.official.feature.auth.model.AuthStatus

fun NavController.navigateCertification(
status: AuthStatus,
navOptions: NavOptions? = null
) {
navigate(
route = CertificationNavigation,
route = CertificationNavigation(status = status),
navOptions = navOptions
)
}
Expand All @@ -22,7 +25,9 @@ fun NavGraphBuilder.certificationNavGraph(
navigateToSocialAccount: () -> Unit
) {
composable<CertificationNavigation> {
val args = it.toRoute<CertificationNavigation>()
CertificationRoute(
status = args.status,
onBackClick = onBackClick,
onShowSnackBar = onShowSnackBar,
navigateToSocialAccount = navigateToSocialAccount
Expand All @@ -31,4 +36,6 @@ fun NavGraphBuilder.certificationNavGraph(
}

@Serializable
data object CertificationNavigation
data class CertificationNavigation(
val status: AuthStatus
)

0 comments on commit fba3641

Please sign in to comment.