[Refactor/xml] Clean Architecture 적용#21
Open
yskim6772 wants to merge 23 commits into
Open
Conversation
chanubc
approved these changes
Jun 27, 2024
| @@ -0,0 +1,17 @@ | |||
| package com.sopt.now.domain.entity | |||
|
|
|||
| import com.sopt.now.data.dto.request.RequestSignUpDto | |||
Member
There was a problem hiding this comment.
domain은 data에 의존하면 안되기 때문에 mapper함수는 data영역으로 이동시켜 주세요!
Comment on lines
+48
to
51
| homeViewModel.friends.flowWithLifecycle(lifecycle).onEach { friends -> | ||
| friendAdapter.setFriends(friends) | ||
| } | ||
| }.launchIn(lifecycleScope) | ||
| } |
Member
There was a problem hiding this comment.
flow는 생명주기를 모르기때문에 flowWithLifecycle과 launIn의 파라미터로 scope를 명시해 줍니다!
이 경우 activity와 fragment의 생명주기가 다르기 때문에 차이점을 알아보고 변경하면 좋을 것 같아요!
현재는 fragment scope로 변경하시면 됩니다!
| binding.btnLogin.setOnClickListener { | ||
| viewModel.login(getLoginRequestDto()) | ||
| navigateToMain() | ||
| viewModel.login(getLoginRequestDto().authenticationId, getLoginRequestDto().password) |
Member
There was a problem hiding this comment.
마찬가지로 ui에서는 data를 모르기 때문에 domain의 entity를 의존해서 사용해야해요!
dto를 ui에서 사용하지 않도록 수정해주세요~
Comment on lines
+42
to
+44
| if (uiState.isSuccess) { | ||
| this@LoginActivity.showToast(uiState.message) | ||
| navigateToMain() |
Member
There was a problem hiding this comment.
when (state) {
is UiState.Success -> reqresAdapter.submitList(state.data)
is UiState.Failure -> snackBar(binding.root, state.errorMessage)
is UiState.Loading -> toast("로딩중")
}이런식으로 when문과 is 를 통해 state를 관찰하고 필요한 구문을 실행시킬 수 있어요!
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work Description ✏️
Clean Architecture 적용하기 !
로그인, 회원가입은 서버 닫힘 이슈로 확인이 안 됐는데,
Open API로 friendList 받아오는 부분은 확인 완료했습니당