Skip to content

Commit

Permalink
#56 Feat : 5분 비활성화 시간이 자나지 않았음을 표시하는 바텀 시트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
DongChyeon committed Mar 4, 2024
1 parent a9370b5 commit 8ae1819
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ enum class CommonResponseStatus(val code: String, val message: String) {
),
VERIFICATION_DID_NOT_MATCH(
"M004", "인증 번호가 일치하지 않습니다."
);
),
MESSAGE_SEND_TOO_MANY_ATTEMPTS(
"M005", "인증번호 요청 횟수가 초과되었습니다."
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8ae1819

Please sign in to comment.