-
Notifications
You must be signed in to change notification settings - Fork 2
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/#68] 투두 전체 조회 / 서버통신 구현 #74
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.
서버통신 덕분에 복습했습니다! 힐트 빨리 마스터해야겠다,,
|
||
fun toTodoModel() = | ||
TodoModel(todoId, title, endDate, allocators.map { it.toTodoAllocatorModel() }, secret) | ||
} |
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.
좋습니다!!!
|
||
fun getCompleteTodoListFromServer(tripId: Long, category: String, progress: String) { |
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.
네이밍 자세한 거 좋습니당
private fun observeTodoListState() { | ||
viewModel.todoCompleteListState.flowWithLifecycle(lifecycle).onEach { state -> | ||
when (state) { |
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.
flowWithLifecycle 조아여
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.
아 코드 미쳤네욥
굿뜨. 따봉.
-오전 8시 53분
@Singleton | ||
fun provideSettingDataSource(settingDataSourceImpl: SettingDataSourceImpl): SettingDataSource = | ||
settingDataSourceImpl | ||
|
||
@Provides | ||
@Singleton | ||
fun provideTodoDataSource(todoDataSourceImpl: TodoDataSourceImpl): TodoDataSource = | ||
todoDataSourceImpl | ||
|
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.
시작됐다....서버통신.!........!!!!!
private fun setViewPager() { | ||
binding.vpMyTodo.adapter = MyTodoViewPagerAdapter(this) | ||
binding.vpMyTodo.isUserInputEnabled = false | ||
TabLayoutMediator(binding.tabMyTodo, binding.vpMyTodo) { tab, pos -> |
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.
우와 스와이프 막는 코드.. 뷰페이저 조아요~
private val _todoUncompleteListState = MutableStateFlow<UiState<List<TodoModel>>>(UiState.Empty) | ||
val todoUncompleteListState: StateFlow<UiState<List<TodoModel>>> = _todoUncompleteListState |
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.
Uistate 좋아여~
fun getUncompleteTodoListFromServer(tripId: Long, category: String, progress: String) { | ||
_todoUncompleteListState.value = UiState.Loading | ||
viewModelScope.launch { | ||
todoRepository.getTodoList(tripId, category, progress) | ||
.onSuccess { response -> | ||
_todoUncompleteListState.value = UiState.Success(response) | ||
_totalUncompletedTodoCount.value = response.size | ||
} | ||
.onFailure { | ||
_todoUncompleteListState.value = UiState.Failure(it.message.orEmpty()) | ||
} | ||
} | ||
} | ||
|
||
fun getCompleteTodoListFromServer(tripId: Long, category: String, progress: String) { | ||
_todoCompleteListState.value = UiState.Loading | ||
viewModelScope.launch { | ||
todoRepository.getTodoList(tripId, category, progress) | ||
.onSuccess { response -> | ||
_todoCompleteListState.value = UiState.Success(response) | ||
} | ||
.onFailure { | ||
_todoCompleteListState.value = UiState.Failure(it.message.orEmpty()) | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
const val MY_TODO = "my" | ||
const val UNCOMPLETE = "incomplete" | ||
const val COMPLETE = "complete" | ||
} |
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.
...서버통신 코드...장난 아니네요 조아여~
⛳️ Work Description
📸 Screenshot
KakaoTalk_Video_2024-01-11-08-46-15.mp4
📢 To Reviewers