-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/#11 week7 #12
base: develop
Are you sure you want to change the base?
Feat/#11 week7 #12
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7์ฃผ์ฐจ ๊ณผ์ ๊ณ ์ํ์ จ์ต๋๋ค! ์ ๊ฐ MVI ์ฝ๋๋ฅผ ์ ์ดํดํ์ง ๋ชปํด์, ์ฝ๋ ์ฐธ๊ณ ๋ฅผ ๋ง์ด ํ๊ณ ๋ฐฐ์ธ ์ ์์๋ ๊ฒ ๊ฐ์ต๋๋ค.. ๊ณ ์ํ์ จ์ด์!
text = when { | ||
uiState.isLoading -> "๋ก๋ฉ ์ค..." | ||
uiState.hobby.isNotEmpty() -> uiState.hobby | ||
else -> "์ฐพ์ ์ ์์ต๋๋ค" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ก๋ฉ์ ๋ํ ์ฒ๋ฆฌ๋ ํ์ จ๋ค์!
viewModel.sideEffect.collectLatest { sideEffect -> | ||
when (sideEffect) { | ||
is MyPageContract.MyPageSideEffect.ShowErrorToast -> { | ||
Toast.makeText(context, sideEffect.message, Toast.LENGTH_SHORT).show() | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collectLatest๋ ์ด๋ค ๋์ฅ ๋ฐฉ์์ ์ฐ์ฐ์์ธ๊ฐ์?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ ๋ ๊ถ๊ธํฉ๋๋ค!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ ๋ MVI ๊ตฌํํ ๋, ์ด๋ ค์ ๋ง์ด ๊ฒช์๋๋ฐ ํจ์๋ ์ฝ๋์์ ์๊ฐ์ ๋ง์ด ์ป์ด๊ฐ๋๋ค!! ๋๋ฌด ์ํ์ ์ ํ์ ์ดํ์ด๋ ๊ถ๊ธํ ๋ด์ฉ ์ผ์นํ๋ ๋ถ๋ถ๋ง ์ง๋ฌธ ๋จ๊ฒผ์ด์!! ๊ณ ์ํ์ จ์ต๋๋ค! ์ฑ์ผํ์ดํ ~
viewModel.sideEffect.collectLatest { sideEffect -> | ||
when (sideEffect) { | ||
is MyPageContract.MyPageSideEffect.ShowErrorToast -> { | ||
Toast.makeText(context, sideEffect.message, Toast.LENGTH_SHORT).show() | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ ๋ ๊ถ๊ธํฉ๋๋ค!!
class SignUpContract { | ||
data class SignUpState( | ||
val email: String = "", | ||
val password: String = "", | ||
val hobby: String = "", | ||
val isLoading: Boolean = false, | ||
val errorMessage: String? = null | ||
) : UiState | ||
|
||
sealed class SignUpEvent : UiEvent { | ||
data class UpdateEmail(val email: String) : SignUpEvent() | ||
data class UpdatePassword(val password: String) : SignUpEvent() | ||
data class UpdateHobby(val hobby: String) : SignUpEvent() | ||
data object SubmitSignUp : SignUpEvent() | ||
} | ||
|
||
sealed class SignUpSideEffect:UiSideEffect { | ||
data object NavigateToLogin : SignUpSideEffect() | ||
data class ShowSnackbar(val message: String) : SignUpSideEffect() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๊น๋ํ๋ค์ ๐๐ป๐๐ป
LaunchedEffect(Unit) { | ||
viewModel.sideEffect.collectLatest { sideEffect -> | ||
when (sideEffect) { | ||
is LoginContract.LoginSideEffect.NavigateToMyPageWithToken -> { | ||
saveAuthToken(context, sideEffect.token) | ||
navController.navigate("mypage") { | ||
popUpTo("login") { inclusive = true } | ||
} | ||
} | ||
|
||
is LoginContract.LoginSideEffect.ShowSnackbar -> { | ||
snackbarHostState.showSnackbar(sideEffect.message) | ||
} | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด๋ฐ์์ผ๋ก ์ฒ๋ฆฌํ ์ ์๊ฒ ๋ค์! ๋ฐฐ์๊ฐ๋๋ค!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๊ณ ์ํ์ จ์ต๋๋ค ~
val loginPassword by viewModel.password.collectAsState() | ||
var passwordVisible by remember { mutableStateOf(false) } | ||
fun LoginScreen(navController: NavController, viewModel: LoginViewModel = hiltViewModel()) { | ||
val uiState by viewModel.uiState.collectAsState() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collectAsStateWithLifecycle์ ์ฌ์ฉํ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค ~ (์์ธ์ง๋ ์ธ๋ฏธ๋ ์๋ฃ ์ฐธ๊ณ !!)
val loginEmail by viewModel.email.collectAsState() | ||
val loginPassword by viewModel.password.collectAsState() | ||
var passwordVisible by remember { mutableStateOf(false) } | ||
fun LoginScreen(navController: NavController, viewModel: LoginViewModel = hiltViewModel()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NavController ๊ฐ์ฒด ์์ฒด๋ฅผ ๋๊ธฐ๋ ๊ฒ๋ณด๋ค ์ด๋ฅผ ์ฌ์ฉํ๋ ํจ์๋ฅผ ๋๊ฒจ์ฃผ์๋ ๊ฒ ์ข์ ๊ฒ ๊ฐ์์!
NavController ๊ฐ์ฒด ์์ฒด๋ฅผ ๋๊ธฐ๊ฒ ๋๋ฉด LoginScreen์ด ๋ค๋น๊ฒ์ด์
๊ณผ ๊ด๋ จ๋ ์ฑ
์๋ ๊ฐ์ง๊ฒ ๋์ด์ ๊ทธ ์ญํ ์ด ๋ฌด๊ฑฐ์ ์ง๋๋ค.
๋ํ, ํ
์คํธ ๋ฑ์ด ์ด๋ ต๊ฒ ๋์ด์!
text1 = stringResource(R.string.login_find_id), | ||
text2 = stringResource(R.string.login_setting_password_again), | ||
text3 = stringResource(R.string.sign_up), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์กฐ๊ธ ๋ ์ง๊ด์ ์ธ ๋ค์ด๋ฐ์ ์ฌ์ฉํด ์ฃผ์ ๋ ์ข์ ๊ฒ ๊ฐ๋ค์ !
Related issue ๐
Work Description โ๏ธ
Screenshot ๐ธ
Uncompleted Tasks ๐
To Reviewers ๐ข
์์ง UI๋จ์ ์์ผ๋ฉด ์๋๋ ์ฝ๋๋ค์ด ์ฌ๋ฟ ๋ณด์ ๋๋ค.. ๋จธ์ฑ
ํด๋น ๋ถ๋ถ์ ์ธ์งํ๊ณ ์์ต๋๋ค. ํ๊ต ๊ณผ์ ๊ฐ ๋๋๋๋๋ก ๋ค์ ๋ถ๋ฆฌํ๊ฒ ์ต๋๋ค.
MVI๊ฐ ์ฒ์์ด๋ผ ๋ถ์กฑํ ๋ถ๋ถ์ด ๋ง์ํ ๋ฐ ๋ฐ๋ํ ์ง์ ๋ถํ๋๋ฆฌ๊ฒ ์ต๋๋ค!
ํญ์ ๊ฐ์ฌํฉ๋๋ค