-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
191 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
app/src/main/java/com/sopt/withsuhyeon/feature/onboarding/PhoneNumberAuthenticationScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
package com.sopt.withsuhyeon.feature.onboarding | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxHeight | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import com.sopt.withsuhyeon.R | ||
import com.sopt.withsuhyeon.core.component.button.BasicButtonForTextField | ||
import com.sopt.withsuhyeon.core.component.button.LargeButton | ||
import com.sopt.withsuhyeon.core.component.progressbar.AnimatedProgressBar | ||
import com.sopt.withsuhyeon.core.component.textfield.BasicShortTextField | ||
import com.sopt.withsuhyeon.core.util.KeyStorage.NEXT_BUTTON_TEXT | ||
import com.sopt.withsuhyeon.feature.onboarding.components.OnBoardingTitle | ||
|
||
@Composable | ||
fun PhoneNumberAuthenticationRoute( | ||
navigateToNext: () -> Unit, | ||
viewModel: OnBoardingViewModel = hiltViewModel() | ||
) { | ||
PhoneNumberAuthenticationScreen( | ||
onButtonClick = navigateToNext | ||
) | ||
} | ||
|
||
@Composable | ||
fun PhoneNumberAuthenticationScreen( | ||
onButtonClick: () -> Unit, | ||
modifier: Modifier = Modifier | ||
) { | ||
var phoneNumberValue by remember { mutableStateOf("") } | ||
var isPhoneNumberInputValid by remember { mutableStateOf(false) } | ||
var isPhoneNumberInputEnabled by remember { mutableStateOf(true) } | ||
var isPhoneNumberInputFocused by remember { mutableStateOf(false) } | ||
var isPhoneNumberAuthVisible by remember { mutableStateOf(false) } | ||
var isPhoneNumberAuthButtonEnabled by remember { mutableStateOf(false) } | ||
var phoneNumberAuthButtonText by remember { mutableStateOf("인증요청") } | ||
var authNumberValue by remember { mutableStateOf("") } | ||
var isAuthNumberInputValid by remember { mutableStateOf(false) } | ||
var isAuthNumberInputEnabled by remember { mutableStateOf(true) } | ||
var isAuthNumberInputFocused by remember { mutableStateOf(false) } | ||
|
||
Column( | ||
modifier = modifier | ||
.padding(16.dp) | ||
.fillMaxWidth() | ||
.fillMaxHeight(), | ||
) { | ||
AnimatedProgressBar(progress = 0.33f) | ||
Spacer( | ||
modifier = Modifier.height(16.dp) | ||
) | ||
OnBoardingTitle(text = stringResource(R.string.onboarding_phone_number_title)) | ||
Spacer( | ||
modifier = Modifier.height(32.dp) | ||
) | ||
BasicShortTextField( | ||
value = phoneNumberValue, | ||
title = stringResource(R.string.onboarding_phone_number_input_title), | ||
hint = stringResource(R.string.onboarding_phone_number_input_hint), | ||
isValid = isPhoneNumberInputValid, | ||
enabled = isPhoneNumberInputEnabled, | ||
onFocusChange = { | ||
isPhoneNumberInputFocused = it | ||
}, | ||
onValueChange = { input -> | ||
isPhoneNumberInputValid = input.length == 11 | ||
isPhoneNumberAuthButtonEnabled = input.length == 11 | ||
phoneNumberValue = input | ||
}, | ||
maxLength = 11, | ||
errorMessage = stringResource(R.string.onboarding_phone_number_duplication_error_message), | ||
trailingContent = { | ||
BasicButtonForTextField( | ||
text = phoneNumberAuthButtonText, | ||
onClick = { | ||
isPhoneNumberAuthVisible = true | ||
isPhoneNumberAuthButtonEnabled = false | ||
phoneNumberAuthButtonText = "전송완료" | ||
}, | ||
modifier = Modifier, | ||
enabled = isPhoneNumberAuthButtonEnabled | ||
) | ||
} | ||
) | ||
Spacer( | ||
modifier = Modifier.height(12.dp) | ||
) | ||
if (isPhoneNumberAuthVisible) { | ||
BasicShortTextField( | ||
value = authNumberValue, | ||
title = stringResource(R.string.onboarding_phone_number_auth_input_title), | ||
hint = stringResource(R.string.onboarding_phone_number_auth_input_hint), | ||
isValid = isAuthNumberInputValid, | ||
enabled = isAuthNumberInputEnabled, | ||
onFocusChange = { | ||
isAuthNumberInputFocused = it | ||
}, | ||
onValueChange = { input -> | ||
isAuthNumberInputValid = input.length == 6 | ||
authNumberValue = input | ||
}, | ||
maxLength = 6, | ||
errorMessage = stringResource(R.string.onboarding_phone_number_duplication_error_message), | ||
) | ||
} | ||
Spacer(modifier = Modifier.weight(1f)) | ||
LargeButton( | ||
onClick = onButtonClick, | ||
text = NEXT_BUTTON_TEXT, | ||
isDisabled = !isAuthNumberInputValid | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/sopt/withsuhyeon/feature/onboarding/components/OnBoardingTitle.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.sopt.withsuhyeon.feature.onboarding.components | ||
|
||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.typography | ||
|
||
@Composable | ||
fun OnBoardingTitle( | ||
text: String, | ||
modifier: Modifier = Modifier | ||
) { | ||
Text( | ||
modifier = modifier.padding(vertical = 20.dp), | ||
text = text, | ||
style = typography.title02_B, | ||
) | ||
} |
25 changes: 19 additions & 6 deletions
25
app/src/main/java/com/sopt/withsuhyeon/feature/onboarding/navigation/OnBoardingNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
package com.sopt.withsuhyeon.feature.onboarding.navigation | ||
|
||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.compose.composable | ||
import com.sopt.withsuhyeon.feature.onboarding.PhoneNumberAuthenticationRoute | ||
import com.sopt.withsuhyeon.feature.onboarding.TermsOfUseRoute | ||
import com.sopt.withsuhyeon.core.navigation.Route.TermsOfUse as TermsOfUseRoute | ||
import com.sopt.withsuhyeon.core.navigation.Route.PhoneNumberAuth as PhoneNumberAuthRoute | ||
import com.sopt.withsuhyeon.core.navigation.Route.NickNameAuth as NickNameAuthRoute | ||
|
||
fun NavController.navigateToTermsOfUse() { | ||
navigate(TermsOfUseRoute) | ||
} | ||
fun NavController.navigateToPhoneNumberAuth() { | ||
navigate(PhoneNumberAuthRoute) | ||
} | ||
|
||
fun NavController.navigateToNickNameAuth() { | ||
navigate(NickNameAuthRoute) | ||
} | ||
|
||
fun NavGraphBuilder.termsOfUseNavGraph( | ||
padding: PaddingValues, | ||
onNavigateToNext: () -> Unit | ||
fun NavGraphBuilder.onBoardingNavGraph( | ||
onNavigateToPhoneNumberAuth: () -> Unit, | ||
onNavigateToNickNameAuth: () -> Unit | ||
) { | ||
composable<TermsOfUseRoute> { | ||
TermsOfUseRoute( | ||
padding = padding, | ||
navigateToNext = onNavigateToNext | ||
navigateToNext = onNavigateToPhoneNumberAuth | ||
) | ||
} | ||
composable<PhoneNumberAuthRoute> { | ||
PhoneNumberAuthenticationRoute( | ||
navigateToNext = onNavigateToNickNameAuth | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters