diff --git a/core/common/src/main/java/com/teamwiney/core/common/base/CommonResponseStatus.kt b/core/common/src/main/java/com/teamwiney/core/common/base/CommonResponseStatus.kt index e648191e..7ac50446 100644 --- a/core/common/src/main/java/com/teamwiney/core/common/base/CommonResponseStatus.kt +++ b/core/common/src/main/java/com/teamwiney/core/common/base/CommonResponseStatus.kt @@ -126,6 +126,9 @@ enum class CommonResponseStatus(val code: String, val message: String) { ), VERIFICATION_DID_NOT_MATCH( "M004", "인증 번호가 일치하지 않습니다." - ); + ), + MESSAGE_SEND_TOO_MANY_ATTEMPTS( + "M005", "인증번호 요청 횟수가 초과되었습니다." + ) } \ No newline at end of file diff --git a/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpAuthenticationScreen.kt b/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpAuthenticationScreen.kt index 73f772d5..1db36226 100644 --- a/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpAuthenticationScreen.kt +++ b/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpAuthenticationScreen.kt @@ -30,6 +30,7 @@ import com.teamwiney.auth.signup.SignUpContract.Companion.VERIFY_NUMBER_LENGTH import com.teamwiney.auth.signup.component.bottomsheet.AuthenticationFailedBottomSheet import com.teamwiney.auth.signup.component.bottomsheet.AuthenticationTimeOutBottomSheet import com.teamwiney.auth.signup.component.bottomsheet.ReturnToLoginBottomSheet +import com.teamwiney.auth.signup.component.bottomsheet.SendDisabledBottomSheet import com.teamwiney.auth.signup.component.bottomsheet.SendMessageBottomSheet import com.teamwiney.auth.signup.component.bottomsheet.SendMessageBottomSheetType import com.teamwiney.auth.signup.component.bottomsheet.SendTimeExceededLimitBottomSheet @@ -116,6 +117,19 @@ fun SignUpAuthenticationScreen( } } + is SignUpContract.BottomSheet.SendDisabled -> { + bottomSheetState.showBottomSheet { + SendDisabledBottomSheet { + bottomSheetState.hideBottomSheet() + appState.navigate(AuthDestinations.Login.ROUTE) { + popUpTo(AuthDestinations.SignUp.ROUTE) { + inclusive = true + } + } + } + } + } + is SignUpContract.BottomSheet.ReturnToLogin -> { bottomSheetState.showBottomSheet { ReturnToLoginBottomSheet( diff --git a/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpContract.kt b/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpContract.kt index 05b42360..f6af2b85 100644 --- a/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpContract.kt +++ b/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpContract.kt @@ -99,6 +99,7 @@ class SignUpContract { sealed class BottomSheet : UiSheet { object SendMessage : BottomSheet() object SendTimeExceededLimit : BottomSheet() + object SendDisabled : BottomSheet() object AuthenticationFailed : BottomSheet() object AuthenticationTimeOut : BottomSheet() object ReturnToLogin : BottomSheet() diff --git a/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpPhoneScreen.kt b/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpPhoneScreen.kt index be1d7f1a..048215b6 100644 --- a/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpPhoneScreen.kt +++ b/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpPhoneScreen.kt @@ -25,6 +25,7 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.teamwiney.auth.signup.SignUpContract.Companion.PHONE_NUMBER_LENGTH +import com.teamwiney.auth.signup.component.bottomsheet.SendDisabledBottomSheet import com.teamwiney.auth.signup.component.bottomsheet.SendMessageBottomSheet import com.teamwiney.auth.signup.component.bottomsheet.SendMessageBottomSheetType import com.teamwiney.auth.signup.component.bottomsheet.SendTimeExceededLimitBottomSheet @@ -94,6 +95,19 @@ fun SignUpPhoneScreen( } } + is SignUpContract.BottomSheet.SendDisabled -> { + bottomSheetState.showBottomSheet { + SendDisabledBottomSheet { + bottomSheetState.hideBottomSheet() + appState.navigate(AuthDestinations.Login.ROUTE) { + popUpTo(AuthDestinations.SignUp.ROUTE) { + inclusive = true + } + } + } + } + } + is SignUpContract.BottomSheet.UserAlreadyExists -> { bottomSheetState.showBottomSheet { val message = buildAnnotatedString { diff --git a/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpViewModel.kt b/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpViewModel.kt index 98529cf4..e5441a39 100644 --- a/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpViewModel.kt +++ b/feature/auth/src/main/java/com/teamwiney/auth/signup/SignUpViewModel.kt @@ -141,16 +141,26 @@ class SignUpViewModel @Inject constructor( } is ApiResult.ApiError -> { - if (it.code == CommonResponseStatus.USER_ALREADY_EXISTS.code) { - postEffect( - SignUpContract.Effect.ShowBottomSheet( - SignUpContract.BottomSheet.UserAlreadyExists( - it.message + when (it.code) { + CommonResponseStatus.USER_ALREADY_EXISTS.code -> { + postEffect( + SignUpContract.Effect.ShowBottomSheet( + SignUpContract.BottomSheet.UserAlreadyExists( + it.message + ) ) ) - ) - } else { - postEffect(SignUpContract.Effect.ShowSnackBar(it.message)) + } + CommonResponseStatus.MESSAGE_SEND_TOO_MANY_ATTEMPTS.code -> { + postEffect( + SignUpContract.Effect.ShowBottomSheet( + SignUpContract.BottomSheet.SendDisabled + ) + ) + } + else -> { + postEffect(SignUpContract.Effect.ShowSnackBar(it.message)) + } } } diff --git a/feature/auth/src/main/java/com/teamwiney/auth/signup/component/bottomsheet/SendDisabledBottomSheet.kt b/feature/auth/src/main/java/com/teamwiney/auth/signup/component/bottomsheet/SendDisabledBottomSheet.kt new file mode 100644 index 00000000..abef03b9 --- /dev/null +++ b/feature/auth/src/main/java/com/teamwiney/auth/signup/component/bottomsheet/SendDisabledBottomSheet.kt @@ -0,0 +1,71 @@ +package com.teamwiney.auth.signup.component.bottomsheet + +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import com.teamwiney.core.design.R +import com.teamwiney.ui.components.HeightSpacer +import com.teamwiney.ui.components.WButton +import com.teamwiney.ui.theme.WineyTheme + +@Composable +fun SendDisabledBottomSheet( + modifier: Modifier = Modifier, + containerColor: Color = WineyTheme.colors.gray_950, + onConfirm: () -> Unit +) { + Column( + modifier = modifier + .fillMaxWidth() + .background( + color = containerColor, + shape = RoundedCornerShape(topStart = 6.dp, topEnd = 6.dp) + ) + .padding(start = 24.dp, end = 24.dp, top = 10.dp, bottom = 20.dp), + horizontalAlignment = Alignment.CenterHorizontally + ) { + Spacer( + modifier = Modifier + .width(66.dp) + .height(5.dp) + .background( + color = WineyTheme.colors.gray_900, + shape = RoundedCornerShape(6.dp) + ) + ) + HeightSpacer(height = 20.dp) + Image( + painter = painterResource(id = R.mipmap.img_lock), + contentDescription = null + ) + HeightSpacer(height = 16.dp) + Text( + text = "아직 5분이 지나지 않았어요\n5분 후 인증을 진행해주세요!", + style = WineyTheme.typography.bodyB1, + color = WineyTheme.colors.gray_200, + textAlign = TextAlign.Center + ) + HeightSpacer(height = 72.dp) + WButton( + text = "확인", + onClick = { + onConfirm() + } + ) + HeightSpacer(height = 10.dp) + } +} \ No newline at end of file diff --git a/feature/auth/src/main/java/com/teamwiney/auth/signup/component/bottomsheet/SendTimeExceededLimitBottomSheet.kt b/feature/auth/src/main/java/com/teamwiney/auth/signup/component/bottomsheet/SendTimeExceededLimitBottomSheet.kt index ccc1d2a9..d51cd4b0 100644 --- a/feature/auth/src/main/java/com/teamwiney/auth/signup/component/bottomsheet/SendTimeExceededLimitBottomSheet.kt +++ b/feature/auth/src/main/java/com/teamwiney/auth/signup/component/bottomsheet/SendTimeExceededLimitBottomSheet.kt @@ -54,7 +54,7 @@ fun SendTimeExceededLimitBottomSheet( ) HeightSpacer(height = 16.dp) Text( - text = "인증 요청 제한 횟수를 초과했어요\n처음부터 다시 시도해주세요!", + text = "인증 요청 제한 횟수를 초과했어요\n5분 뒤 처음부터 진행해주세요!", style = WineyTheme.typography.bodyB1, color = WineyTheme.colors.gray_200, textAlign = TextAlign.Center