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 팀 정보 조회 API 이용하여 team 이름, profilePath 이용 되도록 수정 #78

Merged
merged 11 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class MainFragment : Fragment() {
})
binding.rvWeek.adapter = dayOfAdapter

val list = mainViewModel.houseWorks.value?.houseWorks?.toMutableList() ?: mutableListOf()
val list = mainViewModel.myHouseWorks.value?.houseWorks?.toMutableList() ?: mutableListOf()
Copy link
Collaborator

Choose a reason for hiding this comment

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

이제 다른 멤버의 집안일도 들어오니까 리네임하셨나보군요 센스쟁이..

houseWorkAdapter = HouseWorkAdapter(list, onClick = {
it
val dayOfWeek = DayOfWeek(it.scheduledDate, false)
Expand Down Expand Up @@ -152,7 +152,7 @@ class MainFragment : Fragment() {
}

lifecycleScope.launchWhenCreated {
mainViewModel.houseWorks.collect { houseWork ->
mainViewModel.myHouseWorks.collect { houseWork ->

houseWork?.let {
binding.isEmptyDone = it.countDone == 0
Expand All @@ -173,13 +173,13 @@ class MainFragment : Fragment() {

lifecycleScope.launchWhenCreated {
mainViewModel.currentState.collect {
val houseWork = mainViewModel.houseWorks.value ?: return@collect
val houseWork = mainViewModel.myHouseWorks.value ?: return@collect
binding.isSelectDone = it == MainViewModel.CurrentState.DONE
binding.isSelectRemain = it == MainViewModel.CurrentState.REMAIN
binding.layoutDoneScreen.root.isVisible =
it == MainViewModel.CurrentState.REMAIN && (houseWork.countLeft == 0 && houseWork.countDone > 0)

mainViewModel.houseWorks.value?.let {
mainViewModel.myHouseWorks.value?.let {
updateHouseWorkData(it)
}
}
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/depromeet/housekeeper/ui/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ class MainViewModel : ViewModel() {
val completeChoreNum: StateFlow<Int>
get() = _completeChoreNum

private val _houseWorks: MutableStateFlow<HouseWorks?> = MutableStateFlow(null)
val houseWorks: StateFlow<HouseWorks?>
get() = _houseWorks
private val _myHouseWorks: MutableStateFlow<HouseWorks?> = MutableStateFlow(null)
val myHouseWorks: StateFlow<HouseWorks?>
get() = _myHouseWorks

private val _currentState: MutableStateFlow<CurrentState?> = MutableStateFlow(CurrentState.REMAIN)
val currentState: StateFlow<CurrentState?>
Expand All @@ -127,10 +127,10 @@ class MainViewModel : ViewModel() {
Repository.getList(requestDate)
.runCatching {
collect {
_houseWorks.value = it
_myHouseWorks.value = it
}
}.onFailure {
_networkError.value = true
// _networkError.value = true
}
}
getCompleteHouseWorkNumber()
Expand Down