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

[Refactor/xml] Clean Architecture 적용 #21

Open
wants to merge 23 commits into
base: develop-xml
Choose a base branch
from

Conversation

yskim6772
Copy link
Member

@yskim6772 yskim6772 commented Jun 27, 2024

Work Description ✏️

Clean Architecture 적용하기 !

로그인, 회원가입은 서버 닫힘 이슈로 확인이 안 됐는데,
Open API로 friendList 받아오는 부분은 확인 완료했습니당

image

Copy link

@chanubc chanubc left a comment

Choose a reason for hiding this comment

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

엄청 잘하셨어요!!
깜짝놀랐습니다ㅎㅎ

@@ -0,0 +1,17 @@
package com.sopt.now.domain.entity

import com.sopt.now.data.dto.request.RequestSignUpDto
Copy link

Choose a reason for hiding this comment

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

domain은 data에 의존하면 안되기 때문에 mapper함수는 data영역으로 이동시켜 주세요!

Comment on lines +48 to 51
homeViewModel.friends.flowWithLifecycle(lifecycle).onEach { friends ->
friendAdapter.setFriends(friends)
}
}.launchIn(lifecycleScope)
}
Copy link

Choose a reason for hiding this comment

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

flow는 생명주기를 모르기때문에 flowWithLifecycle과 launIn의 파라미터로 scope를 명시해 줍니다!
이 경우 activity와 fragment의 생명주기가 다르기 때문에 차이점을 알아보고 변경하면 좋을 것 같아요!
현재는 fragment scope로 변경하시면 됩니다!

@@ -32,29 +30,32 @@ class LoginActivity : AppCompatActivity() {

private fun initViews() {
binding.btnLogin.setOnClickListener {
viewModel.login(getLoginRequestDto())
navigateToMain()
viewModel.login(getLoginRequestDto().authenticationId, getLoginRequestDto().password)
Copy link

Choose a reason for hiding this comment

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

마찬가지로 ui에서는 data를 모르기 때문에 domain의 entity를 의존해서 사용해야해요!
dto를 ui에서 사용하지 않도록 수정해주세요~

Comment on lines +42 to +44
if (uiState.isSuccess) {
[email protected](uiState.message)
navigateToMain()
Copy link

Choose a reason for hiding this comment

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

 when (state) {
                is UiState.Success -> reqresAdapter.submitList(state.data)
                is UiState.Failure -> snackBar(binding.root, state.errorMessage)
                is UiState.Loading -> toast("로딩중")
            }

이런식으로 when문과 is 를 통해 state를 관찰하고 필요한 구문을 실행시킬 수 있어요!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants