Skip to content
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

[Feature/#38] 클린 적용 #39

Open
wants to merge 26 commits into
base: develop-compose
Choose a base branch
from
Open

Conversation

0se0
Copy link
Member

@0se0 0se0 commented Jun 27, 2024

작업 내용

이슈

다 고쳐볼라고 했는데 너무 늦어서 그냥 올렸습니다..
네비게이션도 고쳐볼라고 했지만 금요일까지 못 할 거 같아서 지금 피알 올렸습니다..
di, data, domain 부분을 수정해본다고 동민옵 코드를 보며 구현했으나 아직입니다......
그러니 signup 코드를 중점적으로 봐주시면 될 거 같습니다.

@0se0 0se0 added the feat Further information is requested label Jun 27, 2024
@0se0 0se0 requested a review from chattymin June 27, 2024 13:50
@0se0 0se0 self-assigned this Jun 27, 2024
Copy link
Member

@chattymin chattymin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘하네요~
기존의 코드를 수정하는 과정이라 조금 코드가 난잡한 것 같은데 개념은 이해한 것 같아 보여요

앱잼에서 코드 짜면서 확실히 익혀 보아요~ 🚀

@@ -47,7 +47,7 @@ class MainActivity : ComponentActivity() {
@Composable
fun MainContent(
navController: NavHostController,
userRepository: UserRepository,
userRepository: AuthRepository,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

왜 레포지토리를 여기서 주입해주는걸까요??
사용하는 곳이 viewModel이니 거기서 주입해주면 좋을 것 같아요


@Composable
fun SignupScreen(navController: NavController) {
val viewModel: SignupViewModel = hiltViewModel()
fun SignupRoute(navController: NavController, viewModel: SignupViewModel = hiltViewModel()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 navController를 넘기는 방법을 선호하지는 않습니다. 하지만 한끼 코드에 제가 다른 방법을 적용시켜뒀으니 그 부분을 보고 공부한다면 좋을 것 같네요~

var phone by remember { mutableStateOf("") }

val authState by viewModel.signupStatus.observeAsState()
val signUpState by viewModel.signUpState.collectAsState()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collectAsStateWithlifecycle이라는 친구가 있어요. 알아보고 적용하면 좋을 것 같네요

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collectAsStateWithlifecycle를 사용하면 StateFlow를 Lifecycle 인식하며 데이터를 가져올 수 있어서 더 좋은 코드가 될 수 있을 거 같습니다! 감사합니다~

Comment on lines 57 to 70
LaunchedEffect(viewModel.sideEffect) {
viewModel.sideEffect.collectLatest { sideEffect ->
when (sideEffect) {
is SignupViewModel.SignupSideEffect.ShowError -> {
snackbarHostState.showSnackbar(
message = sideEffect.message,
duration = SnackbarDuration.Short
)
}

SignupViewModel.SignupSideEffect.NavigateToMain -> {
navController.navigate("login") {
popUpTo("signup") { inclusive = true }
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

채고~

import kotlinx.coroutines.launch
import retrofit2.Response
import javax.inject.Inject

@HiltViewModel
class SignupViewModel @Inject constructor(
private val userRepository: UserRepository,
private val authRepository: AuthRepository,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 여기엔 해뒀네요
수정 과정에서 윗 부분 수정이 안된거 같군요~

Comment on lines 102 to 105
sealed class SignupSideEffect {
data class ShowError(val message: String) : SignupSideEffect()
data object NavigateToMain : SignupSideEffect()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

따로 파일 분리 해주세요~

Comment on lines 10 to 12
suspend fun signup(user: RequestUserEntity): Result<Response<BaseResponseWithoutDataDto>>
suspend fun login(user: RequestSignInEntity): Result<Response<BaseResponseWithoutDataDto>>
suspend fun changePassword(user: RequestChangePasswordEntity): Result<Response<BaseResponseWithoutDataDto>>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제가 실수로 이렇게 해서 따라한 것 같은데 Domain 모듈에서는 retrofit 종속성이 있으면 안됩니다!!
Response로 반환하면 안대용~

Copy link
Member

@chattymin chattymin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

빠른 반영 채고!!!
아쉽거나 좀 더 공부하고 싶은 부분은 앱잼에서 달리면서 같이 해봐요~ 🏃‍♀️‍➡️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants